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, () -> {
|
||||
|
@ -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);
|
||||
}
|
||||
@ -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