Search in sources :

Example 31 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project android_packages_apps_Settings by omnirom.

the class NewDeviceIntroSuggestionActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getLaunchIntent(this);
    if (intent != null) {
        final SuggestionFeatureProvider featureProvider = FeatureFactory.getFactory(this).getSuggestionFeatureProvider(this);
        final SharedPreferences prefs = featureProvider.getSharedPrefs(this);
        prefs.edit().putBoolean(PREF_KEY_SUGGGESTION_COMPLETE, true).commit();
        startActivity(intent);
    }
    finish();
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)

Example 32 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project android_packages_apps_Settings by DirtyUnicorns.

the class NewDeviceIntroSuggestionActivity method hasLaunchedBefore.

private static boolean hasLaunchedBefore(Context context) {
    final SuggestionFeatureProvider featureProvider = FeatureFactory.getFactory(context).getSuggestionFeatureProvider(context);
    final SharedPreferences prefs = featureProvider.getSharedPrefs(context);
    return prefs.getBoolean(PREF_KEY_SUGGGESTION_COMPLETE, false);
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)

Example 33 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project android_packages_apps_Settings by DirtyUnicorns.

the class NewDeviceIntroSuggestionActivity method isExpired.

private static boolean isExpired(Context context) {
    final SuggestionFeatureProvider featureProvider = FeatureFactory.getFactory(context).getSuggestionFeatureProvider(context);
    final SharedPreferences prefs = featureProvider.getSharedPrefs(context);
    final long currentTimeMs = System.currentTimeMillis();
    final long firstDisplayTimeMs;
    if (!prefs.contains(PREF_KEY_SUGGGESTION_FIRST_DISPLAY_TIME)) {
        firstDisplayTimeMs = currentTimeMs;
        prefs.edit().putLong(PREF_KEY_SUGGGESTION_FIRST_DISPLAY_TIME, currentTimeMs).commit();
    } else {
        firstDisplayTimeMs = prefs.getLong(PREF_KEY_SUGGGESTION_FIRST_DISPLAY_TIME, -1);
    }
    final long dismissTimeMs = firstDisplayTimeMs + PERMANENT_DISMISS_THRESHOLD;
    final boolean expired = currentTimeMs > dismissTimeMs;
    Log.d(TAG, "is suggestion expired: " + expired);
    return expired;
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)

Example 34 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project android_packages_apps_Settings by DirtyUnicorns.

the class NewDeviceIntroSuggestionActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getLaunchIntent(this);
    if (intent != null) {
        final SuggestionFeatureProvider featureProvider = FeatureFactory.getFactory(this).getSuggestionFeatureProvider(this);
        final SharedPreferences prefs = featureProvider.getSharedPrefs(this);
        prefs.edit().putBoolean(PREF_KEY_SUGGGESTION_COMPLETE, true).commit();
        startActivity(intent);
    }
    finish();
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)

Example 35 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project android_packages_apps_Settings by DirtyUnicorns.

the class DoubleTapPowerSettings method onAttach.

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    SuggestionFeatureProvider suggestionFeatureProvider = FeatureFactory.getFactory(context).getSuggestionFeatureProvider(context);
    SharedPreferences prefs = suggestionFeatureProvider.getSharedPrefs(context);
    prefs.edit().putBoolean(PREF_KEY_SUGGESTION_COMPLETE, true).apply();
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)

Aggregations

SharedPreferences (android.content.SharedPreferences)59 SuggestionFeatureProvider (com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)59 Intent (android.content.Intent)6 AmbientDisplayConfiguration (android.hardware.display.AmbientDisplayConfiguration)6 VideoPreference (com.android.settings.widget.VideoPreference)1 IllustrationPreference (com.android.settingslib.widget.IllustrationPreference)1