| | |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.fragment.app.FragmentActivity; |
| | | |
| | | 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; |
| | | |
| | |
| | | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| | | setContentView(R.layout.activity_splash); |
| | | |
| | | StatusBarUtil.init(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); |
| | |
| | | SharedPreferences preferences = getSharedPreferences("link_page", |
| | | Context.MODE_PRIVATE); |
| | | isInput = preferences.getBoolean("isInput", false); |
| | | try { |
| | | TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); |
| | | Build bd = new Build(); |
| | | String model = Build.MODEL; |
| | | HanJuApplication.deviceName = model; |
| | | HanJuApplication.deviceNumber = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | mPermissionsChecker = new PermissionsChecker(this); |
| | | // 初始化大设备 |
| | | SDCardUtil.initStorage(this); |
| | | //初始化一次Banner,否则后面Banner使用时会出现卡顿 |
| | | // new BannerView(SplashActivity.this, ADSize.BANNER, HanJuConstant.GDT_ID, HanJuConstant.GDT_PLAYER_DETAIL); |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())&&!HanJuConstant.DEBUG) { |
| | | showProtocol(); |
| | | } else { |
| | | vg_ad.post(new Runnable() { |
| | |
| | | |
| | | |
| | | private void showProtocol() { |
| | | String data = "感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们依照新的监管要求条例更新了"; |
| | | String data = "尊敬的用户:<br>感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们非常尊重并保护您的个人信息、隐私。为了更好的保障您的权利,在您使用我们的产品之前,请您务必审慎阅读"; |
| | | data += String.format("<a href='%s'>《隐私政策》</a>和", HanJuConstant.PRIVACY_POLICY); |
| | | data += String.format("<a href='%s'>《用户协议》</a>", HanJuConstant.USER_AGREEMENT); |
| | | data += "为采取相应安全保护措施,尽力保护您的个人信息安全可控,特向你说明如下:<br>" + |
| | | "1、您在使用" + getResources().getString(R.string.app_name) + "各项产品或服务时,将会提供与具体功能相关的个人信息(可能涉及帐号、位置、存储等信息)。<br>" + |
| | | "2、您可以随时查询、更正、删除您的个人信息,我们也提供账户注销的渠道。<br>" + |
| | | "3、未经您的再次同意,我们不会将上述信息用于您未授权的其他用途或目的。<br>" + |
| | | "4、未经监护人同意,我们不会收集使用14周岁以下(含14周岁)未成年人个人信息,且不会利用其信息推送新闻、时政信息、广告等定向推送活动。"; |
| | | data += "内的所有条款,<b>尤其是:<br>" + |
| | | "1、我们对您的个人信息(包括但不限于<font color='#FF0000'>设备MAC地址、IMEI/Android ID</font>等信息)的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;<br>" + |
| | | "2、约定我们的限制责任、免责条款;<br>" + |
| | | "3、其他以加粗或斜体字进行标识的重要条款。</b><br>" + |
| | | "如您对协议有任何疑虑,可通过电子邮箱: xcwapp@qq.com 向我们询问,我们将为您竭诚解答。您点击“同意”的行为代表您已阅读完毕并接受以上协议全部条款。如您同意以上协议内容,请您点击“同意”,开始使用您的产品。"; |
| | | |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | if (!UserUtil.isAgreeUserProtocol(getApplicationContext()) && !HanJuConstant.DEBUG) { |
| | | new UserProtocolDialog.Builder(SplashActivity.this).setNegativeButton("不同意", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | UserUtil.agreeUserProtocol(getApplicationContext()); |
| | | HanJuApplication.init(HanJuApplication.application); |
| | | myRequetPermission(); |
| | | } |
| | | }).setData(data).create().show(); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("欢迎页"); |
| | | } |
| | | |
| | | private void getUid() { |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("欢迎页"); |
| | | } |
| | | |
| | | private String getDay(long time) { |
| | |
| | | }, 2000); |
| | | return; |
| | | } |
| | | |
| | | |
| | | SplashAdUtil.loadAD(splashType, SplashActivity.this, vg_input, vg_ad, ad_close_time, new SplashAdUtil.SplashAdListener() { |
| | | @Override |
| | |
| | | }); |
| | | } |
| | | |
| | | int delayMs = 1000; |
| | | |
| | | private void myRequetPermission() { |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | boolean showPermission = sharedPreferences.getBoolean("show", true); |
| | |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED && showPermission) { |
| | | ActivityCompat.requestPermissions(this, PERMISSIONS, REQUEST_CODE); |
| | | } else { |
| | | if (!HanJuApplication.inited) { |
| | | HanJuApplication.init(HanJuApplication.application, new HanJuApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | |
| | | } |
| | | }); |
| | | delayMs = 1; |
| | | } |
| | | getUid(); |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | |
| | | AppConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | AppConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | HanJuApplication.initAd(HanJuApplication.application, gdtAppId, csjAppId, new HanJuApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | loadSplashAd(); |
| | |
| | | |
| | | |
| | | } |
| | | }, 1000); |
| | | }, delayMs); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | Dialog mDialog; |
| | | AlertDialog alertDialog; |
| | | |
| | | @Override |
| | | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
| | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | // if (requestCode == REQUEST_CODE) { |
| | | // myRequetPermission();//由于不知道是否选择了允许所以需要再次判断 |
| | | // } |
| | | } |
| | | |
| | | |