summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
index 26b3c3fa..fa4ee9c9 100644
--- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
+++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java
@@ -1,12 +1,15 @@
package com.zeapo.pwdstore;
+import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
+import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -22,18 +25,28 @@ import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URI;
-public class UserPreference extends PreferenceActivity implements Preference.OnPreferenceClickListener {
+public class UserPreference extends ActionBarActivity implements Preference.OnPreferenceClickListener {
+
+ public static class PrefsFragment extends PreferenceFragment {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.preference);
+ findPreference("openpgp_key_id").setOnPreferenceClickListener((UserPreference) getActivity());
+ findPreference("ssh_key").setOnPreferenceClickListener((UserPreference) getActivity());
+ }
+ }
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.preference);
- findPreference("openpgp_key_id").setOnPreferenceClickListener(this);
- findPreference("ssh_key").setOnPreferenceClickListener(this);
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
+ getFragmentManager().beginTransaction()
+ .replace(android.R.id.content, new PrefsFragment()).commit();
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ }
@Override
public boolean onOptionsItemSelected(MenuItem item) {