@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppUtils.switchLanguage(getApplicationContext()); exitWithUserOption = false; EventBus.getDefault().register(this); initSlidingMenu(); setContentView(R.layout.activity_main); Trace.e(tag, getString(R.string.lang)); fMgr = getSupportFragmentManager(); imageLoader = BaseApplication.getImageLoader(this); options = new DisplayImageOptions.Builder() .bitmapConfig(Bitmap.Config.RGB_565) .showStubImage(R.drawable.tab_center_normal) .showImageForEmptyUri(R.drawable.tab_center_normal) .showImageOnFail(R.drawable.tab_center_normal) .cacheInMemory(true) .cacheOnDisc(true) .build(); if (AppUtils.isLogin(this)) majorTeamGsonModel = AppSharePreferences.getMajorTeam(this); mTitleView = (TitleView) findViewById(R.id.titlebar_layout); mTitleView.initTitleBar(null, 0, 0); mTitleView.setRightMenuButton(); mTitleView.setTitleViewListener(mTitleViewListener); dealBottomButtonsClickEvent(); initFragment(savedInstanceState); if (majorTeamGsonModel != null && !TextUtils.isEmpty(majorTeamGsonModel.avatar)) { File file = DiskCacheUtils.findInCache(majorTeamGsonModel.avatar, imageLoader.getDiskCache()); if (file == null || !file.exists()) { imageLoader.displayImage(majorTeamGsonModel.avatar, majorImageView, options); } else { majorImageView.setImageBitmap(BitmapFactory.decodeFile(file.getAbsolutePath())); } } else { if (AppSharePreferences.getFollowFlag(getApplicationContext())) { majorImageView.setImageResource(R.drawable.tab_center_notset_normal); } else { majorImageView.setImageResource(R.drawable.tab_center_normal); } } mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); AppService.startCheckVersion(this, false); mDownloadReceiver = new DownloadCompleteReceiver(); registerReceiver(mDownloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); FeedbackAgent agent = new FeedbackAgent(this); agent.sync(); /* * if * (AppSharePreferences.getDefault().getBoolean("MAIN_TOURNAMENT_GUIDE", * true)) { startActivity(new Intent(MainActivity.this, * GuideActivity.class)); } */ }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override protected void onResume() { super.onResume(); MobclickAgent.onResume(this); AppService.onNewsResume(); if (mWakeLock == null) mWakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)) .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getSimpleName()); try { if (!mWakeLock.isHeld()) mWakeLock.acquire(); } catch (Exception e) { Trace.d(tag, e.getMessage()); } }