summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-04-15 01:32:22 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-04-15 01:32:22 -0700
commitec8357a04b35c258d6973667f92235f3ed2d79d4 (patch)
treec7bd150244aaea587d94ecd020c77390bf7fdce9 /src
parentb2c78138c403f98824369f9f680d67c7fb359fe4 (diff)
parent90f2ec1cad434ff6ab6b8e92c18ff5efbf9be6d8 (diff)
downloadpackages_apps_settings-ec8357a04b35c258d6973667f92235f3ed2d79d4.zip
packages_apps_settings-ec8357a04b35c258d6973667f92235f3ed2d79d4.tar.gz
packages_apps_settings-ec8357a04b35c258d6973667f92235f3ed2d79d4.tar.bz2
Merge "Fix: Don't display the lock clock preference if its not installed" into cm-10.1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/DeviceInfoSettings.java19
-rw-r--r--src/com/android/settings/SettingsPreferenceFragment.java22
-rw-r--r--src/com/android/settings/cyanogenmod/LockscreenInterface.java4
-rw-r--r--src/com/android/settings/cyanogenmod/SystemSettings.java22
4 files changed, 26 insertions, 41 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index c3683f0..3f8aca3 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -19,7 +19,6 @@ package com.android.settings;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Bundle;
import android.os.SELinux;
@@ -414,22 +413,4 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment {
return result;
}
-
- private boolean removePreferenceIfPackageNotInstalled(Preference preference) {
- String intentUri=((PreferenceScreen) preference).getIntent().toUri(1);
- Pattern pattern = Pattern.compile("component=([^/]+)/");
- Matcher matcher = pattern.matcher(intentUri);
-
- String packageName=matcher.find()?matcher.group(1):null;
- if(packageName != null) {
- try {
- getPackageManager().getPackageInfo(packageName, 0);
- } catch (NameNotFoundException e) {
- Log.e(LOG_TAG,"package "+packageName+" not installed, hiding preference.");
- getPreferenceScreen().removePreference(preference);
- return true;
- }
- }
- return false;
- }
}
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index b418826..b961bbc 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -23,11 +23,13 @@ import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceFragment;
+import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
@@ -35,6 +37,9 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Button;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Base class for Settings fragments, with some helper functions and dialog management.
*/
@@ -307,4 +312,21 @@ public class SettingsPreferenceFragment extends PreferenceFragment implements Di
}
}
+ public boolean removePreferenceIfPackageNotInstalled(Preference preference) {
+ String intentUri = ((PreferenceScreen) preference).getIntent().toUri(1);
+ Pattern pattern = Pattern.compile("component=([^/]+)/");
+ Matcher matcher = pattern.matcher(intentUri);
+
+ String packageName = matcher.find() ? matcher.group(1) : null;
+ if (packageName != null) {
+ try {
+ getPackageManager().getPackageInfo(packageName, 0);
+ } catch (NameNotFoundException e) {
+ Log.e(TAG, "package " + packageName + " not installed, hiding preference.");
+ getPreferenceScreen().removePreference(preference);
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/com/android/settings/cyanogenmod/LockscreenInterface.java b/src/com/android/settings/cyanogenmod/LockscreenInterface.java
index fc70dbf..740182e 100644
--- a/src/com/android/settings/cyanogenmod/LockscreenInterface.java
+++ b/src/com/android/settings/cyanogenmod/LockscreenInterface.java
@@ -58,6 +58,7 @@ public class LockscreenInterface extends SettingsPreferenceFragment implements
private static final String KEY_ALWAYS_BATTERY = "lockscreen_battery_status";
private static final String KEY_LOCKSCREEN_BUTTONS = "lockscreen_buttons";
+ private static final String KEY_LOCK_CLOCK = "lock_clock";
private static final String KEY_LOCKSCREEN_MAXIMIZE_WIDGETS = "lockscreen_maximize_widgets";
private static final String KEY_BACKGROUND = "lockscreen_background";
private static final String KEY_SCREEN_SECURITY = "screen_security";
@@ -118,6 +119,9 @@ public class LockscreenInterface extends SettingsPreferenceFragment implements
mWallpaperImage = new File(getActivity().getFilesDir() + "/lockwallpaper");
mWallpaperTemporary = new File(getActivity().getCacheDir() + "/lockwallpaper.tmp");
+
+ // Don't display the lock clock preference if its not installed
+ removePreferenceIfPackageNotInstalled(findPreference(KEY_LOCK_CLOCK));
}
private void updateCustomBackgroundSummary() {
diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java
index cbf88f1..0b0d29c 100644
--- a/src/com/android/settings/cyanogenmod/SystemSettings.java
+++ b/src/com/android/settings/cyanogenmod/SystemSettings.java
@@ -18,7 +18,6 @@ package com.android.settings.cyanogenmod;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.RemoteException;
@@ -36,9 +35,6 @@ import android.view.WindowManagerGlobal;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
public class SystemSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = "SystemSettings";
@@ -235,24 +231,6 @@ public class SystemSettings extends SettingsPreferenceFragment implements
}
}
- private boolean removePreferenceIfPackageNotInstalled(Preference preference) {
- String intentUri = ((PreferenceScreen) preference).getIntent().toUri(1);
- Pattern pattern = Pattern.compile("component=([^/]+)/");
- Matcher matcher = pattern.matcher(intentUri);
-
- String packageName = matcher.find() ? matcher.group(1) : null;
- if (packageName != null) {
- try {
- getPackageManager().getPackageInfo(packageName, 0);
- } catch (NameNotFoundException e) {
- Log.e(TAG, "package " + packageName + " not installed, hiding preference.");
- getPreferenceScreen().removePreference(preference);
- return true;
- }
- }
- return false;
- }
-
private void updateExpandedDesktop(int value) {
ContentResolver cr = getContentResolver();
Resources res = getResources();