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
 public void onEventMainThread(SubscriptionAddActivity.FollowFlagEvent event) {
   if (event.flag && index == 2) {
     mTitleView.setLeftButton(getString(R.string.feed_edit));
   } else mTitleView.setLeftButton(0);
 }
Example #3
0
 public void showMark(boolean show) {
   mTitleView.showMark(show);
 }
Example #4
0
  private void initBottomButton() {
    newsButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab1_normal, 0, 0);
    newsButton.setTextColor(getResources().getColor(R.color.calendar_header));
    gameButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab2_normal, 0, 0);
    gameButton.setTextColor(getResources().getColor(R.color.calendar_header));
    threadButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab3_normal, 0, 0);
    threadButton.setTextColor(getResources().getColor(R.color.calendar_header));
    dataButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab4_normal, 0, 0);
    dataButton.setTextColor(getResources().getColor(R.color.calendar_header));
    if (majorTeamGsonModel == null || TextUtils.isEmpty(majorTeamGsonModel.avatar)) {
      if (AppSharePreferences.getFollowFlag(getApplicationContext())) {
        majorImageView.setImageResource(R.drawable.tab_center_notset_normal);
      } else {
        majorImageView.setImageResource(R.drawable.tab_center_normal);
      }
    } else {
      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()));
      }
    }
    mTitleView.setLeftButton(0);
    majorImageView.setBackgroundResource(R.drawable.main_tab_center);
    switch (index) {
      case 0:
        {
          mTitleView.setTitle(null);
          newsButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab1_selected, 0, 0);
          newsButton.setTextColor(getResources().getColor(R.color.title));
          break;
        }
      case 1:
        {
          mTitleView.setTitle(getString(R.string.top_toolbar_small_online));
          gameButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab2_selected, 0, 0);
          gameButton.setTextColor(getResources().getColor(R.color.title));
          break;
        }
      case 2:
        {
          mTitleView.setTitle(null);
          // ((Button)v).setCompoundDrawablesWithIntrinsicBounds(0,
          // R.drawable.tab2_selected, 0, 0);

          if (majorTeamGsonModel == null || TextUtils.isEmpty(majorTeamGsonModel.avatar)) {
            if (AppSharePreferences.getFollowFlag(getApplicationContext())) {
              majorImageView.setImageResource(R.drawable.tab_center_notset_pressed);
            } else {
              majorImageView.setImageResource(R.drawable.tab_center_selected);
            }
            majorImageView.setBackgroundColor(getResources().getColor(R.color.title));
          } else {
            if (!TextUtils.isEmpty(majorTeamGsonModel.color))
              majorImageView.setBackgroundColor(Color.parseColor(majorTeamGsonModel.color));
            else majorImageView.setBackgroundColor(getResources().getColor(R.color.title));
          }
          if (AppSharePreferences.getFollowFlag(getApplicationContext()))
            mTitleView.setLeftButton(getString(R.string.feed_edit));
          break;
        }
      case 3:
        {
          mTitleView.setTitle(getString(R.string.title_football_group));
          threadButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab3_selected, 0, 0);
          threadButton.setTextColor(getResources().getColor(R.color.title));
          break;
        }
      case 4:
        {
          mTitleView.setTitle(getString(R.string.title_football_top));
          dataButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab4_selected, 0, 0);
          dataButton.setTextColor(getResources().getColor(R.color.title));
          break;
        }
    }
  }