summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-01-08 16:11:23 +0100
committerFup Duck <fupduck@sacknagel.com>2018-01-08 16:11:23 +0100
commit245982bdb6fda879827ab3c89617b8dd591fb7f4 (patch)
treef43183209ca083d364d31935f160174e2a505eb2 /app/src/main/java
parentbd99fc61a2e8217c41b70c6f2ff0df87e7008ea0 (diff)
AboutActivity to AboutFragment
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/AboutActivity.java35
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java49
5 files changed, 60 insertions, 38 deletions
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));
+ }
+
+}