修改隐私后再获取对应的方式

This commit is contained in:
2025-08-12 15:43:36 +08:00
parent ecb7f4b396
commit bd4e7912f1
8 changed files with 177 additions and 376 deletions

View File

@@ -7,12 +7,14 @@ import android.os.Handler;
import androidx.annotation.Nullable;
import com.qxcm.moduleutil.activity.BaseAppCompatActivity;
import com.qxcm.moduleutil.activity.BaseMvpActivity;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.dialog.PolicyDialog;
import com.qxcm.moduleutil.utils.SpUtil;
import com.qxcm.qxlive.databinding.ActivityLaunchPageBinding;
public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, ActivityLaunchPageBinding> implements LaunchContacter.View {
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
private Handler handler;
// public PhoneNumberAuthHelper phoneNumberAuthHelper;
// private TokenResultListener tokenResultListener;
@@ -29,14 +31,9 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
initLogin();
}
};
// mBinding.tvVersionName.setText(BuildConfig.VERSION_NAME + "." + BuildConfig.VERSION_CODE);
if (SpUtil.isAgreePolicy()) {
// UtilConfig.checkInEmulator();
// BaseApplication.getInstance().checkInEmulator();
// BaseApplication.getInstance().initHeartBeat();
// //延迟1.5秒执行
handler.postDelayed(runnable, 2500);
// initLogin();
} else {
PolicyDialog policyDialog = new PolicyDialog(this);
policyDialog.setCancelable(false);
@@ -45,13 +42,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
@Override
public void policyAgree() {
SpUtil.completeAgreePolicy();
// UtilConfig.checkInEmulator();
// BaseApplication.getInstance().checkInEmulator();
// RetrofitManager.getInstance().init(com.qpyy.libcommon.BuildConfig.BASE_URL);
// RetrofitManager.getInstance().init(com.qpyy.libcommon.BuildConfig.NEW_BASE_URL);
// BaseApplication.getInstance().initHeartBeat();
// BaseApplication.getInstance().initThirdPartySdk();
// BaseApplication.getInstance().initOkGo();
CommonAppContext.getInstance().initialization();
initLogin();
}
@@ -64,271 +55,26 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
}
}
@Override
protected void initView() {
}
private void initLogin() {
// EventBus.getDefault().register(this);
// initQuickLogin();
// checkOnePass();
startActivity(new Intent(this, PasswordLoginActivity.class));
finish();
//
}
// private void checkOnePass() {
// if (!TextUtils.isEmpty(AppContext.getInstance().getToken()) && !TextUtils.isEmpty(AppContext.getInstance().getUser().getTencent_im())) {
// isRoot();
// return;
// }
// showLoadings();
// if (phoneNumberAuthHelper != null) {
// phoneNumberAuthHelper.accelerateLoginPage(3 * 1000, new PreLoginResultListener() {
// @Override
// public void onTokenSuccess(String s) {
// Logger.e("onTokenSuccess", s);
// canOnePass = true;
// isRoot();
// }
//
// @Override
// public void onTokenFailed(String s, String s1) {
// Logger.e("onTokenFailed", "错误信息" + s, s1);
// isRoot();
// }
// });
// } else {
// canOnePass = false;
// isRoot();
// }
// }
// private void isRoot() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// disLoadings();
// if (!LaunchPageActivity.this.isTaskRoot()) {
// Intent intent = getIntent();
// if (intent != null) {
// String action = intent.getAction();
// if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
// finish();
// } else {
// goNextActivity();
// }
// } else {
// goNextActivity();
// }
// } else {
// goNextActivity();
// }
// }
// });
// }
// private void goNextActivity() {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// if (isFinishing() || isDestroyed()) {
// return;
// }
// }
// if (TextUtils.isEmpty(AppContext.getInstance().getToken()) || TextUtils.isEmpty(AppContext.getInstance().getUser().getTencent_im())) {
// Logger.e("SplashEnd", "ARouters.CODE_LOGIN");
// if (canOnePass) {
// phoneNumberAuthHelper.setAuthListener(tokenResultListener);
// doOnePass();
// } else {
// go2Login();
// }
// } else {
// Logger.e("SplashEnd", "ARouters.MAIN");
//
// UserBean userBean = CommonAppContext.getInstance().getUser();
//
//// TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
//// @Override
//// public void onError(final int code, final String desc) {
//// LogUtils.e("@@@",code,"描述:",desc);
//// }
//// @Override
//// public void onSuccess() {
//// LogUtils.e("@@@","成功");
////
//// }
//// });
// if (userBean.getSex() == 0) {
// Intent intent = new Intent(this, ImproveInfoActivity.class);
// Bundle bundle = new Bundle();
// bundle.putSerializable("userBean", userBean);
// intent.putExtras(bundle);
// startActivity(intent);
// } else {
// EventBus.getDefault().post(userBean);
// startActivity(new Intent(this, MainActivity.class));
// }
// finish();
// }
// }
// private void doOnePass() {
// AuthUIConfig authUIConfig = new AuthUIConfig.Builder()
// //导航栏
// .setNavColor(Color.TRANSPARENT)
// .setNavReturnHidden(true)
// .setNavHidden(true)
// .setNavText("")
// .setNavTextColor(Color.BLACK)
// .setWebNavColor(Color.TRANSPARENT)
// .setWebNavTextColor(Color.BLACK)
// .setWebNavReturnImgPath("ic_topbar_back_dark")
// //状态栏区
// .setStatusBarColor(Color.TRANSPARENT)
// .setLightColor(false)
// .setWebViewStatusBarColor(Color.TRANSPARENT)
// .setStatusBarUIFlag(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
// //logo区
// .setLogoImgPath("login_log")
// .setLogoWidth(142)
// .setLogoHeight(142)
// .setLogoOffsetY(54)
// .setLogoHidden(false)
// .setLogoScaleType(ImageView.ScaleType.FIT_XY)
// //Slogan
// .setSloganText("本机号码")
// .setSloganTextColor(Color.parseColor("#A8A8A8"))
// .setSloganTextSize(12)
// .setSloganOffsetY(236)
// //掩码栏
// .setNumberColor(Color.BLACK)
// .setNumberSize(30)
// .setNumFieldOffsetY(263)
// .setNumberLayoutGravity(Gravity.CENTER_HORIZONTAL)
// //登录按钮
// .setLogBtnText("本机号码一键登录")
// .setLogBtnWidth(300)
// .setLogBtnHeight(42)
// .setLogBtnOffsetY(325)
// .setLogBtnTextSize(14)
// .setLogBtnTextColor(getResources().getColor(R.color.black))
// .setLogBtnBackgroundPath("cs")
// //切换到其他方式
// .setSwitchAccText("其他登录方式")
// .setSwitchAccTextColor(Color.parseColor("#333333"))
// .setSwitchAccTextSize(12)
// .setSwitchOffsetY(390)
// //协议栏
// .setAppPrivacyOne("《用户协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")
// .setAppPrivacyTwo("《隐私协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4")
// .setAppPrivacyColor(Color.parseColor("#A8A8A8"), Color.parseColor("#FFBC00"))
// .setPrivacyBefore("登录即代表同意")
// .setPrivacyEnd("并授权获得号码")
// .setPrivacyTextSize(11)
// .setPrivacyAlertContentVerticalMargin(20)
// .setPrivacyMargin(39)
// .setPrivacyState(true)
// .setCheckboxHidden(false)
// .setCheckedImgPath("ic_agreement_selected")
// .setUncheckedImgPath("ic_agreement_unselect")
// .setPrivacyOffsetX(2)
// .setVendorPrivacyPrefix("《")
// .setVendorPrivacySuffix("》")
// //全页面属性
// .setAuthPageActIn("in_activity", "out_activity")
// .setAuthPageActOut("in_activity", "out_activity")
// .setPageBackgroundPath("log_bj")
// .create();
// phoneNumberAuthHelper.setAuthUIConfig(authUIConfig);
// phoneNumberAuthHelper.getLoginToken(getApplicationContext(), 5000);
// }
// private void initQuickLogin() {
// tokenResultListener = new TokenResultListener() {
// @Override
// public void onTokenSuccess(String s) {
// Logger.e("onTokenSuccess", s);
// ThreadUtils.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// TokenRet tokenRet = null;
// try {
// tokenRet = JSON.parseObject(s, TokenRet.class);
// if (tokenRet != null && ("600000").equals(tokenRet.getCode())) {
// phoneNumberAuthHelper.hideLoginLoading();
// //获取成功 dimiss就去登录、登录成功
// phoneNumberAuthHelper.quitLoginPage();
// LogUtils.e("@@@",tokenRet.getToken());
// MvpPre.oauthLogin(tokenRet.getToken());
// }
// } catch (Exception e) {
// go2Login();
// e.printStackTrace();
// }
// }
// });
// }
//
// @Override
// public void onTokenFailed(String s) {
// Logger.e("onTokenFailed", s);
// ThreadUtils.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// phoneNumberAuthHelper.hideLoginLoading();
// phoneNumberAuthHelper.quitLoginPage();
// go2Login();
// }
// });
// }
// };
//
// try {
// phoneNumberAuthHelper = PhoneNumberAuthHelper.getInstance(getApplicationContext(), null);
// phoneNumberAuthHelper.getReporter().setLoggerEnable(true);
//// phoneNumberAuthHelper.setAuthSDKInfo("6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=");
// phoneNumberAuthHelper.setAuthSDKInfo(((AppContext) getApplication()).getCurrentEnvironment().getALI_AUTH_KEY());
// phoneNumberAuthHelper.checkEnvAvailable(2);
//
// } catch (Throwable ignored) {
// Logger.e("initAuthSDK", ignored);
// }
// }
private void go2Login() {
startActivity(new Intent(this, PasswordLoginActivity.class));
finish();
}
@Override
protected int getLayoutId() {
return R.layout.activity_launch_page;
}
@Override
protected LaunchPresenter bindPresenter() {
return new LaunchPresenter(this, this);
}
// @Override
// public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
//
// if (requestCode == 1001) {
// LocationProvider provider = LocationServiceFactory.createBestProvider(this);
// provider.getLastKnownLocation(this, new LocationProvider.LocationCallback() {
// @Override
// public void onLocationReceived(double latitude, double longitude, String city) {
// ToastUtils.showShort("当前位置:" + city);
// city1=city;
// }
//
// @Override
// public void onFailed(String errorMessage) {
// ToastUtils.showShort("定位失败");
// }
// });
// }
// }
@Override

