aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorzeapo <mohamed@zenadi.com>2014-10-19 13:24:38 +0200
committerzeapo <mohamed@zenadi.com>2014-10-19 13:24:38 +0200
commit83c3231ab02fcfa40d369248c257a80579988a4b (patch)
treee64e5cef2b8e748b9b8704571bab4c46fd4980e5 /app
parentb8b5234e5bbef024ca25c63a8882a4d677778e6c (diff)
UserPreference works now
Diffstat (limited to 'app')
-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) {