admin
2020-08-12 cefe2a41db4a275fb1e940a902cb156f1ed68d80
BuWanVideo/src/com/weikou/beibeivideo/ui/SplashActivity.java
@@ -14,9 +14,10 @@
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.lcjian.library.DeviceUuidFactory;
import com.google.gson.Gson;
import com.lcjian.library.util.common.StringUtils;
import com.qq.e.ads.splash.SplashAD;
import com.qq.e.ads.splash.SplashADListener;
@@ -26,6 +27,7 @@
import com.weikou.beibeivideo.BasicTextHttpResponseHandler;
import com.weikou.beibeivideo.BeibeiVideoAPI;
import com.weikou.beibeivideo.BeibeiVideoApplication;
import com.weikou.beibeivideo.entity.ad.AdTypeVO;
import com.weikou.beibeivideo.ui.main.MainActivity;
import com.weikou.beibeivideo.util.BeibeiConstant;
import com.weikou.beibeivideo.util.PermissionHintDialog;
@@ -65,8 +67,26 @@
            return;
        }
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.activity_splash);
        /*
         * 计算状态栏高度并设置
         */
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            int result = 0;
            int resourceId = getResources().getIdentifier("status_bar_height",
                    "dimen", "android");
            if (resourceId > 0) {
                result = getResources().getDimensionPixelSize(resourceId);
            }
            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    result);
            findViewById(R.id.v_status_bar).setLayoutParams(params);
        } else {
            findViewById(R.id.v_status_bar).setVisibility(View.GONE);
        }
        vg_ad = (ViewGroup) findViewById(R.id.fl_splash_ad);
        vg_input = (ViewGroup) findViewById(R.id.fl_input);
        ad_close_time = (TextView) findViewById(R.id.ad_close_time);
@@ -97,14 +117,14 @@
        super.onResume();
        MobclickAgent.onPageStart("欢迎页");
        if (mPermissionsChecker.lacksPermissions(PERMISSIONS)) {
            PermissionHintDialog.Builder builder = new PermissionHintDialog.Builder(this);
            builder.setMessage("为保障正常使用相关功能,请允许影视大全获取相关基础权限").setPositiveButton("我知道啦", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
//            PermissionHintDialog.Builder builder = new PermissionHintDialog.Builder(this);
//            builder.setMessage("为保障正常使用相关功能,请允许影视大全获取相关基础权限").setPositiveButton("我知道啦", new DialogInterface.OnClickListener() {
//                @Override
//                public void onClick(DialogInterface dialogInterface, int i) {
                    startPermissionsActivity();
                    dialogInterface.dismiss();
                }
            }).create().show();
