| | |
| | | import com.yeshi.makemoney.video.app.ui.dialog.UserProtocolDialog; |
| | | import com.yeshi.makemoney.video.app.utils.AppConfigUtil; |
| | | import com.yeshi.makemoney.video.app.utils.Constant; |
| | | import com.yeshi.makemoney.video.app.utils.SettingUtil; |
| | | import com.yeshi.makemoney.video.app.utils.UserUtil; |
| | | import com.demo.library_ad.AdUtil; |
| | | import com.demo.library_ad.SplashAdUtil; |
| | |
| | | import androidx.appcompat.app.AppCompatActivity; |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | |
| | | import com.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | | import com.yeshi.makemoney.video.app.utils.api.BasicTextHttpResponseHandler; |
| | | |
| | | import java.util.Iterator; |
| | | |
| | | import static android.content.pm.PackageManager.PERMISSION_DENIED; |
| | | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
| | |
| | | MyApplication.init(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | toMainActivity(); |
| | | } |
| | | }); |
| | | |
| | | // if (1 > 0) { |
| | | // vg_ad.postDelayed(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // toMainActivity(); |
| | | // } |
| | | // },3000); |
| | | // |
| | | // return; |
| | | // } |
| | | |
| | | |
| | | int delayMs = 1; |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HttpApiUtil.getConfig(getApplicationContext(), new BasicTextHttpResponseHandler() { |
| | | |
| | | SettingUtil.initSettings(getApplicationContext()); |
| | | int delayMs = 1; |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getBoolean("IsPost")) { |
| | | JSONObject data = jsonObject.getJSONObject("Data"); |
| | | JSONObject ad = data.optJSONObject("adNew"); |
| | | //浏览器外跳协议 |
| | | AppConfigUtil.saveBrowserJumpOutProtocolPrefix(getApplicationContext(), data.optString("jumpAppProtocolPrefix")); |
| | | //保存联系客服,注销链接 |
| | | AppConfigUtil.saveConcatUsLink(getApplicationContext(), data.optString("contactUsLink")); |
| | | AppConfigUtil.saveUnRegisterLink(getApplicationContext(), data.optString("unRegisterLink")); |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | MyApplication.initAd(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | public void run() { |
| | | HttpApiUtil.getConfig(getApplicationContext(), new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getInt("code") == 0) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | JSONObject ad = data.optJSONObject("ad"); |
| | | for (Iterator<String> its = data.keys(); its.hasNext(); ) { |
| | | String key = its.next(); |
| | | AppConfigUtil.ConfigKey configKey = null; |
| | | try { |
| | | configKey = AppConfigUtil.ConfigKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (configKey != null) { |
| | | //保存配置文件 |
| | | AppConfigUtil.saveConfig(configKey, data.optString(configKey.name()), getApplicationContext()); |
| | | } |
| | | } |
| | | //保存广告配置 |
| | | AdUtil.saveAdConfig(getApplicationContext(), ad); |
| | | MyApplication.initAd(MyApplication.application, new MyApplication.InitListener() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | public void onFinish() { |
| | | runOnUiThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | return; |
| | | } else { |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | return; |
| | | } else { |
| | | loadSplashAd(); |
| | | } |
| | | } |
| | | } |
| | | loadSplashAd(); |
| | | |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) { |
| | | super.onFailure(statusCode, headers, responseString, throwable); |
| | | loadSplashAd(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | }, delayMs); |
| | | } |
| | | }, delayMs); |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | private void loadSplashAd() { |
| | | |
| | | AdUtil.AD_TYPE splashType = AdUtil.getAdType(getApplicationContext(), ""); |
| | | AdUtil.AD_TYPE splashType = AdUtil.getAdType(getApplicationContext(), "splashAd"); |
| | | if (splashType == null) { |
| | | vg_ad.postDelayed(new Runnable() { |
| | | @Override |