예제 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;

    setContentView(R.layout.fingerprint_viewer);
    integrator = new IntentIntegrator(this);
    Intent intent = getIntent();
    account = getAccount(intent);
    user = getUser(intent);
    if (AccountManager.getInstance().getAccount(account) == null || user == null) {
      Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
      finish();
      return;
    }
    if (savedInstanceState != null) {
      remoteFingerprint = savedInstanceState.getString(SAVED_REMOTE_FINGERPRINT);
      localFingerprint = savedInstanceState.getString(SAVED_LOCAL_FINGERPRINT);
    } else {
      remoteFingerprint = OTRManager.getInstance().getRemoteFingerprint(account, user);
      localFingerprint = OTRManager.getInstance().getLocalFingerprint(account);
    }
    verifiedView = (CheckBox) findViewById(R.id.verified);
    verifiedView.setOnCheckedChangeListener(this);
    scanView = findViewById(R.id.scan);
    scanView.setOnClickListener(this);
    showView = findViewById(R.id.show);
    showView.setOnClickListener(this);
    copyView = findViewById(R.id.copy);
    copyView.setOnClickListener(this);
    isUpdating = false;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (Intent.ACTION_VIEW.equals(getIntent().getAction())
        || Intent.ACTION_SEND.equals(getIntent().getAction())
        || Intent.ACTION_SENDTO.equals(getIntent().getAction())
        || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {
      ActivityManager.getInstance().startNewTask(this);
    }
    super.onCreate(savedInstanceState);

    if (isFinishing()) {
      return;
    }

    setContentView(R.layout.contact_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
    toolbar.setOnClickListener(this);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerToggle =
        new ActionBarDrawerToggle(
            this,
            drawerLayout,
            toolbar,
            R.string.application_title_short,
            R.string.application_title_short);
    drawerLayout.setDrawerListener(drawerToggle);

    toolbar.inflateMenu(R.menu.contact_list);
    optionsMenu = toolbar.getMenu();
    setUpSearchView(optionsMenu);
    toolbar.setOnMenuItemClickListener(this);

    barPainter = new BarPainter(this, toolbar);
    barPainter.setDefaultColor();

    toolbar.setTitle(R.string.application_title_full);

    if (savedInstanceState != null) {
      sendText = savedInstanceState.getString(SAVED_SEND_TEXT);
      action = savedInstanceState.getString(SAVED_ACTION);
    } else {
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.container, new ContactListFragment(), CONTACT_LIST_TAG)
          .commit();

      sendText = null;
      action = getIntent().getAction();
    }
    getIntent().setAction(null);
  }