update
This commit is contained in:
parent
46fba9429d
commit
efa4c25c4b
@ -186,8 +186,8 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow {
|
||||
tab2.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
list_type = 1;
|
||||
|
||||
((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename1));
|
||||
((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename_value1));
|
||||
((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_user));
|
||||
((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_star));
|
||||
initData();
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(tab2, () -> {
|
||||
@ -356,7 +356,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow {
|
||||
|
||||
private void setTips(String tmp) {
|
||||
btn_one_tips.setText(String.format(Locale.getDefault(), "%s%s%s"
|
||||
, WordUtil.isNewZh() ? "需" : "Need",
|
||||
, WordUtil.isNewZh() ? "需 " : "Need ",
|
||||
tmp,
|
||||
WordUtil.isNewZh() ? "" : ""));
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.yunbao.main.activity;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -62,6 +65,8 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@Route(path = RouteUtil.PATH_ZHUANGBANACTIVITY)
|
||||
@ -76,13 +81,14 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
private SVGAImageView svga;
|
||||
private View v_spacing;
|
||||
private LinearLayout lt_title;
|
||||
|
||||
private List<String> HTTP_SCHEMES = Arrays.asList("http", "https");
|
||||
@Override
|
||||
public void setStatusBar() {
|
||||
// getWindow().setStatusBarColor(Color.parseColor("#FFFFFF"));
|
||||
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
// getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_zhuang_ban;
|
||||
@ -131,6 +137,8 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
copy(content);
|
||||
}
|
||||
} else if (shouldOverrideUrlLoadingInner(view, url)) {
|
||||
return true;
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
}
|
||||
@ -204,7 +212,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
AndroidBug5497Workaround.assistActivity(this);
|
||||
if(!StringUtil.isEmpty(url)&&url.startsWith(HtmlConfig.SHOP)){
|
||||
if (!StringUtil.isEmpty(url) && url.startsWith(HtmlConfig.SHOP)) {
|
||||
lt_title.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
@ -296,16 +304,16 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
public static void forward(Context context, String url, boolean addArgs) {
|
||||
if (addArgs) {
|
||||
if (url.contains("?")) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0");
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0");
|
||||
} else {
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0");
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0");
|
||||
}
|
||||
|
||||
}
|
||||
Intent intent = new Intent(context, ZhuangBanActivity.class);
|
||||
Log.i("tag1212", url);
|
||||
intent.putExtra(Constants.URL, url + "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
if (url.contains("Noble/index.html") || url.contains("Grade/index.html")|| url.contains("Guard/index.html")) {
|
||||
if (url.contains("Noble/index.html") || url.contains("Grade/index.html") || url.contains("Guard/index.html")) {
|
||||
intent.putExtra("title", "");
|
||||
}
|
||||
context.startActivity(intent);
|
||||
@ -404,7 +412,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
@ -413,7 +421,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk), isSw);
|
||||
|
||||
finish();
|
||||
}
|
||||
@ -431,5 +439,84 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the url and open it by system function.
|
||||
* case 1: deal "intent://xxxx" url.
|
||||
* case 2: deal custom scheme. url
|
||||
* @param view: WebView
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private boolean shouldOverrideUrlLoadingInner(WebView view, String url) {
|
||||
if(!TextUtils.isEmpty(url)) {
|
||||
Uri uri = Uri.parse(url);
|
||||
if(uri != null) {
|
||||
if ("intent".equals(uri.getScheme())) {
|
||||
try {
|
||||
Intent intent = Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME);
|
||||
if(intent != null) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
ResolveInfo info = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if(info != null) {
|
||||
mContext.startActivity(Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME));
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
String fallbackUrl = intent.getStringExtra("browser_fallback_url");
|
||||
if (!TextUtils.isEmpty(fallbackUrl)) {
|
||||
if(fallbackUrl.startsWith("market://"))
|
||||
startAppMarketWithUrl(mContext, fallbackUrl, false);
|
||||
else
|
||||
view.loadUrl(fallbackUrl);
|
||||
return true;
|
||||
}else{
|
||||
mContext.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
if (!HTTP_SCHEMES.contains(uri.getScheme())) {
|
||||
startUrl(mContext, url, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void startAppMarketWithUrl(Activity context, String url, boolean forceUseGoogle) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
if (forceUseGoogle || hasActivity(context, intent, "com.android.vending"))
|
||||
intent.setPackage("com.android.vending");
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
startUrl(context, url, true);
|
||||
} catch (Exception e1) {}
|
||||
}
|
||||
}
|
||||
public static boolean hasActivity(Context context, Intent intent, String packageName) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
List<ResolveInfo> appList = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
for (ResolveInfo info : appList) {
|
||||
if (info.activityInfo.packageName.equals(packageName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void startUrl(Context context, String url, boolean isNewTask) {
|
||||
if(context != null && !TextUtils.isEmpty(url)) {
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
if(isNewTask) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class TestWebViewClient extends WebViewClient {
|
||||
Log.d(TAG, "shouldOverrideUrlLoading url1=" + url);
|
||||
if(url.contains("umobile-redirect")) {
|
||||
openByBrowser(mContext, url);
|
||||
|
||||
return true;
|
||||
}
|
||||
if(shouldOverrideUrlLoadingInner(view, url)) {
|
||||
|
Loading…
Reference in New Issue
Block a user