Merge branch 'dev-4.7.0' of git.ghzs.com:halo/assistant-android into dev-4.7.0
This commit is contained in:
@ -14,12 +14,15 @@ import android.os.CountDownTimer;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
@ -49,6 +52,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.dialog.TrackableDialog;
|
||||
import com.gh.common.view.CustomLinkMovementMethod;
|
||||
import com.gh.common.view.DrawableView;
|
||||
import com.gh.common.view.FixLinearLayoutManager;
|
||||
import com.gh.common.view.LimitHeightLinearLayout;
|
||||
@ -1098,9 +1102,20 @@ public class DialogUtils {
|
||||
|
||||
title.setText(entity.getTitle());
|
||||
linkContent.setText(skipText);
|
||||
linkContent.setMovementMethod(new LinkMovementMethod());
|
||||
linkContent.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
topContent.setText(entity.getTopContent());
|
||||
bottomContent.setText(entity.getBottomContent());
|
||||
bottomContent.setText(ExtensionsKt.fromHtml(entity.getBottomContent()));
|
||||
bottomContent.setMovementMethod(CustomLinkMovementMethod.getInstance());
|
||||
|
||||
// Remove underline
|
||||
Spannable sa = (Spannable) bottomContent.getText();
|
||||
for (URLSpan u : sa.getSpans(0, sa.length(), URLSpan.class)) {
|
||||
sa.setSpan(new UnderlineSpan() {
|
||||
public void updateDrawState(TextPaint tp) {
|
||||
tp.setUnderlineText(false);
|
||||
}
|
||||
}, sa.getSpanStart(u), sa.getSpanEnd(u), 0);
|
||||
}
|
||||
|
||||
allowButton.setOnClickListener(view -> {
|
||||
dialog.dismiss();
|
||||
|
||||
@ -1,65 +1,23 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.widget.Toast
|
||||
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.toast.ToastHandler
|
||||
import com.lightgame.utils.toast.ToastHelper
|
||||
|
||||
object ToastUtils {
|
||||
/** 之前显示的内容 */
|
||||
private var mOldMsg: String? = null
|
||||
|
||||
/** Toast对象 */
|
||||
private var mToast: Toast? = null
|
||||
|
||||
/** 第一次时间 */
|
||||
private var mOneTime: Long = 0
|
||||
|
||||
/** 第二次时间 */
|
||||
private var mTwoTime: Long = 0
|
||||
|
||||
/**
|
||||
* 显示Toast
|
||||
* @param message
|
||||
*/
|
||||
fun showToast(message: String) {
|
||||
showToast(message, -1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示Toast
|
||||
* @param message
|
||||
* @param gravity
|
||||
*/
|
||||
fun showToast(message: String, gravity: Int = -1, yOffset: Int = 0) {
|
||||
if (mToast == null) {
|
||||
mToast = ToastHandler.INSTANCE.getToastInstance(HaloApp.getInstance().application, message, Toast.LENGTH_SHORT)
|
||||
if (gravity != -1) mToast!!.setGravity(gravity, 0, yOffset) else
|
||||
mToast!!.setGravity(DisplayUtils.getToastDefaultGravity(), 0, DisplayUtils.getToastOffset())
|
||||
mToast!!.show()
|
||||
mOneTime = System.currentTimeMillis()
|
||||
} else {
|
||||
mTwoTime = System.currentTimeMillis()
|
||||
if (message == mOldMsg) {
|
||||
if (mTwoTime - mOneTime > Toast.LENGTH_SHORT) {
|
||||
if (gravity != -1) mToast!!.setGravity(gravity, 0, yOffset) else
|
||||
mToast!!.setGravity(DisplayUtils.getToastDefaultGravity(), 0, DisplayUtils.getToastOffset())
|
||||
mToast!!.show()
|
||||
}
|
||||
} else {
|
||||
mOldMsg = message
|
||||
mToast!!.setText(message)
|
||||
if (gravity != -1) mToast!!.setGravity(gravity, 0, yOffset) else
|
||||
mToast!!.setGravity(DisplayUtils.getToastDefaultGravity(), 0, DisplayUtils.getToastOffset())
|
||||
mToast!!.show()
|
||||
}
|
||||
}
|
||||
mOneTime = mTwoTime
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun toast(message: String) {
|
||||
if (mToast != null) mToast?.cancel()
|
||||
mToast = ToastHandler.INSTANCE.getToastInstance(HaloApp.getInstance().application, message, Toast.LENGTH_SHORT)
|
||||
mToast?.show()
|
||||
showToast(message)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showToast(message: String) {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showToast(message: String, gravity: Int = -1, yOffset: Int = 0) {
|
||||
ToastHelper.showToast(HaloApp.getInstance(), message, gravity, yOffset)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -344,7 +344,6 @@ public class MainActivity extends BaseActivity {
|
||||
|| AdHelper.startupAd.getValue() == null) {
|
||||
showAd = false;
|
||||
getIntent().putExtra(SHOW_AD, false);
|
||||
findViewById(R.id.layout_activity_content).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.maskContainer).setVisibility(View.GONE);
|
||||
mMainWrapperFragment.getWelcomeDialog();
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
if (shouldRequestPermission) {
|
||||
requestPermission();
|
||||
} else {
|
||||
launchMainActivity();
|
||||
mStartMainActivityDirectly = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -17,7 +17,7 @@ data class PrivacyPolicyEntity(
|
||||
val data = PrivacyPolicyEntity()
|
||||
data.title = "欢迎来到光环助手"
|
||||
data.topContent = "为提供完整的功能与稳定的服务,光环助手将向你申请开启以下权限:"
|
||||
data.bottomContent = "你可以在系统设置中关闭授权,但可能会影响部分功能的正常使用"
|
||||
data.bottomContent = "点击<a href=\"https://resource.ghzs.com/page/permissions/android.html\">查看权限应用场景</a>,你可以在系统设置中关闭授权,但可能会影响部分功能的正常使用"
|
||||
val permissions = arrayListOf<PermissionsEntity>()
|
||||
permissions.add(PermissionsEntity(
|
||||
icon = "res:///" + R.drawable.permission_storage,
|
||||
|
||||
@ -54,8 +54,6 @@ public class MyConcernRecommendAdapter extends BaseRecyclerAdapter<ConcernViewHo
|
||||
private List<GameEntity> mRecommendGameList;
|
||||
private List<GameEntity> mConcernGameList;
|
||||
|
||||
private Toast mToast;
|
||||
|
||||
private String mEntrance;
|
||||
|
||||
public MyConcernRecommendAdapter(Context context, OnRequestCallBackListener listener, List<GameEntity> concernGame, String entrance) {
|
||||
@ -195,11 +193,7 @@ public class MyConcernRecommendAdapter extends BaseRecyclerAdapter<ConcernViewHo
|
||||
DataCollectionUtils.uploadConcern(mContext,
|
||||
gameEntity.getName(), gameEntity.getId(), mContext.getString(R.string.concern));
|
||||
|
||||
if (mToast != null) {
|
||||
mToast.cancel();
|
||||
}
|
||||
mToast = Toast.makeText(mContext, R.string.concern_success, Toast.LENGTH_SHORT);
|
||||
mToast.show();
|
||||
Utils.toast(mContext, R.string.concern_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user