@Override
  protected boolean isStepCompleted(@NonNull Context context) {
    // note: we can not use mSharedPrefs, since this method might be
    // called before onAttached is called.
    return (mSharedPrefs == null ? DirectBootAwareSharedPreferences.create(context) : mSharedPrefs)
            .getBoolean(SKIPPED_PREF_KEY, false)
        || SetupSupport.hasLanguagePackForCurrentLocale(
            AnyApplication.getKeyboardFactory(context).getAllAddOns());
  }
@Test
  public void testHappyPath() {
    Locale.setDefault(Locale.FRANCE);
    WizardLanguagePackFragment fragment = startFragment();
    Assert.assertFalse(fragment.isStepCompleted(getApplicationContext()));

    ImageView stateIcon = fragment.getView().findViewById(R.id.step_state_icon);
    Assert.assertNotNull(stateIcon);

    Assert.assertTrue(stateIcon.isClickable());
    Assert.assertEquals(
        R.drawable.ic_wizard_download_pack_missing,
        Shadows.shadowOf(stateIcon.getDrawable()).getCreatedFromResId());

    View.OnClickListener stateIconClickHandler = Shadows.shadowOf(stateIcon).getOnClickListener();
    View.OnClickListener linkClickHandler =
        Shadows.shadowOf((View) fragment.getView().findViewById(R.id.go_to_download_packs_action))
            .getOnClickListener();

    Assert.assertNotNull(stateIconClickHandler);
    Assert.assertSame(stateIconClickHandler, linkClickHandler);

    Assert.assertNull(
        Shadows.shadowOf((Application) ApplicationProvider.getApplicationContext())
            .getNextStartedActivity());

    stateIconClickHandler.onClick(null);

    Assert.assertEquals(
        "Leaving AnySoftKeyboard",
        GeneralDialogTestUtil.getTitleFromDialog(GeneralDialogTestUtil.getLatestShownDialog()));
  }