| | |
| | | import android.content.pm.ActivityInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.ColorMatrix; |
| | | import android.graphics.ColorMatrixColorFilter; |
| | | import android.graphics.Paint; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.net.Uri; |
| | | import android.os.AsyncTask; |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.provider.Settings; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | import android.telephony.TelephonyManager; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.lcjian.library.dialog.DialogUtil; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.lcjian.library.util.ScreenUtils; |
| | | import com.lcjian.library.util.common.BitmapUtils; |
| | | import com.lcjian.library.util.common.DrawableUtils; |
| | |
| | | import com.weikou.beibeivideo.util.ad.AdUtil; |
| | | import com.weikou.beibeivideo.util.ad.CSJConstant; |
| | | import com.weikou.beibeivideo.util.ad.GDTConstant; |
| | | import com.weikou.beibeivideo.util.ad.KSConstant; |
| | | import com.weikou.beibeivideo.util.ad.manager.gm.GMAdSplashManager; |
| | | import com.weikou.beibeivideo.util.ui.AiDaoUtil; |
| | | import com.weikou.beibeivideo.util.ui.TopStatusSettings; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | import static android.content.pm.PackageManager.PERMISSION_DENIED; |
| | | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
| | | |
| | | public class SplashActivity extends BaseActivity { |
| | | public class SplashActivity extends FragmentActivity { |
| | | |
| | | boolean isInput = false; |
| | | |
| | |
| | | private ImageView iv_bg; |
| | | |
| | | private TextView ad_close_time; |
| | | private Dialog pdialog; |
| | | |
| | | private static String TAG = "SplashActivity"; |
| | | |
| | |
| | | }; |
| | | private static final int REQUEST_CODE = 0; // 请求码 |
| | | private PermissionsChecker mPermissionsChecker; // 权限检测器 |
| | | |
| | | private GMAdSplashManager mGMAdSplashManager; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | setContentView(R.layout.activity_splash); |
| | | TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | |
| | | if (ConfigUtil.isAiDaoMode(this)) { |
| | | AiDaoUtil.setAiDaoMode(this); |
| | | } |
| | | |
| | | vg_ad = findViewById(R.id.fl_splash_ad); |
| | | vg_input = findViewById(R.id.fl_input); |
| | | ad_close_time = findViewById(R.id.ad_close_time); |
| | | iv_bg = findViewById(R.id.iv_bg); |
| | | |
| | | SharedPreferences preferences = getSharedPreferences("link_page", |
| | | Context.MODE_PRIVATE); |
| | | isInput = preferences.getBoolean("isInput", false); |
| | | |
| | | mPermissionsChecker = new PermissionsChecker(this); |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(this); |
| | | |
| | | |
| | | showProtocol(); |
| | | //设置背景图片 |
| | |
| | | iv_bg.setImageBitmap(bitmap1); |
| | | } |
| | | |
| | | private void init() { |
| | | SharedPreferences preferences = getSharedPreferences("link_page", |
| | | Context.MODE_PRIVATE); |
| | | isInput = preferences.getBoolean("isInput", false); |
| | | |
| | | mPermissionsChecker = new PermissionsChecker(this); |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(this); |
| | | myRequetPermission(); |
| | | } |
| | | |
| | | private void showProtocol() { |
| | | String data = "尊敬的用户:<br>感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | |
| | | data += String.format("<a href='%s'>《隐私政策》</a>和", BeibeiConstant.PRIVACY_POLICY); |
| | | data += String.format("<a href='%s'>《用户协议》</a>", BeibeiConstant.USER_AGREEMENT); |
| | | data += "内的所有条款,<b>尤其是:<br>" + |
| | | "1、我们对您的个人信息(包括但不限于<font color='#FF0000'>设备MAC地址、IMEI/Android ID</font>等信息)的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;<br>" + |
| | | "1、)为识别您的设备,并预防恶意程序及反作弊、提高服务安全性、保障运营质量及效率,我们会收集您" + |
| | | "的设备信息(包括<font color='#FF0000'>IMEI、设备序列号、OAID、MEID、Android ID、IMSI、GUID、MAC地址、SIM卡序列号</font> )、<font color='#FF0000'>已安装APP信息</font>或运行中的进程信息<br>" + |
| | | "2、约定我们的限制责任、免责条款;<br>" + |
| | | "3、其他以加粗或斜体字进行标识的重要条款。</b><br>" + |
| | | "如您对协议有任何疑虑,可通过电子邮箱: yesbd@qq.com 向我们询问,我们将为您竭诚解答。您点击“同意并继续”的行为代表您已阅读完毕并接受以上协议全部条款。如您同意以上协议内容,请您点击“同意并继续”,开始使用您的产品。"; |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(BeibeiVideoApplication.application) && !BeibeiConstant.IS_TEST) { |
| | | Dialog dialog = new UserProtocolDialog.Builder(this).setNegativeButton("不同意", new DialogInterface.OnClickListener() { |
| | | pdialog = new UserProtocolDialog.Builder(this).setNegativeButton("不同意", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | SplashActivity.this.finish(); |
| | | DialogUtil.dismiss(pdialog); |
| | | AlertDialog alertDialog = new AlertDialog.Builder(SplashActivity.this).setTitle("温馨提示").setMessage("我们非常重视对您个人信息的保护,承诺严格按照"+ getResources().getString(R.string.app_name) +"隐私权政策保护及处理您的信息,如不同意该政策,很遗憾我们将无法提供服务").setNegativeButton("退出应用", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | SplashActivity.this.finish(); |
| | | } |
| | | }).setPositiveButton("再次查看", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog_, int which) { |
| | | DialogUtil.show(pdialog); |
| | | } |
| | | }).create(); |
| | | alertDialog.setCanceledOnTouchOutside(false); |
| | | alertDialog.show(); |
| | | } |
| | | }).setPositiveButton("同意并继续", new DialogInterface.OnClickListener() { |
| | | @Override |
| | |
| | | @Override |
| | | public void run() { |
| | | |
| | | new PermissionAuthNotifyDialog.Builder(SplashActivity.this).setPositiveButton(null, new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialogInterface, int i) { |
| | | dialogInterface.dismiss(); |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); |
| | | Build bd = new Build(); |
| | | String model = bd.MODEL; |
| | | BeibeiVideoApplication.deviceName = model; |
| | | BeibeiVideoApplication.deviceNumber = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | } |
| | | //初始化 |
| | | BeibeiVideoApplication.init(BeibeiVideoApplication.application); |
| | | myRequetPermission(); |
| | | } |
| | | }).create().show(); |
| | | |
| | | |
| | | // new PermissionAuthNotifyDialog.Builder(SplashActivity.this).setPositiveButton(null, new DialogInterface.OnClickListener() { |
| | | // @Override |
| | | // public void onClick(DialogInterface dialogInterface, int i) { |
| | | // dialogInterface.dismiss(); |
| | | // init(); |
| | | // } |
| | | // }).create().show(); |
| | | init(); |
| | | } |
| | | }); |
| | | } |
| | | }).setData(data).create(); |
| | | |
| | | if (!isFinishing()) { |
| | | DialogUtil.show(dialog); |
| | | DialogUtil.show(pdialog); |
| | | } |
| | | |
| | | } else { |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); |
| | | Build bd = new Build(); |
| | | String model = bd.MODEL; |
| | | BeibeiVideoApplication.deviceName = model; |
| | | BeibeiVideoApplication.deviceNumber = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | } |
| | | //请求权限 |
| | | vg_ad.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | myRequetPermission(); |
| | | init(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | |
| | | BeibeiVideoAPI.getUid(this, channel, BeibeiVideoAPI.getDeviceId(this), preferences.getString("imei", ""), |
| | | preferences.getString("mac", ""), "", "", |
| | | "", "", |
| | | new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | |
| | | super.onPause(); |
| | | } |
| | | |
| | | |
| | | private String getDay(long time) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String date = format.format(new Date(time)); |
| | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | if (mGMAdSplashManager != null) { |
| | | // mGMAdSplashManager.destroy(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | private SplashADFragment splashADFragment; |
| | | |
| | | private void loadSplashAd(AdUtil.AD_TYPE adType, String pid) { |
| | | |
| | | AdPidInfo adPidInfo2 = null; |
| | | if (adType == AdUtil.AD_TYPE.gdt) { |
| | | adPidInfo2 = new AdPidInfo(AdUtil.AD_TYPE.csj, CSJConstant.SPLASH_AD); |
| | |
| | | } |
| | | |
| | | private void myRequetPermission() { |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED) { |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | //是否需要再次请求权限 |
| | | if (sharedPreferences.getBoolean("show", true)) |
| | | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_CODE); |
| | | else |
| | | next(); |
| | | } else { |
| | | next(); |
| | | } |
| | | // final String channel = ManifestDataUtil.getAppMetaData(getApplicationContext(), "UMENG_CHANNEL"); |
| | | // // 小米不弹出权限申请框 |
| | | // if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED && !"xiaomi".equalsIgnoreCase(channel)) { |
| | | // SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | // //是否需要再次请求权限 |
| | | // if (sharedPreferences.getBoolean("show", true)) { |
| | | // if ("huawei".equalsIgnoreCase(channel)) { |
| | | // next(); |
| | | // } else { |
| | | // ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_CODE); |
| | | // iv_bg.post(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // findViewById(R.id.ll_authority_notify).setVisibility(View.VISIBLE); |
| | | // } |
| | | // }); |
| | | // } |
| | | // } else { |
| | | // next(); |
| | | // } |
| | | // } else { |
| | | // next(); |
| | | // } |
| | | next(); |
| | | } |
| | | |
| | | private void next() { |
| | | //百度内容联盟 |
| | | // MobadsPermissionSettings.setPermissionReadDeviceID(true); |
| | | iv_bg.post(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | findViewById(R.id.ll_authority_notify).setVisibility(View.GONE); |
| | | } |
| | | }); |
| | | |
| | | if (!BeibeiVideoApplication.IsInited()) { |
| | | BeibeiVideoApplication.init(BeibeiVideoApplication.application, new BeibeiVideoApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | nextStep(); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } else |
| | | nextStep(); |
| | | } |
| | | |
| | | private void nextStep() { |
| | | |
| | | getUid(); |
| | | vg_ad.postDelayed(new Runnable() { |
| | | |
| | |
| | | //保存购买记录 |
| | | ConfigUtil.saveBuyRecordUrl(getApplicationContext(), data.optString("buyRecordUrl")); |
| | | |
| | | //是否正在上线 |
| | | ConfigUtil.saveOnLining(getApplicationContext(), data.optBoolean("onLining")); |
| | | |
| | | // 设置哀悼模式 |
| | | ConfigUtil.saveAiDaoMode(getApplicationContext(), data.optBoolean("aiDaoMode")); |
| | | |
| | | |
| | | //保存免广告权益持续时间 |
| | | AdUtil.setPPTVNoAdRewardHour(getApplicationContext(), pptvNoAdRewardHour); |
| | | |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | AdUtil.AD_TYPE splash = AdUtil.getAdType(getApplicationContext(), AdPositionEnum.splash); |
| | | //是否在上线 |
| | | if (AdUtil.getAdType(getApplicationContext(), AdPositionEnum.splashHotStart) == null) { |
| | | KSConstant.PID_FEED = 8010000022L; |
| | | KSConstant.PID_FULL_VIDEO = 8010000015L; |
| | | KSConstant.PID_SHORT_VIDEO = 8010000036L; |
| | | //广告下载二次确认框 |
| | | } |
| | | |
| | | |
| | | String pid = AdUtil.getAdPid(getApplicationContext(), AdPositionEnum.splash); |
| | | if (StringUtils.isBlank(pid)) { |
| | | if (splash != null) { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | Dialog mDialog; |
| | | AlertDialog alertDialog; |
| | | |
| | |
| | | if (requestCode == REQUEST_CODE) { |
| | | for (int i = 0; i < permissions.length; i++) { |
| | | if (grantResults[i] == PERMISSION_GRANTED) {//选择了“始终允许” |
| | | myRequetPermission(); |
| | | |
| | | init(); |
| | | } else { |
| | | //拒绝了授权 |
| | | if (grantResults[i] == PERMISSION_DENIED) { |
| | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | if (requestCode == REQUEST_CODE) { |
| | | myRequetPermission();//由于不知道是否选择了允许所以需要再次判断 |
| | | } |
| | | } |
| | | |
| | | |