Loading java/src/com/android/inputmethod/latin/LatinIME.java +27 −21 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROP import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE_COMPAT; import android.Manifest.permission; import android.accounts.Account; import android.accounts.AccountManager; import android.app.ActivityOptions; import android.app.AlertDialog; import android.content.BroadcastReceiver; Loading Loading @@ -56,6 +58,7 @@ import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import android.widget.ImageButton; Loading Loading @@ -108,10 +111,6 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils; import android.content.ContentResolver; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import android.os.IBinder; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -882,7 +881,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton != null) { if (isSetupWizardFinished()) { if (isSetupWizardFinished() && accountIsPremium()) { floatingButton.setVisibility(View.VISIBLE); floatingButton.setOnClickListener(new View.OnClickListener() { @Override Loading @@ -898,29 +897,36 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } private void switchToNextInputMethod() { Log.d(TAG, "switchToNextInputMethod"); final IBinder token = getWindow().getWindow().getAttributes().token; Log.d(TAG, "switchToNextInputMethod 2"); final IBinder token = getWindow().getAttributes().token; InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); Log.d(TAG, "switchToNextInputMethod 3"); if (imm != null) { Log.d(TAG, "switchToNextInputMethod 4"); imm.switchToNextInputMethod(token, false /* onlyCurrentIme */); Log.d(TAG, "switchToNextInputMethod 5"); imm.switchToNextInputMethod(token, false); } } private boolean isSetupWizardFinished() { Log.d(TAG, "isSetupWizardFinished"); ContentResolver contentResolver = mDisplayContext.getContentResolver(); Log.d(TAG, "isSetupWizardFinished 2"); boolean isDeviceProvisioned = android.provider.Settings.Global.getInt(contentResolver, android.provider.Settings.Global.DEVICE_PROVISIONED, 0) == 1; //boolean isUserSetupComplete = android.provider.Settings.Secure.getInt(contentResolver, // android.provider.Settings.Secure.USER_SETUP_COMPLETE, 0) == 1; Log.d(TAG, "isSetupWizardFinished " + isDeviceProvisioned ); return isDeviceProvisioned; } private boolean accountIsPremium() { AccountManager accountManager = AccountManager.get(mDisplayContext); Account[] accountList = accountManager.getAccountsByType("e.foundation.webdav.eelo"); boolean accountIsPremium = false; if (accountList != null) { for (Account account : accountList) { String groupData = accountManager.getUserData(account, "group"); if ("premium".equals(groupData)) { accountIsPremium = true; break; } } } return isDeviceProvisioned;// && isUserSetupComplete; return accountIsPremium; } @Override Loading Loading
java/src/com/android/inputmethod/latin/LatinIME.java +27 −21 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROP import static com.android.inputmethod.latin.common.Constants.ImeOption.NO_MICROPHONE_COMPAT; import android.Manifest.permission; import android.accounts.Account; import android.accounts.AccountManager; import android.app.ActivityOptions; import android.app.AlertDialog; import android.content.BroadcastReceiver; Loading Loading @@ -56,6 +58,7 @@ import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import android.widget.ImageButton; Loading Loading @@ -108,10 +111,6 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils; import android.content.ContentResolver; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import android.os.IBinder; import java.io.FileDescriptor; import java.io.PrintWriter; Loading Loading @@ -882,7 +881,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton != null) { if (isSetupWizardFinished()) { if (isSetupWizardFinished() && accountIsPremium()) { floatingButton.setVisibility(View.VISIBLE); floatingButton.setOnClickListener(new View.OnClickListener() { @Override Loading @@ -898,29 +897,36 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } private void switchToNextInputMethod() { Log.d(TAG, "switchToNextInputMethod"); final IBinder token = getWindow().getWindow().getAttributes().token; Log.d(TAG, "switchToNextInputMethod 2"); final IBinder token = getWindow().getAttributes().token; InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); Log.d(TAG, "switchToNextInputMethod 3"); if (imm != null) { Log.d(TAG, "switchToNextInputMethod 4"); imm.switchToNextInputMethod(token, false /* onlyCurrentIme */); Log.d(TAG, "switchToNextInputMethod 5"); imm.switchToNextInputMethod(token, false); } } private boolean isSetupWizardFinished() { Log.d(TAG, "isSetupWizardFinished"); ContentResolver contentResolver = mDisplayContext.getContentResolver(); Log.d(TAG, "isSetupWizardFinished 2"); boolean isDeviceProvisioned = android.provider.Settings.Global.getInt(contentResolver, android.provider.Settings.Global.DEVICE_PROVISIONED, 0) == 1; //boolean isUserSetupComplete = android.provider.Settings.Secure.getInt(contentResolver, // android.provider.Settings.Secure.USER_SETUP_COMPLETE, 0) == 1; Log.d(TAG, "isSetupWizardFinished " + isDeviceProvisioned ); return isDeviceProvisioned; } private boolean accountIsPremium() { AccountManager accountManager = AccountManager.get(mDisplayContext); Account[] accountList = accountManager.getAccountsByType("e.foundation.webdav.eelo"); boolean accountIsPremium = false; if (accountList != null) { for (Account account : accountList) { String groupData = accountManager.getUserData(account, "group"); if ("premium".equals(groupData)) { accountIsPremium = true; break; } } } return isDeviceProvisioned;// && isUserSetupComplete; return accountIsPremium; } @Override Loading