Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    if (Intent.ACTION_SENDTO.equals(intent.getAction())) {
      if (!resolveIntent(intent)) {
        finish();
        return;
      }

      if (TextUtils.isEmpty(mToAddress)) {
        Log.w(ImApp.LOG_TAG, "<ImUrlActivity>Invalid to address:" + mToAddress);
        finish();
        return;
      }
      mApp = ImApp.getApplication(this);
      mApp.callWhenServiceConnected(
          new Handler(),
          new Runnable() {
            public void run() {
              handleIntent();
            }
          });

    } else {
      finish();
    }
  }
  @Override
  protected void onStop() {
    super.onStop();

    // always call finish here, because we don't want to be in the backlist ever, and
    // we don't handle onRestart()

  }
  @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();
            }
          }
        });
  }
Example #4
0
  @Override
  protected void onResume() {
    super.onResume();

    if (mDefaultLocale == null) showLocaleDialog();
    else {
      cursorUnlocked();
      doOnResume();
    }
  }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Intent intent = getIntent();
    Uri data = intent.getData();
    if (data == null) {
      Log.e(ImApp.LOG_TAG, "Need account data to sign in");
      // finish();
      return;
    }

    ContentResolver cr = getContentResolver();

    Cursor c =
        cr.query(
            data,
            ACCOUNT_SELECTION,
            null /* selection */,
            null /* selection args */,
            null /* sort order */);
    final long providerId;
    final long accountId;

    try {
      if (!c.moveToFirst()) {
        LogCleaner.warn(ImApp.LOG_TAG, "[SignoutActivity] No data for " + data);
        //   finish();
        return;
      }

      providerId = c.getLong(c.getColumnIndexOrThrow(Imps.Account.PROVIDER));
      accountId = c.getLong(c.getColumnIndexOrThrow(Imps.Account._ID));
    } finally {
      c.close();
    }

    mApp = (ImApp) getApplication();
    mApp.callWhenServiceConnected(
        mHandler,
        new Runnable() {
          public void run() {
            signOut(providerId, accountId);
          }
        });
  }
Example #6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSignInHelper = new SignInHelper(this);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    mDefaultLocale = prefs.getString(getString(R.string.pref_default_locale), null);
    setContentView(R.layout.welcome_activity);
    Button getStarted = ((Button) findViewById(R.id.btnSplashAbout));

    getStarted.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
            Intent intent = new Intent(getBaseContext(), AboutActivity.class);
            startActivity(intent);
          }
        });

    mDoSignIn = getIntent().getBooleanExtra("doSignIn", true);
  }
Example #7
0
  @Override
  protected void onDestroy() {
    mSignInHelper.stop();

    super.onDestroy();
  }
Example #8
0
  @Override
  protected void onPause() {
    if (mHandler != null) mHandler.unregisterForBroadcastEvents();

    super.onPause();
  }