diff options
author | Parménides GV <parmegv@sdf.org> | 2013-12-12 18:11:19 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-12-12 18:11:19 +0100 |
commit | af5268b24a546f9a7a2693ec3ae339dd6ca7ea4f (patch) | |
tree | 0ec6bb8bef6fc8c9401be3e8de68e21b08b84a26 | |
parent | 623cd76d9e1b26d81406fb886dea18a93dee8431 (diff) |
About is now an Activity.
I've also removed some spaces from the text.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | AndroidManifest.xml | 4 | ||||
-rw-r--r-- | res/layout/about.xml | 19 | ||||
-rwxr-xr-x | res/values/strings.xml | 1 | ||||
-rw-r--r-- | res/values/untranslatable.xml | 2 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/AboutActivity.java | 48 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/AboutFragment.java | 57 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/ConfigurationWizard.java | 28 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/Dashboard.java | 7 |
9 files changed, 71 insertions, 96 deletions
@@ -70,3 +70,4 @@ id.zip build.gradle local.properties +*.java~ diff --git a/AndroidManifest.xml b/AndroidManifest.xml index bb788109..9c154c04 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -149,6 +149,10 @@ android:label="@string/title_activity_configuration_wizard" android:uiOptions="splitActionBarWhenNarrow" > </activity> + <activity + android:name="se.leap.bitmaskclient.AboutActivity" + android:label="@string/title_about_activity" > + </activity> <service android:name="se.leap.bitmaskclient.EIP" android:exported="false"> <intent-filter> diff --git a/res/layout/about.xml b/res/layout/about.xml index 40a15794..875bba64 100644 --- a/res/layout/about.xml +++ b/res/layout/about.xml @@ -1,7 +1,10 @@ -<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" > + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/dashboardLayout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".Dashboard" > <LinearLayout android:layout_width="match_parent" @@ -39,10 +42,6 @@ android:layout_height="wrap_content" android:autoLink="all" /> - <Space - android:layout_width="match_parent" - android:layout_height="10sp" /> - <TextView android:layout_width="match_parent" android:layout_height="wrap_content" @@ -74,10 +73,6 @@ android:layout_width="match_parent" android:layout_height="20sp" /> - <Space - android:layout_width="match_parent" - android:layout_height="20sp" /> - <TextView android:layout_width="match_parent" android:layout_height="wrap_content" @@ -105,4 +100,4 @@ android:text="@string/copyright_openssl" /> </LinearLayout> -</ScrollView>
\ No newline at end of file +</ScrollView> diff --git a/res/values/strings.xml b/res/values/strings.xml index 2598d452..c94997af 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -285,6 +285,7 @@ <string name="username_ask">Please enter your username</string> <string name="password_hint">password</string> <string name="user_message">User message</string> + <string name="title_about_activity">About Bitmask"</string> <string name="error_srp_math_error_user_message">Try again: server math error.</string> <string name="error_bad_user_password_user_message">Incorrect username or password.</string> <string name="error_not_valid_password_user_message">It should have at least 8 characters.</string> diff --git a/res/values/untranslatable.xml b/res/values/untranslatable.xml index fe620aa8..c86fad1b 100644 --- a/res/values/untranslatable.xml +++ b/res/values/untranslatable.xml @@ -4,7 +4,7 @@ <string name="copyright_leapgui" translatable="false">Copyright 2012\nLEAP Encryption Access Project <info@leap.se></string> <string name="opevpn_copyright" translatable="false">Copyright © 2002–2010 OpenVPN Technologies, Inc. <sales@openvpn.net>\n - "OpenVPN" is a trademark of OpenVPN Technologies, Inc.\n</string> + "OpenVPN" is a trademark of OpenVPN Technologies, Inc.</string> <string name="defaultserver" translatable="false">openvpn.uni-paderborn.de</string> <string name="defaultport" translatable="false">1194</string> <string name="lzo_copyright" translatable="false">Copyright © 1996 – 2011 Markus Franz Xaver Johannes Oberhumer</string> diff --git a/src/se/leap/bitmaskclient/AboutActivity.java b/src/se/leap/bitmaskclient/AboutActivity.java new file mode 100644 index 00000000..a3320c81 --- /dev/null +++ b/src/se/leap/bitmaskclient/AboutActivity.java @@ -0,0 +1,48 @@ +package se.leap.bitmaskclient; + +import android.app.Activity; +import android.app.Fragment; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import se.leap.bitmaskclient.R; + +public class AboutActivity extends Activity { + + final public static String TAG = "aboutFragment"; + final public static int VIEWED = 0; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.about); + TextView ver = (TextView) findViewById(R.id.version); + + String version; + String name="Openvpn"; + try { + PackageInfo packageinfo = getPackageManager().getPackageInfo(getPackageName(), 0); + version = packageinfo.versionName; + name = getString(R.string.app); + } catch (NameNotFoundException e) { + version = "error fetching version"; + } + + + ver.setText(getString(R.string.version_info,name,version)); + + TextView translation = (TextView) findViewById(R.id.translation); + + // Don't print a text for myself + if ( getString(R.string.translationby).contains("Arne Schwabe")) + translation.setVisibility(TextView.INVISIBLE); + else + translation.setText(R.string.translationby); + setResult(VIEWED); + } + +} diff --git a/src/se/leap/bitmaskclient/AboutFragment.java b/src/se/leap/bitmaskclient/AboutFragment.java deleted file mode 100644 index 4d03a44b..00000000 --- a/src/se/leap/bitmaskclient/AboutFragment.java +++ /dev/null @@ -1,57 +0,0 @@ -package se.leap.bitmaskclient; - -import android.app.Fragment; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import se.leap.bitmaskclient.R; - -public class AboutFragment extends Fragment { - - final public static String TAG = "aboutFragment"; - - public static Fragment newInstance() { - AboutFragment provider_detail_fragment = new AboutFragment(); - return provider_detail_fragment; - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View v= inflater.inflate(R.layout.about, container, false); - TextView ver = (TextView) v.findViewById(R.id.version); - - String version; - String name="Openvpn"; - try { - PackageInfo packageinfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); - version = packageinfo.versionName; - name = getString(R.string.app); - } catch (NameNotFoundException e) { - version = "error fetching version"; - } - - - ver.setText(getString(R.string.version_info,name,version)); - - TextView translation = (TextView) v.findViewById(R.id.translation); - - // Don't print a text for myself - if ( getString(R.string.translationby).contains("Arne Schwabe")) - translation.setText(""); - else - translation.setText(R.string.translationby); - return v; - } - -} diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java index a4d8599f..444be843 100644 --- a/src/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java @@ -176,7 +176,10 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn progressbar_description.setVisibility(TextView.GONE);
//Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_certificate_message, Toast.LENGTH_LONG).show();
setResult(RESULT_CANCELED, mConfigState);
- }
+ } else if(resultCode == AboutActivity.VIEWED) { + // Do nothing, right now + // I need this for CW to wait for the About activity to end before going back to Dashboard. + } }
/**
@@ -419,9 +422,9 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn @Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
- case R.id.about_leap:
- showAboutFragment(getCurrentFocus());
- return true;
+ case R.id.about_leap: + startActivityForResult(new Intent(this, AboutActivity.class), 0); + return true; case R.id.new_provider:
addAndSelectNewProvider();
return true;
@@ -429,23 +432,6 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn return super.onOptionsItemSelected(item);
}
}
-
- /**
- * Once selected a provider, this fragment offers the user to log in,
- * use it anonymously (if possible)
- * or cancel his/her election pressing the back button.
- * @param view
- */
- public void showAboutFragment(View view) {
- FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction();
- Fragment previous_about_fragment = getFragmentManager().findFragmentByTag(AboutFragment.TAG);
- if (previous_about_fragment == null) {
- fragment_transaction.addToBackStack(null);
-
- Fragment newFragment = AboutFragment.newInstance();
- fragment_transaction.replace(R.id.configuration_wizard_layout, newFragment, AboutFragment.TAG).commit();
- }
- }
public void showAllProviders() {
provider_list_fragment = (ProviderListFragment) getFragmentManager().findFragmentByTag(ProviderListFragment.TAG);
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java index 7f898a67..0ef50f4a 100644 --- a/src/se/leap/bitmaskclient/Dashboard.java +++ b/src/se/leap/bitmaskclient/Dashboard.java @@ -207,11 +207,8 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf Intent intent; switch (item.getItemId()){ case R.id.about_leap: - Fragment aboutFragment = new AboutFragment(); - FragmentTransaction trans = getFragmentManager().beginTransaction(); - trans.replace(R.id.dashboardLayout, aboutFragment); - trans.addToBackStack(null); - trans.commit(); + intent = new Intent(this, AboutActivity.class); + startActivity(intent); return true; case R.id.legacy_interface: intent = new Intent(this,MainActivity.class); |