diff options
Diffstat (limited to 'app/src')
9 files changed, 66 insertions, 44 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java index 12e88af8..1a47bf24 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java @@ -7,7 +7,7 @@ import com.robotium.solo.Solo; import java.io.IOException; -import se.leap.bitmaskclient.AboutActivity; +import se.leap.bitmaskclient.fragments.AboutFragment; import se.leap.bitmaskclient.ConfigurationWizard; import se.leap.bitmaskclient.R; @@ -119,7 +119,7 @@ public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<Co private void showAbout() { String text = solo.getString(R.string.about); solo.clickOnMenuItem(text); - assertTrue("Provider details dialog did not appear", solo.waitForActivity(AboutActivity.class)); + assertTrue("Provider details dialog did not appear", solo.waitForActivity(AboutFragment.class)); } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cb4ceedd..43c31a88 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -94,8 +94,8 @@ android:label="@string/configuration_wizard_title" android:uiOptions="splitActionBarWhenNarrow"></activity> <activity - android:name=".AboutActivity" - android:label="@string/title_about_activity"></activity> + android:name=".fragments.AboutFragment" + android:label="@string/about_fragment_title"></activity> <service android:name=".eip.EIP" diff --git a/app/src/main/java/se/leap/bitmaskclient/AboutActivity.java b/app/src/main/java/se/leap/bitmaskclient/AboutActivity.java deleted file mode 100644 index 4ebae32d..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/AboutActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package se.leap.bitmaskclient; - -import android.app.*; -import android.content.pm.*; -import android.content.pm.PackageManager.*; -import android.os.*; -import android.widget.*; - -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 = "Bitmask"; - try { - PackageInfo packageinfo = getPackageManager().getPackageInfo(getPackageName(), 0); - version = packageinfo.versionName; - name = getString(R.string.app_name); - } catch (NameNotFoundException e) { - version = "error fetching version"; - } - - - ver.setText(getString(R.string.version_info, name, version)); - setResult(VIEWED); - } - -} diff --git a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java index 75a653c0..9f12ed9a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java +++ b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java @@ -51,6 +51,7 @@ import javax.inject.Inject; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnItemClick; +import se.leap.bitmaskclient.fragments.AboutFragment; import se.leap.bitmaskclient.userstatus.SessionDialog; import static android.view.View.GONE; @@ -246,7 +247,7 @@ public abstract class BaseConfigurationWizard extends AppCompatActivity mConfigState.setAction(PROVIDER_NOT_SET); hideProgressBar(); setResult(RESULT_CANCELED, mConfigState); - } else if (resultCode == AboutActivity.VIEWED) { + } else if (resultCode == AboutFragment.VIEWED) { // Do nothing, right now // I need this for CW to wait for the About activity to end before going back to Dashboard. } @@ -417,7 +418,7 @@ public abstract class BaseConfigurationWizard extends AppCompatActivity public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.about_leap: - startActivityForResult(new Intent(this, AboutActivity.class), 0); + startActivityForResult(new Intent(this, AboutFragment.class), 0); return true; case R.id.new_provider: addAndSelectNewProvider(); diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index 0d3af13f..8c33a6cd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -40,6 +40,7 @@ import java.net.URL; import butterknife.ButterKnife; import butterknife.InjectView; +import se.leap.bitmaskclient.fragments.AboutFragment; import se.leap.bitmaskclient.userstatus.SessionDialog; import se.leap.bitmaskclient.userstatus.User; import se.leap.bitmaskclient.userstatus.UserStatusFragment; @@ -365,7 +366,7 @@ public class Dashboard extends AppCompatActivity { } public void showAbout() { - Intent intent = new Intent(this, AboutActivity.class); + Intent intent = new Intent(this, AboutFragment.class); startActivity(intent); } diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 60c38fbc..e7217ad1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -32,6 +32,7 @@ import se.leap.bitmaskclient.Constants; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.VpnFragment; +import se.leap.bitmaskclient.fragments.AboutFragment; import se.leap.bitmaskclient.fragments.LogFragment; import se.leap.bitmaskclient.userstatus.User; import se.leap.bitmaskclient.userstatus.UserStatusFragment; @@ -142,6 +143,7 @@ public class NavigationDrawerFragment extends Fragment { getString(R.string.vpn_fragment_title), getString(R.string.switch_provider_menu_option), getString(R.string.log_fragment_title), + getString(R.string.about_fragment_title), })); mDrawerSettingsListView.setItemChecked(mCurrentSelectedPosition, true); @@ -321,6 +323,10 @@ public class NavigationDrawerFragment extends Fragment { mTitle = getString(R.string.log_fragment_title); fragment = new LogFragment(); break; + case 3: + mTitle = getString(R.string.about_fragment_title); + fragment = new AboutFragment(); + break; default: mTitle = getString(R.string.vpn_fragment_title); fragment = new VpnFragment(); diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java new file mode 100644 index 00000000..113ce397 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java @@ -0,0 +1,49 @@ +package se.leap.bitmaskclient.fragments; + +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import butterknife.ButterKnife; +import butterknife.InjectView; +import se.leap.bitmaskclient.R; + +public class AboutFragment extends Fragment { + + final public static String TAG = "aboutFragment"; + final public static int VIEWED = 0; + + @InjectView(R.id.version) + TextView versionTextView; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.about, container, false); + ButterKnife.inject(this, view); + return view; + } + + @Override + public void onStart() { + super.onStart(); + String version; + String name = "Bitmask"; + try { + PackageInfo packageinfo = getActivity().getPackageManager().getPackageInfo( + getActivity().getPackageName(), 0); + version = packageinfo.versionName; + name = getString(R.string.app_name); + } catch (NameNotFoundException e) { + version = "error fetching version"; + } + + versionTextView.setText(getString(R.string.version_info, name, version)); + } + +} diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 192fb5a7..11fe31a1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -31,7 +31,7 @@ <string name="username_ask">Por favor, introduce tu usuario</string> <string name="password_hint">contraseña</string> <string name="user_message">Mensaje al usuario</string> - <string name="title_about_activity">Acerca de Bitmask"</string> + <string name="about_fragment_title">Acerca de Bitmask"</string> <string name="error_srp_math_error_user_message">Inténtalo de nuevo: error en el servidor.</string> <string name="error_bad_user_password_user_message">Usuario o contraseña incorrectos.</string> <string name="error_not_valid_password_user_message">Al menos 8 caracteres.</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c854948c..38e47f1d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -29,7 +29,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="about_fragment_title">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> |