Search in sources :

Example 1 with EntryContentsView

use of com.keepassdroid.view.EntryContentsView in project KeePassDX by Kunzisoft.

the class EntryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.entry_view);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    assert getSupportActionBar() != null;
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    Database db = App.getDB();
    // Likely the app has been killed exit the activity
    if (!db.Loaded()) {
        finish();
        return;
    }
    readOnly = db.readOnly;
    mShowPassword = !PreferencesUtil.isPasswordMask(this);
    // Get Entry from UUID
    Intent i = getIntent();
    UUID uuid = Types.bytestoUUID(i.getByteArrayExtra(KEY_ENTRY));
    mEntry = db.pm.entries.get(uuid);
    if (mEntry == null) {
        Toast.makeText(this, R.string.entry_not_found, Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    // Refresh Menu contents in case onCreateMenuOptions was called before mEntry was set
    invalidateOptionsMenu();
    // Update last access time.
    mEntry.touch(false, false);
    // Get views
    titleIconView = findViewById(R.id.entry_icon);
    titleView = findViewById(R.id.entry_title);
    entryContentsView = findViewById(R.id.entry_contents);
    entryContentsView.applyFontVisibilityToFields(PreferencesUtil.fieldFontIsInVisibility(this));
    // Setup Edit Buttons
    View edit = findViewById(R.id.entry_edit);
    edit.setOnClickListener(v -> EntryEditActivity.Launch(EntryActivity.this, mEntry));
    if (readOnly) {
        edit.setVisibility(View.GONE);
    }
    // Init the clipboard helper
    clipboardHelper = new ClipboardHelper(this);
    firstLaunchOfActivity = true;
}
Also used : PwDatabase(com.keepassdroid.database.PwDatabase) Database(com.keepassdroid.database.Database) Intent(android.content.Intent) UUID(java.util.UUID) ImageView(android.widget.ImageView) EntryContentsView(com.keepassdroid.view.EntryContentsView) View(android.view.View) TextView(android.widget.TextView) ClipboardHelper(com.keepassdroid.timeout.ClipboardHelper) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Intent (android.content.Intent)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 Database (com.keepassdroid.database.Database)1 PwDatabase (com.keepassdroid.database.PwDatabase)1 ClipboardHelper (com.keepassdroid.timeout.ClipboardHelper)1 EntryContentsView (com.keepassdroid.view.EntryContentsView)1 UUID (java.util.UUID)1