use of com.android.settings.homepage.contextualcards.ContextualCardsFragment in project android_packages_apps_Settings by omnirom.
the class SettingsHomepageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_homepage_container);
final View appBar = findViewById(R.id.app_bar_container);
appBar.setMinimumHeight(getSearchBoxHeight());
initHomepageContainer();
final Toolbar toolbar = findViewById(R.id.search_action_bar);
FeatureFactory.getFactory(this).getSearchFeatureProvider().initSearchToolbar(this, /* activity */
toolbar, SettingsEnums.SETTINGS_HOMEPAGE);
getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
mCategoryMixin = new CategoryMixin(this);
getLifecycle().addObserver(mCategoryMixin);
if (!getSystemService(ActivityManager.class).isLowRamDevice()) {
// Only allow features on high ram devices.
final ImageView avatarView = findViewById(R.id.account_avatar);
if (AvatarViewMixin.isAvatarSupported(this)) {
avatarView.setVisibility(View.VISIBLE);
getLifecycle().addObserver(new AvatarViewMixin(this, avatarView));
}
showSuggestionFragment();
if (FeatureFlagUtils.isEnabled(this, FeatureFlags.CONTEXTUAL_HOME)) {
showFragment(new ContextualCardsFragment(), R.id.contextual_cards_content);
}
}
showFragment(new TopLevelSettings(), R.id.main_content);
((FrameLayout) findViewById(R.id.main_content)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
}
use of com.android.settings.homepage.contextualcards.ContextualCardsFragment in project android_packages_apps_Settings by omnirom.
the class SliceContextualCardControllerTest method onDismissed_feedbackDisabled_shouldNotShowFeedbackDialog.
@Test
public void onDismissed_feedbackDisabled_shouldNotShowFeedbackDialog() {
mResolver.insert(CardContentProvider.REFRESH_CARD_URI, generateOneRow());
final ContextualCardsFragment fragment = FragmentController.of(new ContextualCardsFragment()).create().get();
final ShadowActivity shadowActivity = Shadows.shadowOf(fragment.getActivity());
doReturn(false).when(mController).isFeedbackEnabled(anyString());
mController.onDismissed(getTestSliceCard());
assertThat(shadowActivity.getNextStartedActivity()).isNull();
}
use of com.android.settings.homepage.contextualcards.ContextualCardsFragment in project android_packages_apps_Settings by omnirom.
the class SliceContextualCardControllerTest method onDismissed_feedbackEnabled_shouldShowFeedbackDialog.
@Test
public void onDismissed_feedbackEnabled_shouldShowFeedbackDialog() {
mResolver.insert(CardContentProvider.REFRESH_CARD_URI, generateOneRow());
final ContextualCardsFragment fragment = FragmentController.of(new ContextualCardsFragment()).create().get();
final ShadowActivity shadowActivity = Shadows.shadowOf(fragment.getActivity());
doReturn(true).when(mController).isFeedbackEnabled(anyString());
mController.onDismissed(getTestSliceCard());
assertThat(shadowActivity.getNextStartedActivity().getComponent().getClassName()).isEqualTo(ContextualCardFeedbackDialog.class.getName());
}
Aggregations