@Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.quick_keys_popup_close:
        mKeyboardActionListener.onKey(KeyCodes.CANCEL, null, 0, null, true);
        break;
      case R.id.quick_keys_popup_backspace:
        mKeyboardActionListener.onKey(KeyCodes.DELETE, null, 0, null, true);
        break;
      case R.id.quick_keys_popup_quick_keys_insert_media:
        mKeyboardActionListener.onKey(KeyCodes.IMAGE_MEDIA_POPUP, null, 0, null, true);
        break;
      case R.id.quick_keys_popup_delete_recently_used_smileys:
        mKeyboardActionListener.onKey(KeyCodes.CLEAR_QUICK_TEXT_HISTORY, null, 0, null, true);
        // re-show
        mKeyboardActionListener.onKey(KeyCodes.QUICK_TEXT_POPUP, null, 0, null, true);
        break;
      case R.id.quick_keys_popup_quick_keys_settings:
        Intent startSettings =
            new Intent(
                Intent.ACTION_VIEW,
                Uri.parse(v.getContext().getString(R.string.deeplink_url_quick_text)),
                v.getContext(),
                MainSettingsActivity.class);
        startSettings.setFlags(
            Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_NO_HISTORY
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        v.getContext().startActivity(startSettings);
        // and closing keyboard
        mKeyboardActionListener.onKey(KeyCodes.CANCEL, null, 0, null, true);
        break;
      default:
        throw new IllegalArgumentException(
            "Failed to handle view id " + v.getId() + " in FrameKeyboardViewClickListener");
    }
  }
@Test
  public void testOnClickSetting() throws Exception {
    OnKeyboardActionListener keyboardActionListener = Mockito.mock(OnKeyboardActionListener.class);
    FrameKeyboardViewClickListener listener =
        new FrameKeyboardViewClickListener(keyboardActionListener);
    Mockito.verifyZeroInteractions(keyboardActionListener);
    View view = new View(getApplicationContext());
    view.setId(R.id.quick_keys_popup_quick_keys_settings);
    listener.onClick(view);
    Intent expectedIntent =
        new Intent(
            Intent.ACTION_VIEW,
            Uri.parse(getApplicationContext().getString(R.string.deeplink_url_quick_text)),
            getApplicationContext(),
            MainSettingsActivity.class);
    expectedIntent.setFlags(
        Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_NO_HISTORY
            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

    Intent settingIntent =
        Shadows.shadowOf((Application) ApplicationProvider.getApplicationContext())
            .getNextStartedActivity();
    Assert.assertEquals(
        expectedIntent.getComponent().flattenToString(),
        settingIntent.getComponent().flattenToString());
    Assert.assertEquals(expectedIntent.getFlags(), settingIntent.getFlags());
    // closes the keyboard
    Mockito.verify(keyboardActionListener).onKey(KeyCodes.CANCEL, null, 0, null, true);
    Mockito.verifyNoMoreInteractions(keyboardActionListener);
  }