Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00925d73 authored by Frank Preel's avatar Frank Preel
Browse files

Test dynamic switch button display

parent f8947ad6
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -219,6 +219,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen

    public final UIHandler mHandler = new UIHandler(this);

    private ImageButton floatingButton;

    public static final class UIHandler extends LeakGuardHandlerWrapper<LatinIME> {
        private static final int MSG_UPDATE_SHIFT_STATE = 0;
        private static final int MSG_PENDING_IMS_CALLBACK = 1;
@@ -881,10 +883,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
            mSuggestionStripView.setListener(this, view);
        }

        ImageButton floatingButton = view.findViewById(R.id.floating_button);
        floatingButton = view.findViewById(R.id.floating_button);
        if (floatingButton != null) {
            //if (isSetupWizardFinished() && (accountIsPremium(getApplicationContext()) || accountIsPremiumFromIME())) {
            if (true) {
            if (shouldShowFloatingButton()) {
                floatingButton.setVisibility(View.VISIBLE);
                floatingButton.setOnClickListener(new View.OnClickListener() {
                    @Override
@@ -899,6 +901,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
        }
    }

    private boolean shouldShowFloatingButton() {
        Log.d(TAG, ">>>shouldShowFloatingButton");
        return true;
    }

    private void switchToNextInputMethod() {
        final IBinder token = getWindow().getWindow().getAttributes().token;
         InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
@@ -970,6 +977,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
    public void onStartInputView(final EditorInfo editorInfo, final boolean restarting) {
        mHandler.onStartInputView(editorInfo, restarting);
        mStatsUtilsManager.onStartInputView();

        if (floatingButton != null) {
            if (shouldShowFloatingButton()) {
                floatingButton.setVisibility(View.VISIBLE);
            } else {
                floatingButton.setVisibility(View.GONE);
            }
        }
    }

    @Override