Skip to content

Commit

Permalink
Init defEnable if first called outside AppList.
Browse files Browse the repository at this point in the history
Use main SharedPreferences to store defEnable.

Update version in manifest.
  • Loading branch information
pilot51 committed Mar 26, 2012
1 parent aa1c1f8 commit 4c9ff69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pilot51.voicenotify"
android:versionCode="7"
android:versionName="1.0.6"
android:versionCode="8"
android:versionName="1.0.7"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="4"
Expand Down
12 changes: 6 additions & 6 deletions src/com/pilot51/voicenotify/AppList.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;

import android.app.ListActivity;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
Expand All @@ -25,16 +24,14 @@ public class AppList extends ListActivity {
private AppListAdapter adapter;
private static ArrayList<App> apps;
private List<ApplicationInfo> installedApps;
private SharedPreferences prefs;
private static boolean defEnable;
private static final int IGNORE_TOGGLE = 0, IGNORE_ALL = 1, IGNORE_NONE = 2;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
prefs = getSharedPreferences("defValues", MODE_WORLD_READABLE);
defEnable = prefs.getBoolean("enable", true);
defEnable = Common.prefs.getBoolean("defEnable", true);
new Thread(new Runnable() {
public void run() {
apps = Database.getApps();
Expand Down Expand Up @@ -158,11 +155,14 @@ private void setIgnore(int position, int ignoreType) {
/** Set the default enabled value for new apps. */
private void setDefaultEnable(boolean enable) {
defEnable = enable;
prefs.edit().putBoolean("enable", defEnable).commit();
Common.prefs.edit().putBoolean("defEnable", defEnable).commit();
}

protected static boolean getIsEnabled(String pkg) {
if (apps == null) apps = Database.getApps();
if (apps == null) {
defEnable = Common.prefs.getBoolean("defEnable", true);
apps = Database.getApps();
}
App app;
for (int n = 0; n < apps.size(); n++) {
app = apps.get(n);
Expand Down

0 comments on commit 4c9ff69

Please sign in to comment.