| | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.yeshi.makemoney.video.R; |
| | | import com.yeshi.makemoney.video.app.entity.eventbus.UpdateConfig; |
| | | 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.yeshi.makemoney.video.app.utils.api.HttpApiUtil; |
| | | import com.yeshi.makemoney.video.app.utils.ui.JumpPageUtil; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | |
| | | super.onCreate(); |
| | | application = this; |
| | | MultiDex.install(this); |
| | | if (UserUtil.isAgreeUserProtocol(application) || Constant.DEBUG) { |
| | | init(application, null); |
| | | } |
| | | // if (UserUtil.isAgreeUserProtocol(application) || Constant.DEBUG) { |
| | | // init(application, new InitListener() { |
| | | // @Override |
| | | // public void onFinish() { |
| | | // SettingUtil.initSettings(getApplicationContext()); |
| | | // } |
| | | // }); |
| | | // } |
| | | } |
| | | |
| | | public static void init(Application application, InitListener initListener) { |
| | | if (inited) { |
| | | if(initListener!=null) { |
| | | initListener.onFinish(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | initListener.onFinish(); |
| | | } |
| | | }); |
| | | } else { |
| | | initListener.onFinish(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return HttpApiUtil.getRequestParams(application.getApplicationContext(), ps); |
| | | } |
| | | |
| | | @Override |
| | | public String getConfig(String key) { |
| | | AppConfigUtil.ConfigKey configKey = null; |
| | | try { |
| | | configKey = AppConfigUtil.ConfigKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (configKey == null) { |
| | | EventBus.getDefault().post(new UpdateConfig()); |
| | | return null; |
| | | } |
| | | return AppConfigUtil.getConfig(configKey, application); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean getSetting(String key) { |
| | | SettingUtil.SettingKey settingKey = null; |
| | | try { |
| | | settingKey = SettingUtil.SettingKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (settingKey == null) { |
| | | return null; |
| | | } |
| | | return SettingUtil.getSetting(settingKey, application); |
| | | } |
| | | |
| | | @Override |
| | | public void setSetting(String key, boolean b) { |
| | | |
| | | SettingUtil.SettingKey settingKey = null; |
| | | try { |
| | | settingKey = SettingUtil.SettingKey.valueOf(key); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (settingKey == null) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | SettingUtil.saveSetting(settingKey, b, application); |
| | | } |
| | | }); |
| | | //UI接口 |
| | | new UIMethodChannel(engine.getDartExecutor().getBinaryMessenger(), application.getApplicationContext(), new UIMethodChannel.DataListener() { |