View File

@@ -196,8 +196,7 @@ dependencies {
api "com.tencent.imsdk:imsdk-plus:latest.release"
//悬浮框
api "io.github.petterpx:floatingx:2.3.5"
// system浮窗&&compose时需要导入 https://github.com/Petterpx/FloatingX/
// 记得AppHelper里调用 enableComposeSupport()
// // system浮窗&&compose时需要导入 https://github.com/Petterpx/FloatingX/
api 'io.github.petterpx:floatingx-compose:2.3.5'
api 'com.github.princekin-f:EasyFloat:2.0.4'

View File

@@ -113,6 +113,11 @@ public class CommonAppContext extends MultiDexApplication {
super.onCreate();
sInstance = this;
sMainThreadHandler = new Handler();
}
public void initialization(){
UtilConfig.init(this);
registerActivityLifecycleCallbacks();
initWebView();
@@ -129,13 +134,12 @@ public class CommonAppContext extends MultiDexApplication {
piaoPingManager.subscribe();
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance();
CrashReport.initCrashReport(this, "865cfe9555", true);/*bugly初始化*/
ServiceUtils.startService(MyMqttService.class);/*Mqtt初始化*/
}
private PiaoPingManager piaoPingManager;
private void initARouter() {
if (true) {
ARouter.openDebug();
@@ -228,7 +232,7 @@ private PiaoPingManager piaoPingManager;
LogUtils.e("AppContext------->处于前台");
EventBus.getDefault().post(new AppLifecycleEvent(true));
CommonAppConfig.getInstance().setFrontGround(true);
FloatWindowHelper.setFloatWindowVisible(true);
// FloatWindowHelper.setFloatWindowVisible(true);
AppLifecycleUtil.onAppFrontGround();
}
@@ -252,7 +256,7 @@ private PiaoPingManager piaoPingManager;
LogUtils.e("AppContext------->处于后台");
EventBus.getDefault().post(new AppLifecycleEvent(false));
CommonAppConfig.getInstance().setFrontGround(false);
FloatWindowHelper.setFloatWindowVisible(false);
// FloatWindowHelper.setFloatWindowVisible(false);
AppLifecycleUtil.onAppBackGround();
}
}
@@ -331,6 +335,7 @@ private PiaoPingManager piaoPingManager;
public void onError(final int code, final String desc) {
LogUtils.e("@@@1", code, "描述:", desc);
}
@Override
public void onSuccess() {
LogUtils.e("@@@", "成功");
@@ -374,6 +379,8 @@ private PiaoPingManager piaoPingManager;
piaoPingManager.unsubscribe();
FileUtils.deleteAllInDir(getCacheDir());
FileUtils.deleteAllInDir(getExternalCacheDir());
AgoraManager.getInstance(getApplicationContext()).destroy();
}
public static boolean isAlipayInstalled(Context context) {

View File

@@ -20,18 +20,9 @@ import androidx.annotation.NonNull;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.qxcm.moduleutil.R;
import com.qxcm.moduleutil.activity.WebViewActivity;
import com.qxcm.moduleutil.adapter.HeavenGiftAdapter;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.bean.BaseListData;
import com.qxcm.moduleutil.bean.FirstChargeGiftBean;
import com.qxcm.moduleutil.bean.RoonGiftModel;
import com.qxcm.moduleutil.databinding.DialogFirstChargeBinding;
import com.qxcm.moduleutil.databinding.WebViewDialogBinding;
import com.qxcm.moduleutil.http.BaseObserver;
import com.qxcm.moduleutil.http.RetrofitClient;
import com.qxcm.moduleutil.utils.ARouteConstants;
import com.qxcm.moduleutil.widget.dialog.BaseDialog;
import com.tencent.imsdk.v2.V2TIMConversation;
@@ -41,14 +32,6 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
import com.zhpan.bannerview.indicator.DrawableIndicator;
import com.zhpan.indicator.base.IIndicator;
import com.zhpan.indicator.enums.IndicatorSlideMode;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.disposables.Disposable;
/**
* @Author lxj$

View File

@@ -9,6 +9,7 @@ import com.blankj.utilcode.util.ServiceUtils;
import com.google.gson.Gson;
import com.qxcm.moduleutil.base.CommonAppContext;
import com.qxcm.moduleutil.service.FloatingWindow;
import com.qxcm.moduleutil.widget.PiaoPingManager;
import org.greenrobot.eventbus.EventBus;
@@ -41,7 +42,7 @@ public class RoomGiftRunable implements Runnable {
mqttCache.add(mqttBean); // 添加新数据
}
EventBus.getDefault().post(mqttBean);
new FloatingWindow(CommonAppContext.getInstance(),mqttBean);
// new FloatingWindow(CommonAppContext.getInstance(),mqttBean);
}

View File

@@ -95,7 +95,9 @@ import java.net.Proxy;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -139,23 +141,26 @@ public class RetrofitClient {
}
private OkHttpClient provideOkHttpClient() {
Map<String, String> headers = SystemUtils.getSystemParams();
Map<String, String> headers = Collections.emptyMap();
if (SpUtil.isAgreePolicy()) {
headers = SystemUtils.getSystemParams();
}
SetCookieCache cookieCache = new SetCookieCache();
ClearableCookieJar cookieJar =
new PersistentCookieJar(cookieCache, new SharedPrefsCookiePersistor(CommonAppContext.getInstance()));
try {
X509TrustManager trustAllCert = new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
};
SSLContext sslContext = null;
@@ -277,7 +282,7 @@ public class RetrofitClient {
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
ToastUtils.showShort(string.getMsg());
}
}
}
@@ -793,7 +798,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<List<MyRoomBean>>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -837,7 +842,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<List<TopRoom>>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -958,7 +963,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<List<MyCpRoom>>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1071,7 +1076,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1089,7 +1094,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1103,7 +1108,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1117,7 +1122,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1132,7 +1137,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1146,7 +1151,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1161,7 +1166,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1175,7 +1180,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1189,7 +1194,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1203,7 +1208,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1244,7 +1249,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1258,7 +1263,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1272,7 +1277,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1286,7 +1291,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1358,7 +1363,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1372,7 +1377,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1386,7 +1391,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1400,7 +1405,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1414,7 +1419,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1428,7 +1433,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1442,7 +1447,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1456,7 +1461,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1486,7 +1491,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1500,7 +1505,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1538,7 +1543,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1552,7 +1557,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1607,7 +1612,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1638,7 +1643,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1652,7 +1657,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1666,7 +1671,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
@@ -1682,7 +1687,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1696,7 +1701,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1711,7 +1716,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1726,7 +1731,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1740,7 +1745,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
if (t.toString().contains("登录失效")) {
try {
CommonAppContext.getInstance().clearLoginInfo();
@@ -1761,7 +1766,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1775,7 +1780,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1789,7 +1794,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1805,7 +1810,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
} else {
@@ -1818,7 +1823,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1833,7 +1838,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1847,7 +1852,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1862,7 +1867,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
t.printStackTrace();
}
});
@@ -1912,7 +1917,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1926,7 +1931,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1940,7 +1945,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1969,7 +1974,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
} else {
@@ -1981,7 +1986,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -1997,7 +2002,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -2011,7 +2016,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -2025,7 +2030,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -2039,7 +2044,7 @@ public class RetrofitClient {
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
com.blankj.utilcode.util.ToastUtils.showShort(t.toString());
ToastUtils.showShort(t.toString());
}
});
}
@@ -2058,7 +2063,7 @@ public class RetrofitClient {
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
com.blankj.utilcode.util.ToastUtils.showShort(string.getMsg());
ToastUtils.showShort(string.getMsg());
}
}

View File

@@ -30,16 +30,19 @@ public class FloatingWindow {
windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
piaoPingView = LayoutInflater.from(context).inflate(R.layout.item_piaoping, null);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
PixelFormat.TRANSLUCENT);
TextView textView = piaoPingView.findViewById(R.id.tv_name);
textView.setText(mqttBean.getList().getText());
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), piaoPingView.findViewById(R.id.iv_piaoping));
@@ -47,44 +50,101 @@ public class FloatingWindow {
tv_time.setText(mqttBean.getList().getNumber());
windowManager.addView(piaoPingView, layoutParams);
// piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
// @Override
// public void onGlobalLayout() {
// piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
//
// // 设置锚点为左上角,避免偏移干扰
// piaoPingView.setPivotX(0);
// piaoPingView.setPivotY(0);
//
// // 启动动画:从左外滑入 -> 右外滑出
// ObjectAnimator animator = ObjectAnimator.ofFloat(
// piaoPingView,
// "translationX",
// 0f, // 初始偏移为 0此时 View 在左侧外)
// screenWidth // 向右移动整个屏幕宽度
// );
// animator.setDuration(2000); // 整个动画的时长为2秒
//
// // 强制 GPU 渲染
// piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
//
// // 延迟显示2秒后开始滑出屏幕的动画
// piaoPingView.postDelayed(new Runnable() {
// @Override
// public void run() {
// animator.start();
// }
// }, 2000);
//
// animator.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// windowManager.removeView(piaoPingView);
// stopSelf();
// }
// });
// }
// });
piaoPingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
piaoPingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
// 设置锚点为左上角,避免偏移干扰
// 获取视图宽度
int viewWidth = piaoPingView.getWidth();
// 设置锚点为左上角
piaoPingView.setPivotX(0);
piaoPingView.setPivotY(0);
// 启动动画:从左外滑入 -> 右外滑出
ObjectAnimator animator = ObjectAnimator.ofFloat(
piaoPingView,
"translationX",
0f, // 初始偏移为 0此时 View 在左侧外)
screenWidth // 向右移动整个屏幕宽度
);
animator.setDuration(2000); // 整个动画的时长为2秒
// 强制 GPU 渲染
piaoPingView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
// 延迟显示2秒后开始滑出屏幕的动画
piaoPingView.postDelayed(new Runnable() {
@Override
public void run() {
animator.start();
}
}, 2000);
// 创建滑入动画:从左外滑入到屏幕左侧
ObjectAnimator slideInAnimator = ObjectAnimator.ofFloat(
piaoPingView,
"translationX",
-viewWidth, // 起始位置:屏幕左外
0f // 结束位置:屏幕左边缘
);
slideInAnimator.setDuration(500); // 滑入动画时长0.5秒
animator.addListener(new AnimatorListenerAdapter() {
// 创建滑出动画:从当前位置滑出到屏幕右侧外
ObjectAnimator slideOutAnimator = ObjectAnimator.ofFloat(
piaoPingView,
"translationX",
0f, // 起始位置:屏幕左边缘
screenWidth // 结束位置:屏幕右外
);
slideOutAnimator.setDuration(500); // 滑出动画时长0.5秒
// 设置滑出动画监听器
slideOutAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
windowManager.removeView(piaoPingView);
stopSelf();
}
});
// 开始执行动画序列
slideInAnimator.start();
// 滑入完成后延迟2秒执行滑出动画
piaoPingView.postDelayed(new Runnable() {
@Override
public void run() {
slideOutAnimator.start();
}
}, 2000);
}
});
}
public void stopSelf(){

View File

@@ -93,7 +93,7 @@ public class SystemUtils {
configUtils.setConfigName(system_uuid_key);
String system_config_uuid = configUtils.findStringByKey(system_uuid_key);
if (system_config_uuid == null) {
system_config_uuid = DeviceUtils.getAndroidID();
// system_config_uuid = DeviceUtils.getUniqueDeviceId();
configUtils.addOrUpdateText(system_uuid_key, system_config_uuid);
}
return system_config_uuid;