Commit 12e91010 by Baoxy

fix: 修改Toast

parent 3f8d9c8a
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:elevation="3dp" android:elevation="3dp"
android:layout_weight="1" android:layout_weight="1"
android:enabled="false"
android:background="#fafafa" android:background="#fafafa"
android:onClick="btnClick" android:onClick="btnClick"
android:text="确定" /> android:text="确定" />
...@@ -101,6 +102,7 @@ ...@@ -101,6 +102,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.AppCompat.Button.Borderless"
android:enabled="false"
android:layout_weight="1" android:layout_weight="1"
android:background="#fafafa" android:background="#fafafa"
android:layout_margin="10dp" android:layout_margin="10dp"
......
package com.android.launcher3.function.pwd; package com.android.launcher3.function.pwd;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.inputmethod.InputMethodManager;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
...@@ -22,9 +18,8 @@ import android.widget.TextView; ...@@ -22,9 +18,8 @@ import android.widget.TextView;
import com.android.launcher3.BaseActivity; import com.android.launcher3.BaseActivity;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.settings.BlankActivity; import com.android.launcher3.settings.BlankActivity;
import com.secspace.lib.common.dialog.other.DialogUIUtils;
import com.secspace.lib.common.utils.Prefs; import com.secspace.lib.common.utils.Prefs;
import com.secspace.lib.common.utils.ToastUtil;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -87,13 +82,15 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi ...@@ -87,13 +82,15 @@ public class PwdPinSetPwdActivity extends BaseActivity implements View.OnClickLi
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_sure: case R.id.btn_sure:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
String pwd = String.valueOf(mEditPwd.getText()); String pwd = String.valueOf(mEditPwd.getText());
if (TextUtils.isEmpty(pwd)) { if (TextUtils.isEmpty(pwd)) {
ToastUtil.showShort(this, "密码不能为空"); DialogUIUtils.showToastCenter("密码不能为空");
return; return;
} }
if (pwd.length() < PWD_TINY_LENGTH) { if (pwd.length() < PWD_TINY_LENGTH) {
ToastUtil.showShort(this, "密码至少为6位"); DialogUIUtils.showToastCenter("密码至少为6位");
return; return;
} }
// if (pwd.length() > PWD_MAX_LENGTH) { // if (pwd.length() > PWD_MAX_LENGTH) {
......
...@@ -77,6 +77,7 @@ class AppChooseActivity : BaseActivity() { ...@@ -77,6 +77,7 @@ class AppChooseActivity : BaseActivity() {
private suspend fun loadFinished(appModels: List<AppModel>) { private suspend fun loadFinished(appModels: List<AppModel>) {
mSystemApps.clear() mSystemApps.clear()
mUserApps.clear() mUserApps.clear()
appModels.forEach { appModels.forEach {
if (it.appInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0) { if (it.appInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0) {
mSystemApps.add(it) mSystemApps.add(it)
...@@ -87,6 +88,8 @@ class AppChooseActivity : BaseActivity() { ...@@ -87,6 +88,8 @@ class AppChooseActivity : BaseActivity() {
} }
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
btn_sure.isEnabled = true
btn_cancel.isEnabled = true
LoadingDialog.getInstance(mContext).dismiss() LoadingDialog.getInstance(mContext).dismiss()
mAppInfoAdapterUserApp?.readResult(mAppContext) mAppInfoAdapterUserApp?.readResult(mAppContext)
mAppInfoAdapterSystemApp?.readResult(mAppContext) mAppInfoAdapterSystemApp?.readResult(mAppContext)
......
...@@ -8,16 +8,18 @@ import android.text.SpannedString ...@@ -8,16 +8,18 @@ import android.text.SpannedString
import android.text.TextUtils import android.text.TextUtils
import android.text.style.AbsoluteSizeSpan import android.text.style.AbsoluteSizeSpan
import android.view.View import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText import android.widget.EditText
import com.android.launcher3.BaseActivity import com.android.launcher3.BaseActivity
import com.android.launcher3.R import com.android.launcher3.R
import com.android.launcher3.function.pwd.PwdPinSetPwdActivity import com.android.launcher3.function.pwd.PwdPinSetPwdActivity
import com.android.launcher3.settings.ErrorTimeHelper import com.android.launcher3.settings.ErrorTimeHelper
import com.secspace.lib.common.dialog.other.DialogUIUtils
import com.secspace.lib.common.utils.Prefs import com.secspace.lib.common.utils.Prefs
import com.secspace.lib.common.utils.ToastUtil
import kotlinx.android.synthetic.main.activity_change_pwd.* import kotlinx.android.synthetic.main.activity_change_pwd.*
import kotlinx.android.synthetic.main.activity_setting.tv_setting_title import kotlinx.android.synthetic.main.activity_setting.tv_setting_title
class ChangePwdActivity : BaseActivity() { class ChangePwdActivity : BaseActivity() {
private var mContext: Context? = null private var mContext: Context? = null
...@@ -36,7 +38,7 @@ class ChangePwdActivity : BaseActivity() { ...@@ -36,7 +38,7 @@ class ChangePwdActivity : BaseActivity() {
setHintSize(et_new_pwd_again, getString(R.string.edu_item_input_newpwd_again)) setHintSize(et_new_pwd_again, getString(R.string.edu_item_input_newpwd_again))
tv_confir_pwd_protection.setOnClickListener { tv_confir_pwd_protection.setOnClickListener {
ToastUtil.showShort(this@ChangePwdActivity, R.string.edu_toast_wait) DialogUIUtils.showToastCenter(R.string.edu_toast_wait)
} }
} }
...@@ -48,35 +50,37 @@ class ChangePwdActivity : BaseActivity() { ...@@ -48,35 +50,37 @@ class ChangePwdActivity : BaseActivity() {
} }
fun btnClick(v: View) { fun btnClick(v: View) {
val imm: InputMethodManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(window.decorView.windowToken, 0)
val originalPwd = et_old_pwd.text.toString() val originalPwd = et_old_pwd.text.toString()
val newPwd = et_new_pwd.text.toString() val newPwd = et_new_pwd.text.toString()
val confirmNewPwd = et_new_pwd_again.text.toString() val confirmNewPwd = et_new_pwd_again.text.toString()
if (!ErrorTimeHelper.getInstance(this).canShowDialog()) { if (!ErrorTimeHelper.getInstance(this).canShowDialog()) {
ToastUtil.showShort(this, String.format(getString(R.string.edu_item_input_lock), ErrorTimeHelper.getInstance(this).countDownTime)) DialogUIUtils.showToastCenter(String.format(getString(R.string.edu_item_input_lock), ErrorTimeHelper.getInstance(this).countDownTime))
return return
} }
if (newPwd.isEmpty()|| newPwd.length < PwdPinSetPwdActivity.PWD_TINY_LENGTH) { if (newPwd.isEmpty()|| newPwd.length < PwdPinSetPwdActivity.PWD_TINY_LENGTH) {
ToastUtil.showShort(this, R.string.edu_item_input_newpwd_null) DialogUIUtils.showToastCenter(R.string.edu_item_input_newpwd_null)
return return
} }
if (confirmNewPwd.isEmpty() || confirmNewPwd.length < PwdPinSetPwdActivity.PWD_TINY_LENGTH) { if (confirmNewPwd.isEmpty() || confirmNewPwd.length < PwdPinSetPwdActivity.PWD_TINY_LENGTH) {
ToastUtil.showShort(this, R.string.edu_item_input_newpwd_again_null) DialogUIUtils.showToastCenter(R.string.edu_item_input_newpwd_again_null)
return return
} }
if (originalPwd.isEmpty()) { if (originalPwd.isEmpty()) {
ToastUtil.showShort(this, R.string.edu_item_input_oldpwd_null) DialogUIUtils.showToastCenter(R.string.edu_item_input_oldpwd_null)
return return
} }
if (!TextUtils.equals(originalPwd, Prefs.getLoginPwd(this))) { if (!TextUtils.equals(originalPwd, Prefs.getLoginPwd(this))) {
ToastUtil.showShort(this, R.string.edu_item_input_pwd_error) DialogUIUtils.showToastCenter(R.string.edu_item_input_pwd_error)
ErrorTimeHelper.getInstance(this).addErrorCount() ErrorTimeHelper.getInstance(this).addErrorCount()
return return
} }
if (!TextUtils.equals(newPwd, confirmNewPwd)) { if (!TextUtils.equals(newPwd, confirmNewPwd)) {
ToastUtil.showShort(this, R.string.edu_item_input_pwd_different) DialogUIUtils.showToastCenter(R.string.edu_item_input_pwd_different)
return return
} }
ToastUtil.showShort(this, R.string.edu_item_input_pwd_change_success) DialogUIUtils.showToastCenter(R.string.edu_item_input_pwd_change_success)
Prefs.setLoginPwd(this, newPwd) Prefs.setLoginPwd(this, newPwd)
//如果存在输错密码多次的情况下重置密码 //如果存在输错密码多次的情况下重置密码
ErrorTimeHelper.getInstance(this).resetLockTimeAndCount() ErrorTimeHelper.getInstance(this).resetLockTimeAndCount()
......
...@@ -177,12 +177,13 @@ public class PrivacyPolicyDialog implements DialogInterface.OnDismissListener, V ...@@ -177,12 +177,13 @@ public class PrivacyPolicyDialog implements DialogInterface.OnDismissListener, V
} else if (v.getId() == R.id.btn_accept) { } else if (v.getId() == R.id.btn_accept) {
Prefs.setPrivacyPolicyState(mActivity, true); Prefs.setPrivacyPolicyState(mActivity, true);
try { try {
mActivity.startActivity(new Intent(mActivity, Class.forName("com.android.launcher3.settings.BlankActivity"))); Intent intent = new Intent(mActivity, Class.forName("com.android.launcher3.settings.BlankActivity"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mActivity.startActivity(intent);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
dismiss(); dismiss();
mActivity.finish();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment