Remove irrelevant preferences from amazon and nook builds

pull/14/head
Sam Bosley 14 years ago
parent 1ec68b8fb3
commit 3fe9ed4604

@ -14,6 +14,7 @@ import android.text.TextUtils;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.TodorooPreferenceActivity;
import com.todoroo.astrid.activity.EditPreferences;
import com.todoroo.astrid.utility.Constants;
public class LabsPreferences extends TodorooPreferenceActivity {
@ -34,6 +35,13 @@ public class LabsPreferences extends TodorooPreferenceActivity {
}
};
@Override
public void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EditPreferences.removeForbiddenPreferences(getPreferenceScreen(), getResources());
}
@Override
public void updatePreferences(Preference preference, Object value) {
final Resources r = getResources();

@ -187,6 +187,8 @@
<string name="p_transparent_deprecated">transparent</string>
<string name="p_theme">theme</string>
<string name="p_theme_widget">theme_widget</string>
<string name="p_voicePrefSection">voicePrefSection</string>
<string name="p_voiceInputEnabled">voiceInputEnabled</string>
<string name="p_voiceInputCreatesTask">voiceInputCreatesTask</string>
<string name="p_voiceRemindersEnabled">voiceRemindersEnabled</string>

@ -80,6 +80,7 @@
android:title="@string/EPr_powerpack_header">
<PreferenceScreen
android:key="@string/p_voicePrefSection"
android:title="@string/EPr_voice_header">
<com.todoroo.astrid.ui.MultilineCheckboxPreference

@ -28,6 +28,7 @@ import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.widget.Toast;
@ -174,6 +175,37 @@ public class EditPreferences extends TodorooPreferenceActivity {
addDebugPreferences();
addPreferenceListeners();
removeForbiddenPreferences(screen, r);
}
public static void removeForbiddenPreferences(PreferenceScreen screen, Resources r) {
int[] forbiddenPrefs = Constants.MARKET_STRATEGY.excludedSettings();
if (forbiddenPrefs == null)
return;
for (int i : forbiddenPrefs) {
searchForAndRemovePreference(screen, r.getString(i));
}
}
private static boolean searchForAndRemovePreference(PreferenceGroup group, String key) {
int preferenceCount = group.getPreferenceCount();
for (int i = 0; i < preferenceCount; i++) {
final Preference preference = group.getPreference(i);
final String curKey = preference.getKey();
if (curKey != null && curKey.equals(key)) {
group.removePreference(preference);
return true;
}
if (preference instanceof PreferenceGroup) {
if (searchForAndRemovePreference((PreferenceGroup) preference, key)) {
return true;
}
}
}
return false;
}
/** Show about dialog */

@ -8,6 +8,8 @@ package com.todoroo.astrid.service;
import android.content.Intent;
import android.net.Uri;
import com.timsu.astrid.R;
public abstract class MarketStrategy {
/**
@ -37,6 +39,10 @@ public abstract class MarketStrategy {
return true;
}
public int[] excludedSettings() {
return null;
}
/**
* @return true if ideas tab should be shown
*/
@ -92,6 +98,17 @@ public abstract class MarketStrategy {
android.os.Build.MODEL.contains("Kindle"); //$NON-NLS-1$
}
@Override
public int[] excludedSettings() {
return new int[] {
R.string.p_theme_widget,
R.string.p_voicePrefSection,
R.string.p_end_at_deadline,
R.string.p_swipe_lists_performance_key,
R.string.p_field_missed_calls
};
}
}
public static class NookMarketStrategy extends MarketStrategy {
@ -118,6 +135,17 @@ public abstract class MarketStrategy {
return false;
}
@Override
public int[] excludedSettings() {
return new int[] {
R.string.p_theme_widget,
R.string.p_voicePrefSection,
R.string.p_end_at_deadline,
R.string.p_swipe_lists_performance_key,
R.string.p_field_missed_calls
};
}
}
}

Loading…
Cancel
Save