コード例 #1
0
  @Override
  protected void onCreate(Bundle icicle) {

    ((ImApp) getApplication()).setAppTheme(this);

    super.onCreate(icicle);

    ThemeableActivity.setBackgroundImage(this);

    mApp = ImApp.getApplication(this);
    mHandler = new MyHandler(this);
    mSignInHelper = new SignInHelper(this);

    ImPluginHelper.getInstance(this).loadAvailablePlugins();

    mProviderCursor =
        managedQuery(
            Imps.Provider.CONTENT_URI_WITH_ACCOUNT,
            PROVIDER_PROJECTION,
            Imps.Provider.CATEGORY
                + "=?"
                + " AND "
                + Imps.Provider.ACTIVE_ACCOUNT_USERNAME
                + " NOT NULL" /* selection */,
            new String[] {ImApp.IMPS_CATEGORY} /* selection args */,
            Imps.Provider.DEFAULT_SORT_ORDER);
    Intent intent = getIntent();

    if (ImApp.ACTION_QUIT.equals(intent.getAction())) {
      signOutAndKillProcess();
      return;
    }

    mAdapter = new ProviderAdapter(this, mProviderCursor);
    setListAdapter(mAdapter);

    ViewGroup godfatherView = (ViewGroup) this.getWindow().getDecorView();
    FontUtils.setRobotoFont(this, godfatherView);

    registerForContextMenu(getListView());

    View emptyView = getLayoutInflater().inflate(R.layout.empty_account_view, godfatherView, false);
    emptyView.setVisibility(View.GONE);
    ((ViewGroup) getListView().getParent()).addView(emptyView);

    getListView().setEmptyView(emptyView);
    emptyView.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {

            if (getListView().getCount() == 0) {
              showNewAccountListDialog();
            }
          }
        });
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    ((ImApp) this.getApplication()).setAppTheme(this);

    setBackgroundImage(this);

    super.onCreate(savedInstanceState);
  }