summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/fragments
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt/openvpn/fragments')
-rw-r--r--src/de/blinkt/openvpn/fragments/LogFragment.java11
-rw-r--r--src/de/blinkt/openvpn/fragments/SeekbarTicks.java10
-rw-r--r--src/de/blinkt/openvpn/fragments/VPNProfileList.java16
3 files changed, 27 insertions, 10 deletions
diff --git a/src/de/blinkt/openvpn/fragments/LogFragment.java b/src/de/blinkt/openvpn/fragments/LogFragment.java
index 9508f158..750b5703 100644
--- a/src/de/blinkt/openvpn/fragments/LogFragment.java
+++ b/src/de/blinkt/openvpn/fragments/LogFragment.java
@@ -60,6 +60,7 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
}
};
+
private SeekBar mLogLevelSlider;
private LinearLayout mOptionsLayout;
private RadioGroup mTimeRadioGroup;
@@ -74,12 +75,10 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
-
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
-
}
@Override
@@ -225,10 +224,10 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
timeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.getDefault());
else
timeformat = DateFormat.getTimeFormat(getActivity());
- time = timeformat.format(d);
+ time = timeformat.format(d) + " ";
}
- msg = time + " " + le.getVerbosityLevel() + " " + msg;
+ msg = time + msg;
int spanStart = time.length();
@@ -518,7 +517,9 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
super.onStop();
VpnStatus.removeStateListener(this);
VpnStatus.removeByteCountListener(this);
- getActivity().unbindService(mConnection);
+
+ if(mService!=null)
+ getActivity().unbindService(mConnection);
getActivity().getPreferences(0).edit().putInt(LOGTIMEFORMAT, ladapter.mTimeFormat)
.putInt(VERBOSITYLEVEL, ladapter.mLogLevel).apply();
diff --git a/src/de/blinkt/openvpn/fragments/SeekbarTicks.java b/src/de/blinkt/openvpn/fragments/SeekbarTicks.java
index 1e289529..ec68e7e4 100644
--- a/src/de/blinkt/openvpn/fragments/SeekbarTicks.java
+++ b/src/de/blinkt/openvpn/fragments/SeekbarTicks.java
@@ -14,6 +14,7 @@ public class SeekBarTicks extends SeekBar {
private Paint mTickPaint;
private float mTickHeight;
+ private float tickHeightRatio = 0.6f;
public SeekBarTicks(Context context, AttributeSet attrs) {
super (context, attrs);
@@ -37,7 +38,7 @@ public class SeekBarTicks extends SeekBar {
new int[] { android.R.attr.secondaryProgress }, defStyle, 0);
- int tickColor = a.getColor(0, android.R.color.white);
+ int tickColor = a.getColor(0, android.R.color.black);
mTickPaint = new Paint();
mTickPaint.setColor( context.getResources().getColor(tickColor));
a.recycle();
@@ -53,11 +54,16 @@ public class SeekBarTicks extends SeekBar {
private void drawTicks(Canvas canvas) {
final int available = getWidth() - getPaddingLeft() - getPaddingRight();
+ final int availableHeight = getHeight() - getPaddingBottom() - getPaddingTop();
+
+ int extrapadding = (int) ((availableHeight- (availableHeight * tickHeightRatio))/2);
+
int tickSpacing = available / (getMax() );
for (int i = 1; i < getMax(); i++) {
final float x = getPaddingLeft() + i * tickSpacing;
- canvas.drawLine(x, getPaddingTop(), x, getHeight()-getPaddingBottom(), mTickPaint);
+
+ canvas.drawLine(x, getPaddingTop()+extrapadding, x, getHeight()-getPaddingBottom()-extrapadding, mTickPaint);
}
}
}
diff --git a/src/de/blinkt/openvpn/fragments/VPNProfileList.java b/src/de/blinkt/openvpn/fragments/VPNProfileList.java
index 2b03048f..447ed1e0 100644
--- a/src/de/blinkt/openvpn/fragments/VPNProfileList.java
+++ b/src/de/blinkt/openvpn/fragments/VPNProfileList.java
@@ -33,10 +33,12 @@ public class VPNProfileList extends ListFragment {
private static final int START_VPN_CONFIG = 92;
private static final int SELECT_PROFILE = 43;
private static final int IMPORT_PROFILE = 231;
+ private static final int FILE_PICKER_RESULT = 392;
private static final int MENU_IMPORT_PROFILE = Menu.FIRST +1;
- class VPNArrayAdapter extends ArrayAdapter<VpnProfile> {
+
+ class VPNArrayAdapter extends ArrayAdapter<VpnProfile> {
public VPNArrayAdapter(Context context, int resource,
int textViewResourceId) {
@@ -199,14 +201,22 @@ public class VPNProfileList extends ListFragment {
onAddProfileClicked();
return true;
} else if (itemId == MENU_IMPORT_PROFILE) {
- startImportConfig();
+ //startImportConfig();
+ startFilePicker();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
- private void startImportConfig() {
+ private void startFilePicker() {
+ Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT);
+ i.addCategory(Intent.CATEGORY_OPENABLE);
+ i.setType("application/x-openvpn-profile");
+ startActivityForResult(i,FILE_PICKER_RESULT);
+ }
+
+ private void startImportConfig() {
Intent intent = new Intent(getActivity(),FileSelect.class);
intent.putExtra(FileSelect.NO_INLINE_SELECTION, true);
intent.putExtra(FileSelect.WINDOW_TITLE, R.string.import_configuration_file);