//                    dialogInterface.dismiss();
//                }
//            }).create().show();
        } else {
            getUid();
            new WebView(this);
@@ -115,7 +135,7 @@
                    if (!BeibeiConstant.AD_SETTING_KAIPIN)
                        toMainActivity();
                    new SplashAD(SplashActivity.this, vg_input, BeibeiConstant.GDT_ID, BeibeiConstant.GDT_SPLASH_POSITION_ID_HUAWEI, new SplashADListener() {
                    new SplashAD(SplashActivity.this, vg_input, BeibeiConstant.GDT_SPLASH_POSITION_ID_HUAWEI2, new SplashADListener() {
                        @Override
                        public void onADDismissed() {
                            runOnUiThread(new Runnable() {
@@ -128,6 +148,7 @@
                        @Override
                        public void onNoAD(AdError adError) {
                            final String msg=adError.getErrorMsg();
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
@@ -182,7 +203,6 @@
    }
    private void getUid() {
        final SharedPreferences preferences = getSharedPreferences("user",
                Context.MODE_PRIVATE);
@@ -194,7 +214,7 @@
        }
        BeibeiVideoAPI.getUid(this, channel,BeibeiVideoAPI.getDeviceId(this), preferences.getString("imei", ""),
        BeibeiVideoAPI.getUid(this, channel, BeibeiVideoAPI.getDeviceId(this), preferences.getString("imei", ""),
                preferences.getString("mac", ""), "", "",
                new BasicTextHttpResponseHandler() {
@@ -203,60 +223,51 @@
                                                 Header[] headers, JSONObject jsonObject)
                            throws Exception {
                        if (jsonObject.getBoolean("IsPost")) {
//                            String copyplate = jsonObject.getJSONObject("Data")
//                                    .optString("copyplate");
//
//                            if (!StringUtils.isEmpty(copyplate)) {
//                                ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
//                                clipboardManager.setPrimaryClip(ClipData.newPlainText("copyplate", copyplate));
//                                Toast.makeText(MainActivity.this, clipboardManager.getPrimaryClip().getItemAt(0).getText(), Toast.LENGTH_SHORT).show();
//                            }
                            String pptvso1 = jsonObject.getJSONObject("Data").optJSONArray("PPTVSO").optString(0);
                            String pptvso2 = jsonObject.getJSONObject("Data").optJSONArray("PPTVSO").optString(1);
                            JSONObject data = jsonObject.getJSONObject("Data");
                            String pptvso1 = data.optJSONArray("PPTVSO").optString(0);
                            String pptvso2 = data.optJSONArray("PPTVSO").optString(1);
                            preferences.edit()
                                    .putString(
                                            "uid",
                                            jsonObject.getJSONObject("Data")
                                            "uid", data
                                                    .optString("Uid"))
                                    .putString("pptvso1", pptvso1)
                                    .putString("pptvso2", pptvso2)
                                    .putString("COMMENT_ALERT", jsonObject.getJSONObject("Data")
                                    .putString("COMMENT_ALERT", data
                                            .optString("COMMENT_ALERT"))
                                    .putInt("ShowAd", Integer.parseInt(jsonObject.getJSONObject("Data")
                                    .putInt("ShowAd", Integer.parseInt(data
                                            .optString("ShowAd")))
                                    .putString(
                                            "share_url",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("ShareUrl"))
                                    .putString(
                                            "shopurl",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("shopurl"))
                                    .putString(
                                            "share_content",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("ShareContent"))
                                    .putString(
                                            "share_url_wechat",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("WXShareUrl"))
                                    .putString(
                                            "share_content_wechat",
                                            jsonObject
                                                    .getJSONObject("Data")
                                            data
                                                    .optString("WXShareContent"))
                                    .putString(
                                            "show_more_app",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("ShowMoreApp"))
                                    .putString(
                                            "evalueate",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("evalueate"))
                                    .putString(
                                            "share_image_wechat",
                                            jsonObject.getJSONObject("Data")
                                            data
                                                    .optString("WXShareIcon"))
//                                    .putString(
//                                            "show_ad",
@@ -264,23 +275,22 @@
//                                                    .optString("ShowAd"))
                                    .putString(
                                            "tuiguang_add",
                                            jsonObject.optJSONObject("Data")
                                            data
                                                    .optString("TuiGuang"))
                                    .putString(
                                            "top_icon",
                                            jsonObject.optJSONObject("Data")
                                            data
                                                    .optString("TopIcon"))
                                    .putString(
                                            "zixun",
                                            jsonObject.optJSONObject("Data")
                                            data
                                                    .optString("ZiXun"))
                                    .commit();
                            BeibeiVideoAPI.ERROR_NOTICE = jsonObject
                                    .getJSONObject("Data").optString(
                                            "NoticeContent");
                            BeibeiVideoAPI.ERROR_NOTICE = data.optString(
                                    "NoticeContent");
                            BeibeiConstant.AD_CLICK_DOWNLOAD = jsonObject.optJSONObject("Data")
                            BeibeiConstant.AD_CLICK_DOWNLOAD = data
                                    .optBoolean("adClickDownload");
                            if (BeibeiConstant.AD_CLICK_DOWNLOAD) {
                                BeibeiConstant.GDT_RECOMMAND_MIN_NATIVE = BeibeiConstant.GDT_DOWNLOAD_HINT_ID;
@@ -297,7 +307,16 @@
                                BeibeiConstant.GDT_CATEGORY_BANNER = BeibeiConstant.GDT_DOWNLOAD_HINT_ID;
                            }
                            new AddAliasTask(jsonObject.getJSONObject("Data")
                            //获取广告
                            String adType = data.optString("adType");
                            if (!com.weikou.beibeivideo.util.downutil.StringUtils.isNullOrEmpty(adType)) {
                                AdTypeVO ad = new Gson().fromJson(adType, AdTypeVO.class);
                                if (ad != null)
                                    BeibeiConstant.AD_TYPE = ad;
                            }
                            new AddAliasTask(data
                                    .getString("Uid"), "WEIKOU");
                            SharedPreferences preferences1 = getSharedPreferences("user",
                                    Context.MODE_PRIVATE);