Example #1
0
  @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)); }
     */

  }
Example #2
0
  @Override
  protected void onDestroy() {
    Trace.e("MainActivity", "onDestroy");
    EventBus.getDefault().unregister(this);
    BaseApplication.setMainActivityState(BaseApplication.FLAG_MAIN_STATE_NOMAL);

    unregisterReceiver(mDownloadReceiver);
    if (exitWithUserOption) {
      MobclickAgent.onKillProcess(this);
      WebviewService.exit(this);
      System.exit(0);
    }
    super.onDestroy();
  }
Example #3
0
  @Override
  protected void onPause() {
    super.onPause();
    MobclickAgent.onPause(this);

    //        File file;
    //        try {
    //            file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),
    //                    "logcat.txt");
    //            if (!file.exists())
    //                file.createNewFile();
    //            AppUtils.fetch(file);
    //        } catch (IOException e) {
    //            e.printStackTrace();
    //        }

    BaseApplication.setMainActivityState(BaseApplication.FLAG_MAIN_STATE_BACKGROUND);
  }
Example #4
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (requestCode == LanguageChangeActivity.LANGUAGE_CHANGE_REQUEST_CODE
       && resultCode == LanguageChangeActivity.LANGUAGE_CHANGE_RESULT_CODE) {
     AppSharePreferences.getDefault(getApplicationContext()).edit().remove("MENU_LAST_MODIFY");
     AppSharePreferences.deleteSplashLastModify(getApplicationContext());
     DatabaseHelper.deleteMenuCache(getApplicationContext());
     AppUtils.initMenuFromCache(getApplicationContext());
     AppSharePreferences.saveGroupExtendIds(this, null);
     if (Build.VERSION.SDK_INT >= 11) recreate();
     else {
       Intent intent = new Intent(this, BaseSplashActivity.class);
       startActivity(intent);
       finish();
     }
   }
 }
Example #5
0
  @Override
  protected void onResume() {
    super.onResume();
    MobclickAgent.onResume(this);
    if (AppConstant.menuFlag) {
      AppConstant.menuFlag = false;
      showMenu();
    }
    if (AppConstant.VIDEOMODE == AppConstant.NIGHTMODE) {
      night();
    } else {
      day();
    }

    BaseApplication.setMainActivityState(BaseApplication.FLAG_MAIN_STATE_FOREGROUND);
    if (AppSharePreferences.getNOtifyCount(getApplicationContext()) > 0) {
      ShortcutBadger.with(this).count(0);
    }
  }
Example #6
0
 @Override
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   setIntent(intent);
 }
Example #7
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
 }
Example #8
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   outState.putInt("INDEX", index);
   super.onSaveInstanceState(outState);
 }