Search in sources :

Example 46 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project platform_packages_apps_Settings by BlissRoms.

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 47 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SystemNavigationGestureSettings 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();
    mOverlayManager = IOverlayManager.Stub.asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE));
    mVideoPreference = new VideoPreference(context);
    setIllustrationVideo(mVideoPreference, getDefaultKey());
    mVideoPreference.setHeight(/* Illustration height in dp */
    getResources().getDimension(R.dimen.system_navigation_illustration_height) / getResources().getDisplayMetrics().density);
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider) VideoPreference(com.android.settings.widget.VideoPreference)

Example 48 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PickupGestureSettings 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();
    use(PickupGesturePreferenceController.class).setConfig(new AmbientDisplayConfiguration(context));
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider) AmbientDisplayConfiguration(android.hardware.display.AmbientDisplayConfiguration)

Example 49 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SwipeToNotificationSettings 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)

Example 50 with SuggestionFeatureProvider

use of com.android.settings.dashboard.suggestions.SuggestionFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class TapScreenGestureSettings 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();
    use(TapScreenGesturePreferenceController.class).setConfig(new AmbientDisplayConfiguration(context));
}
Also used : SharedPreferences(android.content.SharedPreferences) SuggestionFeatureProvider(com.android.settings.dashboard.suggestions.SuggestionFeatureProvider) AmbientDisplayConfiguration(android.hardware.display.AmbientDisplayConfiguration)

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