Esempio n. 1
0
  @Override
  protected void onPostExecute(Void result) {
    super.onPostExecute(result);

    context.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    if (yibo.isAutoScreenOrientation()) {
      context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
    } else {
      context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    context.updateContentView(null);

    if (!NetUtil.isConnect(context)) {
      showNetSettingsDialog();
    }

    if (GlobalVars.IS_MOBILE_NET_UPDATE_VERSION) {
      MobclickAgent.setUpdateOnlyWifi(false);
    }
    if (yibo.isCheckNewVersionOnStartup()) {
      // 检查更新
      MobclickAgent.update(context);
    }

    // 清除缓存
    StatusesCleanTask statusCleanTask = new StatusesCleanTask(context);
    statusCleanTask.execute();
    ImageCacheQuickCleanTask imageCacheTask = new ImageCacheQuickCleanTask(context);
    imageCacheTask.execute();
  }
  public View getContentView(LocalAccount account) {
    BaseAdapter adapter = initAdapter(account);
    GridView gvApp;

    View contentView = null;
    if (refView != null) {
      contentView = refView.get();
      if (Constants.DEBUG && contentView == null) {
        Log.v("AppChangeListener", "HomePage_App View recycle");
      }
    }
    if (contentView != null) {
      gvApp = (GridView) contentView.findViewById(R.id.gvApp);
    } else {
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      contentView = inflater.inflate(R.layout.home_page_content_app, null);
      ThemeUtil.setContentBackground(contentView);
      // refView = new WeakReference<View>(contentView);

      gvApp = (GridView) contentView.findViewById(R.id.gvApp);
      View emptyView = contentView.findViewById(R.id.llLoadingView);
      gvApp.setOnItemClickListener(itemClickListener);
      gvApp.setEmptyView(emptyView);
      if (Constants.DEBUG) {
        Log.v("AppChangeListener", "reclaim:" + this.getClass().getCanonicalName());
      }
    }
    gvApp.setAdapter(adapter);
    gvApp.setFastScrollEnabled(yibo.isSliderEnabled());

    return contentView;
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    BaseAdapter adapter = AdapterUtil.getAdapter(parent.getAdapter());
    LocalAccount account = (LocalAccount) adapter.getItem(position);
    if (selectorWindow.isSelected(account)) {
      selectorWindow.removeSelectedAccount(account);
    } else {
      selectorWindow.addSelectedAccount(account);
    }

    Context context = view.getContext();
    YiBoApplication yibo = (YiBoApplication) context.getApplicationContext();
    yibo.setCurrentAccount(account);

    HomePageActivity activity = (HomePageActivity) context;
    Skeleton skeleton = activity.getSkeleton();
    if (skeleton != null) {
      skeleton.setCurrentAccount(account, true);
      skeleton.setContentType(skeleton.getContentType());
    }

    selectorWindow.dismiss();
  }