diff options
Diffstat (limited to 'src/de/blinkt')
-rw-r--r-- | src/de/blinkt/openvpn/MainActivity.java | 12 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/LogFragment.java | 11 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/SeekbarTicks.java | 10 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/fragments/VPNProfileList.java | 16 |
5 files changed, 36 insertions, 15 deletions
diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java index 75cfa689..e1d417ca 100644 --- a/src/de/blinkt/openvpn/MainActivity.java +++ b/src/de/blinkt/openvpn/MainActivity.java @@ -20,21 +20,24 @@ public class MainActivity extends Activity { Tab generalTab = bar.newTab().setText(R.string.generalsettings); Tab faqtab = bar.newTab().setText(R.string.faq); Tab abouttab = bar.newTab().setText(R.string.about); - Tab logtab = bar.newTab().setText("Log"); vpnListTab.setTabListener(new TabListener<VPNProfileList>("profiles", VPNProfileList.class)); generalTab.setTabListener(new TabListener<GeneralSettings>("settings", GeneralSettings.class)); faqtab.setTabListener(new TabListener<FaqFragment>("faq", FaqFragment.class)); abouttab.setTabListener(new TabListener<AboutFragment>("about", AboutFragment.class)); - logtab.setTabListener(new TabListener<LogFragment>("log",LogFragment.class)); bar.addTab(vpnListTab); - bar.addTab(logtab); bar.addTab(generalTab); bar.addTab(faqtab); bar.addTab(abouttab); - if(SendDumpFragment.getLastestDump(this)!=null) { + if (false) { + Tab logtab = bar.newTab().setText("Log"); + logtab.setTabListener(new TabListener<LogFragment>("log", LogFragment.class)); + bar.addTab(logtab); + } + + if(SendDumpFragment.getLastestDump(this)!=null) { Tab sendDump = bar.newTab().setText(R.string.crashdump); sendDump.setTabListener(new TabListener<SendDumpFragment>("crashdump",SendDumpFragment.class)); bar.addTab(sendDump); @@ -48,7 +51,6 @@ public class MainActivity extends Activity { private String mTag; private Class<T> mClass; - public TabListener(String tag, Class<T> clz) { mTag = tag; mClass = clz; diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index ce2aab37..7b5faae3 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -642,6 +642,8 @@ public class VpnProfile implements Serializable { exp=e; } catch (NoCertReturnedException e) { exp =e; + } catch (IllegalArgumentException e) { + exp =e; } catch (AssertionError e) { if (tries ==0) return null; 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); |