version:1.6.8
fix:修复拨号界面不显示微信通话问题 update:增加合规
This commit is contained in:
@@ -2,12 +2,10 @@ package com.xxpatx.os.activity.callwechat;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.accessibility.selecttospeak.SelectToSpeakService;
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xxpatx.os.bean.Contact;
|
||||
@@ -64,7 +62,7 @@ public class CallWechatActivity extends BaseMvvmActivity<CallWechatViewModel, Ac
|
||||
if (contact != null) {
|
||||
mContact = contact;
|
||||
mViewDataBinding.setContact(contact);
|
||||
mViewDataBinding.setTag(!TextUtils.isEmpty(contact.getTag()));
|
||||
// mViewDataBinding.setTag(!TextUtils.isEmpty(contact.getTag()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,11 +110,11 @@ public class CallWechatActivity extends BaseMvvmActivity<CallWechatViewModel, Ac
|
||||
}
|
||||
|
||||
public void callWechatVideo(View view) {
|
||||
if (TextUtils.isEmpty(mContact.getTag())) {
|
||||
Toaster.show("没有设置标签,无法拨打微信视频");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
// if (TextUtils.isEmpty(mContact.getTag())) {
|
||||
// Toaster.show("没有设置标签,无法拨打微信视频");
|
||||
// finish();
|
||||
// return;
|
||||
// }
|
||||
if (checkSettings()) {
|
||||
// 1. 获取 MediaProjectionManager 实例
|
||||
// MediaProjectionManager projectionManager = (MediaProjectionManager)
|
||||
@@ -143,11 +141,11 @@ public class CallWechatActivity extends BaseMvvmActivity<CallWechatViewModel, Ac
|
||||
}
|
||||
|
||||
public void callWechatVoice(View view) {
|
||||
if (TextUtils.isEmpty(mContact.getTag())) {
|
||||
Toaster.show("没有设置标签,无法拨打微信语音");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
// if (TextUtils.isEmpty(mContact.getTag())) {
|
||||
// Toaster.show("没有设置标签,无法拨打微信语音");
|
||||
// finish();
|
||||
// return;
|
||||
// }
|
||||
if (checkSettings()) {
|
||||
// MediaProjectionManager projectionManager = (MediaProjectionManager)
|
||||
// getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.xxpatx.os.activity.privacy;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.base.mvvm.BaseMvvmActivity;
|
||||
import com.xxpatx.os.databinding.ActivityPrivacyBinding;
|
||||
|
||||
public class PrivacyActivity extends BaseMvvmActivity<PrivacyViewModel, ActivityPrivacyBinding> {
|
||||
private static final String TAG = "PrivacyActivity";
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setNightMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setfitWindow() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_privacy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDataBinding() {
|
||||
mViewModel.setCtx(this);
|
||||
mViewModel.setVDBinding(mViewDataBinding);
|
||||
mViewModel.setLifecycle(getLifecycleSubject());
|
||||
mViewDataBinding.setClick(new BtnClick());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
WebSettings settings = mViewDataBinding.webView.getSettings();
|
||||
// settings.setUseWideViewPort(true);
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setAllowFileAccess(true);
|
||||
settings.setAllowContentAccess(true);
|
||||
settings.setAllowFileAccessFromFileURLs(true);
|
||||
settings.setAllowUniversalAccessFromFileURLs(true);
|
||||
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
|
||||
mViewDataBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mViewDataBinding.webView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
super.onProgressChanged(view, newProgress);
|
||||
if (newProgress == 100) {
|
||||
mViewDataBinding.progressBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
mViewDataBinding.progressBar.setVisibility(View.VISIBLE);
|
||||
mViewDataBinding.progressBar.setMax(100);
|
||||
mViewDataBinding.progressBar.setProgress(newProgress);
|
||||
}
|
||||
}
|
||||
});
|
||||
Intent intent = getIntent();
|
||||
int contentType = intent.getIntExtra("ContentType", 1);
|
||||
switch (contentType) {
|
||||
default:
|
||||
case 1:
|
||||
mViewDataBinding.tvTitle.setText("用户协议");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=1-1&status=1&projectId=10");
|
||||
break;
|
||||
case 2:
|
||||
mViewDataBinding.tvTitle.setText("隐私政策");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=1-2&status=1&projectId=10");
|
||||
break;
|
||||
case 3:
|
||||
mViewDataBinding.tvTitle.setText("SDK共享清单");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=1-3&status=1&projectId=10");
|
||||
break;
|
||||
case 4:
|
||||
mViewDataBinding.tvTitle.setText("微信一键视频、语音通话功能用户须知");
|
||||
mViewDataBinding.webView.loadUrl("https://www.uiuios.com/agreement.html?section=3-6&status=1&projectId=10");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void exit(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.xxpatx.os.activity.privacy;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.xxpatx.os.base.mvvm.BaseViewModel;
|
||||
import com.xxpatx.os.databinding.ActivityPrivacyBinding;
|
||||
|
||||
public class PrivacyViewModel extends BaseViewModel<ActivityPrivacyBinding, ActivityEvent> {
|
||||
|
||||
@Override
|
||||
public ActivityPrivacyBinding getVDBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.xxpatx.os.bean.AppInfo;
|
||||
import com.xxpatx.os.bean.SystemSettings;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.databinding.ActivitySettingBinding;
|
||||
import com.xxpatx.os.fragment.dialog.PrivacyPolicyFragment;
|
||||
import com.xxpatx.os.service.main.MainService;
|
||||
import com.xxpatx.os.utils.AccessibilityUtils;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
@@ -277,21 +278,86 @@ public class SettingActivity extends BaseMvvmActivity<SettingViewModel, Activity
|
||||
}
|
||||
|
||||
public void autoAccept(View view) {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(SettingActivity.this)) {
|
||||
boolean autoAccept = mMMKV.decodeBool(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, false);
|
||||
Log.e(TAG, "autoAccept: autoAccept = " + autoAccept);
|
||||
mViewDataBinding.setAutoAccept(!autoAccept);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, !autoAccept);
|
||||
Intent intent = new Intent(SelectToSpeakService.SETTING_AUTOMATIC_ANSWER_ACTION);
|
||||
intent.putExtra("auto_answer", !autoAccept);
|
||||
sendBroadcast(intent);
|
||||
boolean autoAccept = mMMKV.decodeBool(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, false);
|
||||
Log.e(TAG, "autoAccept: autoAccept = " + autoAccept);
|
||||
if (autoAccept) {
|
||||
mViewDataBinding.setAutoAccept(false);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, false);
|
||||
} else {
|
||||
boolean floatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
|
||||
if (floatWindowEnable) {
|
||||
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
||||
} else {
|
||||
AccessibilityUtils.openAccessibilitySettings(SettingActivity.this);
|
||||
}
|
||||
new PrivacyPolicyFragment(new PrivacyPolicyFragment.DialogFragmentCallback() {
|
||||
@Override
|
||||
public void onPositive() {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(SettingActivity.this)) {
|
||||
Intent intent = new Intent(SelectToSpeakService.SETTING_AUTOMATIC_ANSWER_ACTION);
|
||||
intent.putExtra("auto_answer", true);
|
||||
sendBroadcast(intent);
|
||||
mViewDataBinding.setAutoAccept(true);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, true);
|
||||
} else {
|
||||
boolean floatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
|
||||
if (floatWindowEnable) {
|
||||
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
||||
} else {
|
||||
AccessibilityUtils.openAccessibilitySettings(SettingActivity.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative() {
|
||||
Toaster.show("请先阅读并同意用户须知");
|
||||
mViewDataBinding.setAutoAccept(false);
|
||||
mMMKV.encode(CommonConfig.WECHAT_CALL_AUTO_ACCEPT, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
setStatus();
|
||||
}
|
||||
}).show(getSupportFragmentManager(), PrivacyPolicyFragment.class.getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
public void autoCall(View view) {
|
||||
boolean autoAccept = mMMKV.decodeBool(CommonConfig.WECHAT_AUTO_CALL_KEY, false);
|
||||
Log.e(TAG, "autoAccept: autoAccept = " + autoAccept);
|
||||
if (autoAccept) {
|
||||
mViewDataBinding.setAutoCall(false);
|
||||
mMMKV.encode(CommonConfig.WECHAT_AUTO_CALL_KEY, false);
|
||||
} else {
|
||||
new PrivacyPolicyFragment(new PrivacyPolicyFragment.DialogFragmentCallback() {
|
||||
@Override
|
||||
public void onPositive() {
|
||||
if (AccessibilityUtils.isAccessibilitySettingsOn(SettingActivity.this)) {
|
||||
Intent intent = new Intent(SelectToSpeakService.SETTING_AUTOMATIC_ANSWER_ACTION);
|
||||
intent.putExtra("auto_answer", true);
|
||||
sendBroadcast(intent);
|
||||
mViewDataBinding.setAutoCall(true);
|
||||
mMMKV.encode(CommonConfig.WECHAT_AUTO_CALL_KEY, true);
|
||||
} else {
|
||||
boolean floatWindowEnable = Settings.Global.getInt(getContentResolver(), CommonConfig.HOVER_HOME, CommonConfig.HOVER_HOME_STATUS) == 1;
|
||||
if (floatWindowEnable) {
|
||||
Toaster.showLong("因为系统限制,请先关闭悬浮窗功能,开启自动接听后再打开悬浮窗");
|
||||
} else {
|
||||
AccessibilityUtils.openAccessibilitySettings(SettingActivity.this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegative() {
|
||||
Toaster.show("请先阅读并同意用户须知");
|
||||
mViewDataBinding.setAutoCall(false);
|
||||
mMMKV.encode(CommonConfig.WECHAT_AUTO_CALL_KEY, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
setStatus();
|
||||
}
|
||||
}).show(getSupportFragmentManager(), PrivacyPolicyFragment.class.getSimpleName());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ import com.xxpatx.os.utils.AppUsedTimeUtils;
|
||||
import com.xxpatx.os.utils.Utils;
|
||||
import com.xxpatx.os.utils.WiFiUtils;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = "BaseApplication";
|
||||
|
||||
@@ -51,9 +55,16 @@ public class BaseApplication extends Application {
|
||||
Toaster.init(this);
|
||||
SpeechManager.init(this);
|
||||
|
||||
CrashReport.initCrashReport(getApplicationContext(), "09fec11058", false);
|
||||
CrashReport.setDeviceModel(getApplicationContext(), Build.MODEL);
|
||||
CrashReport.setDeviceId(this, Utils.getSerial());
|
||||
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(this);
|
||||
strategy.setDeviceID(Utils.getSerial());
|
||||
//后台不会显示
|
||||
strategy.setDeviceModel(Utils.getSerial());
|
||||
strategy.setAppChannel(Build.MODEL);
|
||||
CrashReport.initCrashReport(getApplicationContext(), "09fec11058", true, strategy);
|
||||
|
||||
// CrashReport.setDeviceId(this, Utils.getSerial());
|
||||
// CrashReport.setDeviceModel(getApplicationContext(), Build.MODEL);
|
||||
|
||||
xcrash.XCrash.init(this);
|
||||
|
||||
aliyunPushInit();
|
||||
@@ -87,6 +98,7 @@ public class BaseApplication extends Application {
|
||||
ContactCacheUtils.init(this);
|
||||
DesktopIconManager.init(this);
|
||||
ContactManager.init(this);
|
||||
hookWebView();
|
||||
}
|
||||
|
||||
private void aliyunPushInit() {
|
||||
@@ -162,5 +174,43 @@ public class BaseApplication extends Application {
|
||||
});
|
||||
}
|
||||
|
||||
public void hookWebView() {
|
||||
// if (!ApkUtils.isAvailable(mContext, chromium_pkg)) {
|
||||
// return;
|
||||
// }
|
||||
int sdkInt = Build.VERSION.SDK_INT;
|
||||
try {
|
||||
Class<?> factoryClass = Class.forName("android.webkit.WebViewFactory");
|
||||
Field field = factoryClass.getDeclaredField("sProviderInstance");
|
||||
field.setAccessible(true);
|
||||
Object sProviderInstance = field.get(null);
|
||||
if (sProviderInstance != null) {
|
||||
Log.d(TAG, "sProviderInstance isn't null");
|
||||
return;
|
||||
}
|
||||
Method getProviderClassMethod;
|
||||
if (sdkInt > 22) { // above 22
|
||||
getProviderClassMethod = factoryClass.getDeclaredMethod("getProviderClass");
|
||||
} else if (sdkInt == 22) { // method name is a little different
|
||||
getProviderClassMethod = factoryClass.getDeclaredMethod("getFactoryClass");
|
||||
} else { // no security check below 22
|
||||
Log.i(TAG, "Don't need to Hook WebView");
|
||||
return;
|
||||
}
|
||||
getProviderClassMethod.setAccessible(true);
|
||||
Class<?> providerClass = (Class<?>) getProviderClassMethod.invoke(factoryClass);
|
||||
Class<?> delegateClass = Class.forName("android.webkit.WebViewDelegate");
|
||||
Constructor<?> declaredConstructor = delegateClass.getDeclaredConstructor();
|
||||
declaredConstructor.setAccessible(true);
|
||||
sProviderInstance = providerClass
|
||||
.getDeclaredMethod("create", delegateClass)
|
||||
.invoke(providerClass, declaredConstructor.newInstance());
|
||||
Log.d("sProviderInstance", sProviderInstance.toString());
|
||||
field.set("sProviderInstance", sProviderInstance);
|
||||
Log.d(TAG, "Hook done!");
|
||||
} catch (Throwable e) {
|
||||
Log.e(TAG, "hook WebView Failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,11 @@ public class CommonConfig {
|
||||
public static final String VOICE_BROADCAST = "voice_broadcast_key";
|
||||
/*微信语音自动接听*/
|
||||
public static final String WECHAT_CALL_AUTO_ACCEPT = "wechat_call_auto_accept";
|
||||
/*微信语音自动免提*/
|
||||
public static final String WECHAT_AUTO_HNADS_FREE = "wechat_auto_hands_free";
|
||||
/*是否为微信自动拨打电话*/
|
||||
public static final String WECHAT_AUTO_CALL_KEY = "wechat_auto_call_video";
|
||||
|
||||
/*app启动播报*/
|
||||
public static final String VOICE_SPEAKER_KEY = "voice_speaker";
|
||||
/*电话白名单*/
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.xxpatx.os.fragment.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.privacy.PrivacyActivity;
|
||||
import com.xxpatx.os.databinding.FragmentPrivacyPolicyBinding;
|
||||
|
||||
public class PrivacyPolicyFragment extends DialogFragment {
|
||||
private static final String TAG = "PrivacyPolicyFragment";
|
||||
|
||||
private FragmentPrivacyPolicyBinding mBinding;
|
||||
private View rootView;
|
||||
private Context mContext;
|
||||
|
||||
public interface DialogFragmentCallback {
|
||||
void onPositive();
|
||||
|
||||
void onNegative();
|
||||
|
||||
void onDismiss();
|
||||
}
|
||||
|
||||
private DialogFragmentCallback mDismissCallback;
|
||||
|
||||
public PrivacyPolicyFragment(DialogFragmentCallback dialogFragmentCallback) {
|
||||
this.mDismissCallback = dialogFragmentCallback;
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
Log.e(TAG, "onCreateView: ");
|
||||
mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_privacy_policy, container, false);
|
||||
mBinding.setClick(new BtnClick());
|
||||
rootView = mBinding.getRoot();
|
||||
mContext = rootView.getContext();
|
||||
initView();
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
return super.onCreateDialog(savedInstanceState);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mBinding.tvConfirm.setEnabled(false);
|
||||
mBinding.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
mBinding.tvConfirm.setEnabled(true);
|
||||
} else {
|
||||
mBinding.tvConfirm.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SpannableString spannableString = new SpannableString(mContext.getResources().getString(R.string.user_notice));
|
||||
spannableString.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
// String url = "https://www.uiuios.com/agreement.html?section=1-1&status=1";
|
||||
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
|
||||
// try {
|
||||
// intent.launchUrl(mContext, Uri.parse(url));
|
||||
// } catch (Exception e) {
|
||||
// Log.e(TAG, "onClick: " + e.getMessage());
|
||||
// }
|
||||
|
||||
Intent intent = new Intent(mContext, PrivacyActivity.class);
|
||||
intent.putExtra("ContentType", 4);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}, 0, spannableString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannableString.setSpan(new ForegroundColorSpan(Color.BLUE), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mBinding.tvUserNotice.setText(spannableString);
|
||||
mBinding.tvUserNotice.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getDialog() != null) {
|
||||
Window window = getDialog().getWindow();
|
||||
if (window == null) return;
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
window.setAttributes(params);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
getDialog().setCancelable(true);
|
||||
getDialog().setCanceledOnTouchOutside(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
DialogFragment fragment = (DialogFragment) manager.findFragmentByTag(tag);
|
||||
if (fragment != null && fragment.isAdded()
|
||||
&& fragment.getDialog() != null && fragment.getDialog().isShowing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FragmentTransaction ft = manager.beginTransaction();
|
||||
ft.add(this, tag);
|
||||
ft.commitAllowingStateLoss();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "show: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
if (mDismissCallback != null) {
|
||||
mDismissCallback.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
public void onPositiveClick(View view) {
|
||||
if (mBinding.checkBox.isChecked()) {
|
||||
if (mDismissCallback != null) {
|
||||
mDismissCallback.onPositive();
|
||||
}
|
||||
dismiss();
|
||||
} else {
|
||||
if (mDismissCallback != null) {
|
||||
mDismissCallback.onNegative();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onRead(View view) {
|
||||
mBinding.checkBox.setChecked(!mBinding.checkBox.isChecked());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -313,12 +313,16 @@ public class MainSPresenter implements MainSContact.Presenter {
|
||||
if (baseResponse.code == 200) {
|
||||
ClockSetting clockSetting = baseResponse.data;
|
||||
String time = clockSetting.getClock();
|
||||
List<Integer> integers = new ArrayList<>();
|
||||
List<String> timeLsit = new ArrayList<>(Arrays.asList(time.split(",")));
|
||||
for (String s : timeLsit) {
|
||||
integers.add(Integer.parseInt(s));
|
||||
if (!TextUtils.isEmpty(time)) {
|
||||
List<Integer> integers = new ArrayList<>();
|
||||
List<String> timeLsit = new ArrayList<>(Arrays.asList(time.split(",")));
|
||||
for (String s : timeLsit) {
|
||||
integers.add(Integer.parseInt(s));
|
||||
}
|
||||
mMMKV.encode(CommonConfig.TIME_HOUR_LIST_KEY, GsonUtils.toJSONString(integers));
|
||||
} else {
|
||||
mMMKV.encode(CommonConfig.TIME_HOUR_LIST_KEY, "");
|
||||
}
|
||||
mMMKV.encode(CommonConfig.TIME_HOUR_LIST_KEY, GsonUtils.toJSONString(integers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user