summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2013-02-28 17:43:12 +0100
committerArne Schwabe <arne@rfc2549.org>2013-02-28 17:43:12 +0100
commitc2d2473b1618a9a002344ec6be1e67004fdb1f94 (patch)
tree26e6080ee9aaa63de6d55ec0983d840ed65e423a
parent428ef31f6a1de54cd6e3c20264f5ab411a076aaa (diff)
New Layout for main screen
-rw-r--r--AndroidManifest.xml5
-rw-r--r--res/layout/file_dialog_main.xml20
-rw-r--r--res/layout/fragment_senddump.xml24
-rw-r--r--res/menu/configmenu.xml2
-rw-r--r--res/menu/logmenu.xml2
-rw-r--r--res/menu/vpn_context.xml25
-rwxr-xr-xres/values/strings.xml16
-rw-r--r--res/xml/main_headers.xml20
-rw-r--r--src/de/blinkt/openvpn/ConfigParser.java2
-rw-r--r--src/de/blinkt/openvpn/FileSelect.java5
-rw-r--r--src/de/blinkt/openvpn/FileSelectLayout.java1
-rw-r--r--src/de/blinkt/openvpn/FileSelectionFragment.java65
-rw-r--r--src/de/blinkt/openvpn/FragmentGeneralSettings.java12
-rw-r--r--src/de/blinkt/openvpn/MainActivity.java102
-rw-r--r--src/de/blinkt/openvpn/OpenVPN.java5
-rw-r--r--src/de/blinkt/openvpn/SendDumpFragment.java (renamed from src/de/blinkt/openvpn/SendDumpActivity.java)44
-rw-r--r--src/de/blinkt/openvpn/VPNProfileList.java9
17 files changed, 219 insertions, 140 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index a1acaa3d..5eb7d274 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -44,7 +44,8 @@
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app"
- android:supportsRtl="true" >
+ android:supportsRtl="true"
+ android:uiOptions="splitActionBarWhenNarrow" >
<activity android:name=".AboutFragment" />
<activity
android:name=".VPNPreferences"
@@ -54,7 +55,7 @@
android:allowTaskReparenting="true"
android:label="@string/openvpn_log"
android:launchMode="singleTask" />
- <activity android:name=".SendDumpActivity" />
+ <activity android:name=".SendDumpFragment" />
<activity android:name=".FileSelect" />
<activity android:name=".MainActivity" >
<intent-filter>
diff --git a/res/layout/file_dialog_main.xml b/res/layout/file_dialog_main.xml
index db791663..b50ef8a6 100644
--- a/res/layout/file_dialog_main.xml
+++ b/res/layout/file_dialog_main.xml
@@ -13,23 +13,29 @@
android:orientation="horizontal" >
<Button
- android:id="@+id/importfile"
+ android:id="@+id/fdButtonSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/import_file" >
+ android:text="@string/select_file" >
</Button>
- <Button
- android:id="@+id/fdButtonSelect"
+ <CheckBox
+ android:id="@+id/doinline"
+ android:checked="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/select_file" >
- </Button>
-
+ android:text="@string/make_selection_inline" />
+
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1" />
+
<Button
android:id="@+id/fdClear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_gravity="right"
android:text="@string/clear" >
</Button>
</LinearLayout>
diff --git a/res/layout/fragment_senddump.xml b/res/layout/fragment_senddump.xml
new file mode 100644
index 00000000..2f573de5
--- /dev/null
+++ b/res/layout/fragment_senddump.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/RelativeLayout1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:orientation="vertical" >
+
+ <Button
+ android:id="@+id/senddump"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:layout_centerVertical="true"
+ android:text="@string/send_minidump" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/senddump"
+ android:layout_centerHorizontal="true"
+ android:text="@string/send_minidump_summary" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/menu/configmenu.xml b/res/menu/configmenu.xml
index 1d47e26b..41130970 100644
--- a/res/menu/configmenu.xml
+++ b/res/menu/configmenu.xml
@@ -5,7 +5,7 @@
android:id="@+id/sendConfig"
android:icon="@android:drawable/ic_menu_share"
android:showAsAction="ifRoom|withText"
- android:title="Send config file"
+ android:title="@string/send_config"
android:titleCondensed="@string/send"/>
</menu> \ No newline at end of file
diff --git a/res/menu/logmenu.xml b/res/menu/logmenu.xml
index 0cc95b69..ee0f86de 100644
--- a/res/menu/logmenu.xml
+++ b/res/menu/logmenu.xml
@@ -33,7 +33,7 @@
android:title="@string/edit_vpn"/>
<item
android:id="@+id/toggle_time"
- android:alphabeticShortcut="e"
+ android:alphabeticShortcut="t"
android:icon="@android:drawable/ic_menu_week"
android:showAsAction="withText|ifRoom"
android:title="@string/toggle_timestamps"/>
diff --git a/res/menu/vpn_context.xml b/res/menu/vpn_context.xml
deleted file mode 100644
index 239f1577..00000000
--- a/res/menu/vpn_context.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/edit_vpn"
- android:alphabeticShortcut="e"
- android:icon="@android:drawable/ic_menu_edit"
- android:showAsAction="withText|ifRoom"
- android:title="@string/edit_vpn"/>
- <item
- android:id="@+id/remove_vpn"
- android:alphabeticShortcut="d"
- android:icon="@android:drawable/ic_menu_delete"
- android:showAsAction="withText|ifRoom"
- android:title="@string/remove_vpn"/>
-
- <!-- does not look good on phone portrait with 3 items :( -->
- <!-- <item
- android:id="@+id/connect_vpn"
- android:alphabeticShortcut="c"
- android:icon="@android:drawable/ic_media_play"
- android:showAsAction="ifRoom|withText"
- android:title="@string/connect"/>
- -->
-</menu> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6588a69b..ed8e3b1d 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -22,7 +22,7 @@
<string name="about">About</string>
<string name="about_summary">About OpenVPN for Android</string>
<string name="vpn_list_summary">List of all configured VPNs</string>
- <string name="vpn_list_title">VPN Profiles</string>
+ <string name="vpn_list_title">Profiles</string>
<string name="vpn_type">Type</string>
<string name="pkcs12pwquery">PKCS12 Password</string>
<string name="file_select">Select…</string>
@@ -167,7 +167,7 @@
<string name="file_icon">file icon</string>
<string name="tls_authentication">TLS Authentication</string>
<string name="generated_config">Generated Config</string>
- <string name="generalsettings">General Settings</string>
+ <string name="generalsettings">Settings</string>
<string name="owner_fix_summary">Tries to set the owner of /dev/tun to system. Some CM9 images need this to make the VPNService API work. Requires root.</string>
<string name="owner_fix">Fix ownership of /dev/tun</string>
<string name="generated_config_summary">Shows the generated OpenVPN Configuration File</string>
@@ -223,7 +223,6 @@
<string name="faq_routing">The Routing and interface configuration is not done via traditionell ifconfig/route command but by using the VPNService API. This results in a different routing configuration than on other OSes. The configuration only consists of the IP of the tunnel interface and the networks that should be routed over this interface. Especially no peer partner address or gateway address is needed. Special routes to reach the VPN Server (for example added when using redirect-gateway) are not needed either. The application will consequently ignore these settings when importing a configuration. The app ensures with the VPNService API that the connection to the server is not routed through the VPN tunnel. Since only specifing networks to be routed via tunnel is supported extra routes not pointing to the tunnel cannot be supported either. (e.g. route x.x.x.x y.y.y.y net_gateway). The show information button in the log windows show the current configuration of the VPNService network configuration.</string>
<string name="persisttun_summary">Do not fallback to no VPN connection when OpenVPN is reconnecting.</string>
<string name="persistent_tun_title">Persistent tun</string>
- <string name="translation">Translation</string>
<string name="openvpn_log">OpenVPN Log</string>
<string name="import_config">Import OpenVPN configuration</string>
<string name="battery_consumption_title">Battery consumption</string>
@@ -236,7 +235,7 @@
<string name="connectretrywait">Seconds between connections</string>
<string name="minidump_generated">OpenVPN crashed unexpectedly. Please consider using the send Minidump option in the main menu</string>
<string name="send_minidump">Send Minidump to developer</string>
- <string name="send_minidump_summary">Send debugging information about last crash to developer</string>
+ <string name="send_minidump_summary">Sends debugging information about last crash to developer</string>
<string name="notifcation_title">OpenVPN - %s</string>
<string name="session_ipv4string">%1$s - %2$s</string>
<string name="session_ipv6string">%1$s - %3$s, %2$s</string>
@@ -259,7 +258,6 @@
<string name="notifcation_title_notconnect">Not connected</string>
<string name="start_vpn_title">Connecting to VPN %s</string>
<string name="start_vpn_ticker">Connecting to VPN %s</string>
-
<string name="jelly_keystore_alphanumeric_bug">Some versions of Android 4.1 have problems if the name of the keystore certificate contains non alphanumeric characters (like spaces, underscores or dashes). Try to reimport the certificate without special characters</string>
<string name="encryption_cipher">Encryption cipher</string>
<string name="packet_auth">Packets authentication</string>
@@ -269,5 +267,9 @@
<string name="built_by">built by %s</string>
<string name="debug_build">debug build</string>
<string name="official_build">official build</string>
-
-</resources>
+ <string name="make_selection_inline">Copy into profile</string>
+ <string name="crashdump">Crashdump</string>
+ <string name="add">Add</string>
+ <string name="send_config">Send config file</string>
+
+</resources> \ No newline at end of file
diff --git a/res/xml/main_headers.xml b/res/xml/main_headers.xml
deleted file mode 100644
index 92740382..00000000
--- a/res/xml/main_headers.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <header
- android:fragment="de.blinkt.openvpn.VPNProfileList"
- android:summary="@string/vpn_list_summary"
- android:title="@string/vpn_list_title" />
- <header
- android:fragment="de.blinkt.openvpn.GeneralSettings"
- android:title="@string/generalsettings" />
- <header
- android:fragment="de.blinkt.openvpn.FaqFragment"
- android:summary="@string/faq_summary"
- android:title="@string/faq" />
- <header
- android:fragment="de.blinkt.openvpn.AboutFragment"
- android:summary="@string/about_summary"
- android:title="@string/about" />
-
-</preference-headers> \ No newline at end of file
diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java
index e5713c3f..57649547 100644
--- a/src/de/blinkt/openvpn/ConfigParser.java
+++ b/src/de/blinkt/openvpn/ConfigParser.java
@@ -7,8 +7,6 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Vector;
-import android.text.TextUtils;
-
//! Openvpn Config FIle Parser, probably not 100% accurate but close enough
// And rember, this is valid :)
diff --git a/src/de/blinkt/openvpn/FileSelect.java b/src/de/blinkt/openvpn/FileSelect.java
index 18448706..e1a89b87 100644
--- a/src/de/blinkt/openvpn/FileSelect.java
+++ b/src/de/blinkt/openvpn/FileSelect.java
@@ -130,8 +130,11 @@ public class FileSelect extends Activity {
data += new String(filedata);
mData =data;
+
+ /*
mInlineFragment.setData(data);
- getActionBar().selectTab(inlineFileTab);
+ getActionBar().selectTab(inlineFileTab); */
+ saveInlineData(data);
} catch (FileNotFoundException e) {
fe = e;
} catch (IOException e) {
diff --git a/src/de/blinkt/openvpn/FileSelectLayout.java b/src/de/blinkt/openvpn/FileSelectLayout.java
index 93e438fc..b7e28b5c 100644
--- a/src/de/blinkt/openvpn/FileSelectLayout.java
+++ b/src/de/blinkt/openvpn/FileSelectLayout.java
@@ -38,6 +38,7 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
mSelectButton = (Button) findViewById(R.id.file_select_button);
mSelectButton.setOnClickListener(this);
+ ta.recycle();
}
public void setFragment(Fragment fragment, int i)
diff --git a/src/de/blinkt/openvpn/FileSelectionFragment.java b/src/de/blinkt/openvpn/FileSelectionFragment.java
index 5badc6e0..f750d91a 100644
--- a/src/de/blinkt/openvpn/FileSelectionFragment.java
+++ b/src/de/blinkt/openvpn/FileSelectionFragment.java
@@ -15,6 +15,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
@@ -30,8 +31,8 @@ public class FileSelectionFragment extends ListFragment {
private static final String ITEM_KEY = "key";
private static final String ITEM_IMAGE = "image";
private static final String ROOT = "/";
-
-
+
+
private List<String> path = null;
private TextView myPath;
private ArrayList<HashMap<String, Object>> mList;
@@ -48,18 +49,28 @@ public class FileSelectionFragment extends ListFragment {
private File selectedFile;
private HashMap<String, Integer> lastPositions = new HashMap<String, Integer>();
private String mStartPath;
- private Button mImportFile;
+ private CheckBox mInlineImport;
private Button mClearButton;
private boolean mHideImport=false;
-
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.file_dialog_main, container,false);
-
+
myPath = (TextView) v.findViewById(R.id.path);
+ mInlineImport = (CheckBox) v.findViewById(R.id.doinline);
+ mInlineImport.setEnabled(false);
+
+ if(mHideImport== true) {
+ mInlineImport.setVisibility(View.GONE);
+ mInlineImport.setChecked(false);
+ }
+
+
+
selectButton = (Button) v.findViewById(R.id.fdButtonSelect);
selectButton.setEnabled(false);
selectButton.setOnClickListener(new OnClickListener() {
@@ -67,15 +78,18 @@ public class FileSelectionFragment extends ListFragment {
@Override
public void onClick(View v) {
if (selectedFile != null) {
- ((FileSelect) getActivity()).setFile(selectedFile.getPath());
-
+ if(mInlineImport.isChecked())
+
+ ((FileSelect) getActivity()).importFile(selectedFile.getPath());
+ else
+ ((FileSelect) getActivity()).setFile(selectedFile.getPath());
}
}
});
mClearButton = (Button) v.findViewById(R.id.fdClear);
mClearButton.setOnClickListener(new OnClickListener() {
-
+
@Override
public void onClick(View v) {
((FileSelect) getActivity()).clearData();
@@ -85,35 +99,21 @@ public class FileSelectionFragment extends ListFragment {
mClearButton.setVisibility(View.GONE);
mClearButton.setEnabled(false);
}
-
-
- mImportFile = (Button) v.findViewById(R.id.importfile);
- mImportFile.setEnabled(false);
- mImportFile.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- ((FileSelect) getActivity()).importFile(selectedFile.getPath());
- }
- });
- if(mHideImport== true) {
- mImportFile.setVisibility(View.GONE);
- }
-
+
return v;
}
-
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
-
+
mStartPath = ((FileSelect) getActivity()).getSelectPath();
getDir(mStartPath);
}
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -154,7 +154,7 @@ public class FileSelectionFragment extends ListFragment {
f = new File(currentPath);
files = f.listFiles();
}
-
+
myPath.setText(getText(R.string.location) + ": " + currentPath);
if (!currentPath.equals(ROOT)) {
@@ -209,7 +209,7 @@ public class FileSelectionFragment extends ListFragment {
path.addAll(filesPathMap.tailMap("").values());
SimpleAdapter fileList = new SimpleAdapter(getActivity(), mList, R.layout.file_dialog_row, new String[] {
- ITEM_KEY, ITEM_IMAGE }, new int[] { R.id.fdrowtext, R.id.fdrowimage });
+ ITEM_KEY, ITEM_IMAGE }, new int[] { R.id.fdrowtext, R.id.fdrowimage });
for (String dir : dirsMap.tailMap("").values()) {
addItem(dir, R.drawable.folder);
@@ -240,26 +240,25 @@ public class FileSelectionFragment extends ListFragment {
if (file.isDirectory()) {
selectButton.setEnabled(false);
- mImportFile.setEnabled(false);
-
+
if (file.canRead()) {
lastPositions.put(currentPath, position);
getDir(path.get(position));
} else {
new AlertDialog.Builder(getActivity()).setIcon(R.drawable.icon)
- .setTitle("[" + file.getName() + "] " + getText(R.string.cant_read_folder))
- .setPositiveButton("OK", null).show();
+ .setTitle("[" + file.getName() + "] " + getText(R.string.cant_read_folder))
+ .setPositiveButton("OK", null).show();
}
} else {
selectedFile = file;
v.setSelected(true);
selectButton.setEnabled(true);
- mImportFile.setEnabled(true);
}
}
public void setNoInLine() {
mHideImport=true;
+
}
}
diff --git a/src/de/blinkt/openvpn/FragmentGeneralSettings.java b/src/de/blinkt/openvpn/FragmentGeneralSettings.java
new file mode 100644
index 00000000..800fb82a
--- /dev/null
+++ b/src/de/blinkt/openvpn/FragmentGeneralSettings.java
@@ -0,0 +1,12 @@
+package de.blinkt.openvpn;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+public class FragmentGeneralSettings extends PreferenceFragment {
+@Override
+public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ addPreferencesFromResource(R.xml.general_settings);
+}
+}
diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java
index 57506c4f..c5ae21c8 100644
--- a/src/de/blinkt/openvpn/MainActivity.java
+++ b/src/de/blinkt/openvpn/MainActivity.java
@@ -1,42 +1,94 @@
package de.blinkt.openvpn;
-import java.util.List;
-
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
import android.content.Intent;
-import android.preference.PreferenceActivity;
-public class MainActivity extends PreferenceActivity {
- @Override
- public void onBuildHeaders(List<Header> target) {
- loadHeadersFromResource(R.xml.main_headers, target);
-
+public class MainActivity extends Activity {
+
+ protected void onCreate(android.os.Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ ActionBar bar = getActionBar();
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+
+ Tab vpnListTab = bar.newTab().setText(R.string.vpn_list_title);
+ Tab generalTab = bar.newTab().setText(R.string.generalsettings);
+ Tab faqtab = bar.newTab().setText(R.string.faq);
+ Tab abouttab = bar.newTab().setText(R.string.about);
+
+ vpnListTab.setTabListener(new TabListener<VPNProfileList>("profiles", VPNProfileList.class));
+ generalTab.setTabListener(new TabListener<FragmentGeneralSettings>("settings", FragmentGeneralSettings.class));
+ faqtab.setTabListener(new TabListener<FaqFragment>("faq", FaqFragment.class));
+ abouttab.setTabListener(new TabListener<AboutFragment>("about", AboutFragment.class));
- String translatedby = getString(R.string.translationby);
- if(!translatedby.equals("") && !translatedby.contains("Arne Schwabe")) {
- Header translation = new Header();
- translation.title = getString(R.string.translation);
- translation.summary = translatedby;
- target.add(translation);
+ bar.addTab(vpnListTab);
+ bar.addTab(generalTab);
+ bar.addTab(faqtab);
+ bar.addTab(abouttab);
+
+ if(SendDumpFragment.getLastestDump(this)!=null) {
+ Tab sendDump = bar.newTab().setText(R.string.crashdump);
+ sendDump.setTabListener(new TabListener<SendDumpFragment>("crashdump",SendDumpFragment.class));
+ bar.addTab(sendDump);
}
- if(SendDumpActivity.getLastestDump(this)!=null) {
- Header sendDump = new Header();
- sendDump.titleRes = R.string.send_minidump;
- sendDump.summaryRes = R.string.send_minidump_summary;
- sendDump.intent = new Intent(this,SendDumpActivity.class);
- target.add(sendDump);
+ };
+
+ protected class TabListener<T extends Fragment> implements ActionBar.TabListener
+ {
+ private Fragment mFragment;
+ private String mTag;
+ private Class<T> mClass;
+
+
+ public TabListener(String tag, Class<T> clz) {
+ mTag = tag;
+ mClass = clz;
+
+ // Check to see if we already have a fragment for this tab, probably
+ // from a previously saved state. If so, deactivate it, because our
+ // initial state is that a tab isn't shown.
+ mFragment = getFragmentManager().findFragmentByTag(mTag);
+ if (mFragment != null && !mFragment.isDetached()) {
+ FragmentTransaction ft = getFragmentManager().beginTransaction();
+ ft.detach(mFragment);
+ ft.commit();
+ }
+ }
+
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ if (mFragment == null) {
+ mFragment = Fragment.instantiate(MainActivity.this, mClass.getName());
+ ft.add(android.R.id.content, mFragment, mTag);
+ } else {
+ ft.attach(mFragment);
+ }
+ }
+
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ if (mFragment != null) {
+ ft.detach(mFragment);
+ }
+ }
+
+
+ @Override
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+
}
-
}
-
+
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
-
+
System.out.println(data);
-
-
+
+
}
diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java
index 4d5ae269..da25b8a5 100644
--- a/src/de/blinkt/openvpn/OpenVPN.java
+++ b/src/de/blinkt/openvpn/OpenVPN.java
@@ -11,6 +11,7 @@ import java.util.LinkedList;
import java.util.Locale;
import java.util.Vector;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -165,7 +166,9 @@ public class OpenVPN {
}
}
}
-
+
+ // The lint is wrong here
+ @SuppressLint("StringFormatMatches")
private String getMobileInfoString(Context c) {
c.getPackageManager();
String apksign="error getting package signature";
diff --git a/src/de/blinkt/openvpn/SendDumpActivity.java b/src/de/blinkt/openvpn/SendDumpFragment.java
index 74d1a2f8..0ff7f48f 100644
--- a/src/de/blinkt/openvpn/SendDumpActivity.java
+++ b/src/de/blinkt/openvpn/SendDumpFragment.java
@@ -3,20 +3,34 @@ package de.blinkt.openvpn;
import java.io.File;
import java.util.ArrayList;
-import android.app.Activity;
+import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
-public class SendDumpActivity extends Activity {
+public class SendDumpFragment extends Fragment implements OnClickListener {
- protected void onStart() {
- super.onStart();
- emailMiniDumps();
- finish();
- };
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ View v = inflater.inflate(R.layout.fragment_senddump, container, false);
+ v.findViewById(R.id.senddump).setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ emailMiniDumps();
+ }
+ });
+ return v;
+ }
public void emailMiniDumps()
{
@@ -29,7 +43,7 @@ public class SendDumpActivity extends Activity {
String version;
String name="ics-openvpn";
try {
- PackageInfo packageinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
+ PackageInfo packageinfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
version = packageinfo.versionName;
name = packageinfo.applicationInfo.name;
} catch (NameNotFoundException e) {
@@ -43,7 +57,7 @@ public class SendDumpActivity extends Activity {
ArrayList<Uri> uris = new ArrayList<Uri>();
- File ldump = getLastestDump(this);
+ File ldump = getLastestDump(getActivity());
if(ldump==null) {
OpenVPN.logError("No Minidump found!");
}
@@ -69,6 +83,18 @@ public class SendDumpActivity extends Activity {
newestDumpFile=f;
}
}
+ // Ignore old dumps
+ //if(System.currentTimeMillis() - 48 * 60 * 1000 > newestDumpTime )
+ //return null;
+
return newestDumpFile;
}
+
+
+
+ @Override
+ public void onClick(View v) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/de/blinkt/openvpn/VPNProfileList.java b/src/de/blinkt/openvpn/VPNProfileList.java
index 1e24bfe7..6c10e736 100644
--- a/src/de/blinkt/openvpn/VPNProfileList.java
+++ b/src/de/blinkt/openvpn/VPNProfileList.java
@@ -92,8 +92,6 @@ public class VPNProfileList extends ListFragment {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
- // Debug load JNI
- //OpenVPN.foo();
}
@@ -172,15 +170,14 @@ public class VPNProfileList extends ListFragment {
menu.add(0, MENU_ADD_PROFILE, 0, R.string.menu_add_profile)
.setIcon(android.R.drawable.ic_menu_add)
.setAlphabeticShortcut('a')
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
- | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+ .setTitleCondensed(getActivity().getString(R.string.add))
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add(0, MENU_IMPORT_PROFILE, 0, R.string.menu_import)
.setIcon(R.drawable.ic_menu_archive)
.setAlphabeticShortcut('i')
.setTitleCondensed(getActivity().getString(R.string.menu_import_short))
- .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
- | MenuItem.SHOW_AS_ACTION_WITH_TEXT );
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT );
}