mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Change search and menu
This commit is contained in:
@@ -98,7 +98,7 @@
|
|||||||
android:name="com.keepassdroid.EntryEditActivityV4"
|
android:name="com.keepassdroid.EntryEditActivityV4"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden" />
|
||||||
<activity android:name="com.keepassdroid.search.SearchResults" android:launchMode="standard">
|
<activity android:name="com.keepassdroid.search.SearchResultsActivity" android:launchMode="standard">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEARCH" />
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ public class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This should probably be abstracted out
|
// TODO: This should probably be abstracted out
|
||||||
// The root group in v3 is not an 'official' group
|
// The root tree in v3 is not an 'official' tree
|
||||||
if ( pm instanceof PwDatabaseV3 ) {
|
if ( pm instanceof PwDatabaseV3 ) {
|
||||||
dirty.add(pm.rootGroup);
|
dirty.add(pm.rootGroup);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public abstract class GroupActivity extends GroupBaseActivity
|
|||||||
public static void Launch(Activity act, PwGroup group) {
|
public static void Launch(Activity act, PwGroup group) {
|
||||||
Intent i;
|
Intent i;
|
||||||
|
|
||||||
// Need to use PwDatabase since group may be null
|
// Need to use PwDatabase since tree may be null
|
||||||
PwDatabase db = App.getDB().pm;
|
PwDatabase db = App.getDB().pm;
|
||||||
if ( db instanceof PwDatabaseV3 ) {
|
if ( db instanceof PwDatabaseV3 ) {
|
||||||
i = new Intent(act, GroupActivityV3.class);
|
i = new Intent(act, GroupActivityV3.class);
|
||||||
@@ -111,7 +111,7 @@ public abstract class GroupActivity extends GroupBaseActivity
|
|||||||
|
|
||||||
setResult(KeePass.EXIT_NORMAL);
|
setResult(KeePass.EXIT_NORMAL);
|
||||||
|
|
||||||
Log.w(TAG, "Creating group view");
|
Log.w(TAG, "Creating tree view");
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
PwGroupId id = retrieveGroupId(intent);
|
PwGroupId id = retrieveGroupId(intent);
|
||||||
@@ -125,7 +125,7 @@ public abstract class GroupActivity extends GroupBaseActivity
|
|||||||
mGroup = db.pm.groups.get(id);
|
mGroup = db.pm.groups.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.w(TAG, "Retrieved group");
|
Log.w(TAG, "Retrieved tree");
|
||||||
if ( mGroup == null ) {
|
if ( mGroup == null ) {
|
||||||
Log.w(TAG, "Group was null");
|
Log.w(TAG, "Group was null");
|
||||||
return;
|
return;
|
||||||
@@ -181,7 +181,7 @@ public abstract class GroupActivity extends GroupBaseActivity
|
|||||||
|
|
||||||
setListAdapter(new PwGroupListAdapter(this, mGroup));
|
setListAdapter(new PwGroupListAdapter(this, mGroup));
|
||||||
registerForContextMenu(getListView());
|
registerForContextMenu(getListView());
|
||||||
Log.w(TAG, "Finished creating group");
|
Log.w(TAG, "Finished creating tree");
|
||||||
|
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
showWarnings();
|
showWarnings();
|
||||||
@@ -222,7 +222,7 @@ public abstract class GroupActivity extends GroupBaseActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// For icon in create group dialog
|
// For icon in create tree dialog
|
||||||
public void iconPicked(Bundle bundle) {
|
public void iconPicked(Bundle bundle) {
|
||||||
GroupEditFragment groupEditFragment = (GroupEditFragment) getSupportFragmentManager().findFragmentByTag(TAG_CREATE_GROUP);
|
GroupEditFragment groupEditFragment = (GroupEditFragment) getSupportFragmentManager().findFragmentByTag(TAG_CREATE_GROUP);
|
||||||
if (groupEditFragment != null) {
|
if (groupEditFragment != null) {
|
||||||
|
|||||||
@@ -20,12 +20,15 @@
|
|||||||
package com.keepassdroid;
|
package com.keepassdroid;
|
||||||
|
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.app.SearchManager;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.widget.SearchView;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@@ -36,7 +39,6 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.android.keepass.KeePass;
|
import com.android.keepass.KeePass;
|
||||||
import com.android.keepass.R;
|
import com.android.keepass.R;
|
||||||
@@ -45,8 +47,8 @@ import com.keepassdroid.compat.ActivityCompat;
|
|||||||
import com.keepassdroid.compat.EditorCompat;
|
import com.keepassdroid.compat.EditorCompat;
|
||||||
import com.keepassdroid.database.PwGroup;
|
import com.keepassdroid.database.PwGroup;
|
||||||
import com.keepassdroid.database.edit.OnFinish;
|
import com.keepassdroid.database.edit.OnFinish;
|
||||||
import com.keepassdroid.settings.SettingsActivity;
|
import com.keepassdroid.search.SearchResultsActivity;
|
||||||
import com.keepassdroid.utils.Util;
|
import com.keepassdroid.utils.MenuUtil;
|
||||||
import com.keepassdroid.view.ClickView;
|
import com.keepassdroid.view.ClickView;
|
||||||
import com.keepassdroid.view.GroupViewOnlyView;
|
import com.keepassdroid.view.GroupViewOnlyView;
|
||||||
|
|
||||||
@@ -163,8 +165,25 @@ public abstract class GroupBaseActivity extends LockCloseListActivity {
|
|||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
// TODO Donation
|
// TODO Donation
|
||||||
|
inflater.inflate(R.menu.search, menu);
|
||||||
inflater.inflate(R.menu.donation, menu);
|
inflater.inflate(R.menu.donation, menu);
|
||||||
inflater.inflate(R.menu.group, menu);
|
inflater.inflate(R.menu.tree, menu);
|
||||||
|
inflater.inflate(R.menu.database, menu);
|
||||||
|
inflater.inflate(R.menu.default_menu, menu);
|
||||||
|
|
||||||
|
// Get the SearchView and set the searchable configuration
|
||||||
|
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||||
|
assert searchManager != null;
|
||||||
|
|
||||||
|
MenuItem searchItem = menu.findItem(R.id.menu_search);
|
||||||
|
SearchView searchView = null;
|
||||||
|
if (searchItem != null) {
|
||||||
|
searchView = (SearchView) searchItem.getActionView();
|
||||||
|
}
|
||||||
|
if (searchView != null) {
|
||||||
|
searchView.setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(this, SearchResultsActivity.class)));
|
||||||
|
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -201,40 +220,29 @@ public abstract class GroupBaseActivity extends LockCloseListActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch ( item.getItemId() ) {
|
switch ( item.getItemId() ) {
|
||||||
case R.id.menu_donate:
|
|
||||||
try {
|
|
||||||
Util.gotoUrl(this, R.string.donate_url);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
Toast.makeText(this, R.string.error_failed_to_launch_link, Toast.LENGTH_LONG).show();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
case R.id.menu_search:
|
||||||
case R.id.menu_lock:
|
onSearchRequested();
|
||||||
App.setShutdown();
|
return true;
|
||||||
setResult(KeePass.EXIT_LOCK);
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case R.id.menu_search:
|
case R.id.menu_sort:
|
||||||
onSearchRequested();
|
toggleSort();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.menu_app_settings:
|
case R.id.menu_lock:
|
||||||
SettingsActivity.Launch(this);
|
App.setShutdown();
|
||||||
return true;
|
setResult(KeePass.EXIT_LOCK);
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
|
||||||
case R.id.menu_change_master_key:
|
case R.id.menu_change_master_key:
|
||||||
setPassword();
|
setPassword();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.menu_sort:
|
|
||||||
toggleSort();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
MenuUtil.onDefaultMenuOptionsItemSelected(this, item);
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleSort() {
|
private void toggleSort() {
|
||||||
@@ -251,7 +259,7 @@ public abstract class GroupBaseActivity extends LockCloseListActivity {
|
|||||||
// Mark all groups as dirty now to refresh them on load
|
// Mark all groups as dirty now to refresh them on load
|
||||||
Database db = App.getDB();
|
Database db = App.getDB();
|
||||||
db.markAllGroupsAsDirty();
|
db.markAllGroupsAsDirty();
|
||||||
// We'll manually refresh this group so we can remove it
|
// We'll manually refresh this tree so we can remove it
|
||||||
db.dirty.remove(mGroup);
|
db.dirty.remove(mGroup);
|
||||||
|
|
||||||
// Tell the adapter to refresh it's list
|
// Tell the adapter to refresh it's list
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public abstract class PwDatabase {
|
|||||||
public abstract PwEncryptionAlgorithm getEncAlgorithm();
|
public abstract PwEncryptionAlgorithm getEncAlgorithm();
|
||||||
|
|
||||||
public void addGroupTo(PwGroup newGroup, PwGroup parent) {
|
public void addGroupTo(PwGroup newGroup, PwGroup parent) {
|
||||||
// Add group to parent group
|
// Add tree to parent tree
|
||||||
if ( parent == null ) {
|
if ( parent == null ) {
|
||||||
parent = rootGroup;
|
parent = rootGroup;
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ public abstract class PwDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeGroupFrom(PwGroup remove, PwGroup parent) {
|
public void removeGroupFrom(PwGroup remove, PwGroup parent) {
|
||||||
// Remove group from parent group
|
// Remove tree from parent tree
|
||||||
parent.childGroups.remove(remove);
|
parent.childGroups.remove(remove);
|
||||||
|
|
||||||
groups.remove(remove.getId());
|
groups.remove(remove.getId());
|
||||||
|
|||||||
@@ -194,16 +194,16 @@ public class PwDatabaseV3 extends PwDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public void removeGroup(PwGroupV3 group) {
|
public void removeGroup(PwGroupV3 tree) {
|
||||||
group.parent.childGroups.remove(group);
|
tree.parent.childGroups.remove(tree);
|
||||||
groups.remove(group);
|
groups.remove(tree);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an unused random group id
|
* Generates an unused random tree id
|
||||||
*
|
*
|
||||||
* @return new group id
|
* @return new tree id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PwGroupIdV3 newGroupId() {
|
public PwGroupIdV3 newGroupId() {
|
||||||
@@ -280,7 +280,7 @@ public class PwDatabaseV3 extends PwDatabase {
|
|||||||
public void addGroupTo(PwGroup newGroup, PwGroup parent) {
|
public void addGroupTo(PwGroup newGroup, PwGroup parent) {
|
||||||
super.addGroupTo(newGroup, parent);
|
super.addGroupTo(newGroup, parent);
|
||||||
|
|
||||||
// Add group to root groups
|
// Add tree to root groups
|
||||||
groups.add(newGroup);
|
groups.add(newGroup);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ public class PwDatabaseV3 extends PwDatabase {
|
|||||||
public void removeGroupFrom(PwGroup remove, PwGroup parent) {
|
public void removeGroupFrom(PwGroup remove, PwGroup parent) {
|
||||||
super.removeGroupFrom(remove, parent);
|
super.removeGroupFrom(remove, parent);
|
||||||
|
|
||||||
// Remove group from root entry
|
// Remove tree from root entry
|
||||||
groups.remove(remove);
|
groups.remove(remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ public class PwDatabaseV3 extends PwDatabase {
|
|||||||
algorithm = PwEncryptionAlgorithm.Rjindal;
|
algorithm = PwEncryptionAlgorithm.Rjindal;
|
||||||
numKeyEncRounds = DEFAULT_ENCRYPTION_ROUNDS;
|
numKeyEncRounds = DEFAULT_ENCRYPTION_ROUNDS;
|
||||||
name = "KeePass Password Manager";
|
name = "KeePass Password Manager";
|
||||||
// Build the root group
|
// Build the root tree
|
||||||
constructTree(null);
|
constructTree(null);
|
||||||
|
|
||||||
// Add a couple default groups
|
// Add a couple default groups
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ public class PwDatabaseV4 extends PwDatabase {
|
|||||||
super.populateGlobals(currentGroup);
|
super.populateGlobals(currentGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ensure that the recycle bin group exists, if enabled and create it
|
/** Ensure that the recycle bin tree exists, if enabled and create it
|
||||||
* if it doesn't exist
|
* if it doesn't exist
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public class PwGroupV4 extends PwGroup implements ITimeLogger {
|
|||||||
group = group.parent;
|
group = group.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get to the root group and its null, default to true
|
// If we get to the root tree and its null, default to true
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class AddEntry extends RunnableOnFinish {
|
|||||||
|
|
||||||
PwGroup parent = mEntry.getParent();
|
PwGroup parent = mEntry.getParent();
|
||||||
|
|
||||||
// Mark parent group dirty
|
// Mark parent tree dirty
|
||||||
mDb.dirty.add(parent);
|
mDb.dirty.add(parent);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -102,10 +102,10 @@ public class DeleteGroup extends RunnableOnFinish {
|
|||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
if ( mSuccess ) {
|
if ( mSuccess ) {
|
||||||
// Remove from group global
|
// Remove from tree global
|
||||||
mDb.pm.groups.remove(mGroup.getId());
|
mDb.pm.groups.remove(mGroup.getId());
|
||||||
|
|
||||||
// Remove group from the dirty global (if it is present), not a big deal if this fails
|
// Remove tree from the dirty global (if it is present), not a big deal if this fails
|
||||||
mDb.dirty.remove(mGroup);
|
mDb.dirty.remove(mGroup);
|
||||||
|
|
||||||
// Mark parent dirty
|
// Mark parent dirty
|
||||||
@@ -115,7 +115,7 @@ public class DeleteGroup extends RunnableOnFinish {
|
|||||||
}
|
}
|
||||||
mDb.dirty.add(mDb.pm.rootGroup);
|
mDb.dirty.add(mDb.pm.rootGroup);
|
||||||
} else {
|
} else {
|
||||||
// Let's not bother recovering from a failure to save a deleted group. It is too much work.
|
// Let's not bother recovering from a failure to save a deleted tree. It is too much work.
|
||||||
App.setShutdown();
|
App.setShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class PwDbV3Output extends PwDbOutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void prepForOutput() {
|
private void prepForOutput() {
|
||||||
// Before we output the header, we should sort our list of groups and remove any orphaned nodes that are no longer part of the group hierarchy
|
// Before we output the header, we should sort our list of groups and remove any orphaned nodes that are no longer part of the tree hierarchy
|
||||||
sortGroupsForOutput();
|
sortGroupsForOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ public class PwDbV3Output extends PwDbOutput {
|
|||||||
try {
|
try {
|
||||||
pgo.output();
|
pgo.output();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PwDbOutputException("Failed to output a group: " + e.getMessage());
|
throw new PwDbOutputException("Failed to output a tree: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ public class PwDbV3Output extends PwDbOutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sortGroup(PwGroupV3 group, List<PwGroup> groupList) {
|
private void sortGroup(PwGroupV3 group, List<PwGroup> groupList) {
|
||||||
// Add current group
|
// Add current tree
|
||||||
groupList.add(group);
|
groupList.add(group);
|
||||||
|
|
||||||
// Recurse over children
|
// Recurse over children
|
||||||
|
|||||||
@@ -22,19 +22,25 @@ package com.keepassdroid.search;
|
|||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.keepass.KeePass;
|
import com.android.keepass.KeePass;
|
||||||
|
import com.android.keepass.R;
|
||||||
import com.keepassdroid.Database;
|
import com.keepassdroid.Database;
|
||||||
import com.keepassdroid.GroupBaseActivity;
|
import com.keepassdroid.GroupBaseActivity;
|
||||||
import com.keepassdroid.PwGroupListAdapter;
|
import com.keepassdroid.PwGroupListAdapter;
|
||||||
import com.keepassdroid.app.App;
|
import com.keepassdroid.app.App;
|
||||||
import com.keepassdroid.view.GroupEmptyView;
|
|
||||||
import com.keepassdroid.view.GroupViewOnlyView;
|
|
||||||
|
|
||||||
public class SearchResults extends GroupBaseActivity {
|
public class SearchResultsActivity extends GroupBaseActivity {
|
||||||
|
|
||||||
private Database mDb;
|
private Database mDb;
|
||||||
//private String mQuery;
|
|
||||||
|
private View listView;
|
||||||
|
private View imageNotFoundView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -53,49 +59,66 @@ public class SearchResults extends GroupBaseActivity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setContentView(getLayoutInflater().inflate(R.layout.search_results, null));
|
||||||
|
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
toolbar.setTitle(getString(R.string.search_label));
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
assert getSupportActionBar() != null;
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||||
|
|
||||||
|
listView = findViewById(R.id.group_list);
|
||||||
|
imageNotFoundView = findViewById(R.id.img_not_found);
|
||||||
|
|
||||||
performSearch(getSearchStr(getIntent()));
|
performSearch(getSearchStr(getIntent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performSearch(String query) {
|
@Override
|
||||||
query(query.trim());
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
}
|
|
||||||
|
|
||||||
private void query(String query) {
|
MenuInflater inflater = getMenuInflater();
|
||||||
mGroup = mDb.Search(query);
|
// TODO Donation
|
||||||
|
inflater.inflate(R.menu.donation, menu);
|
||||||
|
inflater.inflate(R.menu.tree, menu);
|
||||||
|
inflater.inflate(R.menu.default_menu, menu);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch ( item.getItemId() ) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void performSearch(String query) {
|
||||||
|
mGroup = mDb.Search(query.trim());
|
||||||
|
|
||||||
if ( mGroup == null || mGroup.childEntries.size() < 1 ) {
|
if ( mGroup == null || mGroup.childEntries.size() < 1 ) {
|
||||||
setContentView(new GroupEmptyView(this));
|
listView.setVisibility(View.GONE);
|
||||||
|
imageNotFoundView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
setContentView(new GroupViewOnlyView(this));
|
listView.setVisibility(View.VISIBLE);
|
||||||
}
|
imageNotFoundView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
setGroupTitle();
|
setGroupTitle();
|
||||||
|
|
||||||
setListAdapter(new PwGroupListAdapter(this, mGroup));
|
setListAdapter(new PwGroupListAdapter(this, mGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
protected void onNewIntent(Intent intent) {
|
|
||||||
super.onNewIntent(intent);
|
|
||||||
|
|
||||||
mQuery = getSearchStr(intent);
|
|
||||||
performSearch();
|
|
||||||
//mGroup = processSearchIntent(intent);
|
|
||||||
//assert(mGroup != null);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String getSearchStr(Intent queryIntent) {
|
private String getSearchStr(Intent queryIntent) {
|
||||||
// get and process search query here
|
// get and process search query here
|
||||||
final String queryAction = queryIntent.getAction();
|
final String queryAction = queryIntent.getAction();
|
||||||
if ( Intent.ACTION_SEARCH.equals(queryAction) ) {
|
if ( Intent.ACTION_SEARCH.equals(queryAction) ) {
|
||||||
return queryIntent.getStringExtra(SearchManager.QUERY);
|
return queryIntent.getStringExtra(SearchManager.QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
|
|
||||||
*
|
|
||||||
* This file is part of KeePass DX.
|
|
||||||
*
|
|
||||||
* KeePass DX is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* KeePass DX is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.keepassdroid.view;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
|
|
||||||
import com.android.keepass.R;
|
|
||||||
|
|
||||||
public class GroupEmptyView extends RelativeLayout {
|
|
||||||
|
|
||||||
public GroupEmptyView(Context context) {
|
|
||||||
this(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public GroupEmptyView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
|
|
||||||
inflate(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void inflate(Context context) {
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
inflater.inflate(R.layout.group_empty, this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
23
app/src/main/res/drawable/img_not_found.xml
Normal file
23
app/src/main/res/drawable/img_not_found.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="56dp"
|
||||||
|
android:height="56dp"
|
||||||
|
android:viewportWidth="56"
|
||||||
|
android:viewportHeight="56">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#bcbcbc"
|
||||||
|
android:pathData="M 21.595703 3.8476562 C 11.386048 3.8476562 3.1621094 12.071595 3.1621094
|
||||||
|
22.28125 C 3.1621094 32.490905 11.386048 40.714844 21.595703 40.714844 C
|
||||||
|
26.133328 40.714844 30.388196 39.01375 33.507812 36.177734 L 34.357422 37.027344
|
||||||
|
L 34.357422 39.296875 L 48.539062 53.476562 L 52.792969 49.222656 L 38.613281
|
||||||
|
35.042969 L 36.34375 35.042969 L 35.492188 34.191406 C 38.328203 31.071789
|
||||||
|
40.03125 26.818874 40.03125 22.28125 C 40.03125 12.071595 31.805358 3.8476563
|
||||||
|
21.595703 3.8476562 z M 21.595703 9.5195312 C 25.986525 9.5195312 29.830306
|
||||||
|
11.696766 32.123047 15.037109 L 14.076172 32.601562 C 10.896292 30.2889
|
||||||
|
8.8339844 26.546969 8.8339844 22.28125 C 8.8339844 15.191212 14.505665 9.5195313
|
||||||
|
21.595703 9.5195312 z M 34.285156 20.916016 C 34.332046 21.364326 34.357422
|
||||||
|
21.819751 34.357422 22.28125 C 34.357422 29.371288 28.685741 35.042969 21.595703
|
||||||
|
35.042969 C 21.017982 35.042969 20.455027 34.990987 19.898438 34.917969 L
|
||||||
|
34.285156 20.916016 z" />
|
||||||
|
</vector>
|
||||||
44
app/src/main/res/layout/search_results.xml
Normal file
44
app/src/main/res/layout/search_results.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
|
This file is part of KeePass DX.
|
||||||
|
|
||||||
|
KeePass DX is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
KeePass DX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
layout="@layout/toolbar_default" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/toolbar">
|
||||||
|
<android.support.v7.widget.AppCompatImageView android:id="@+id/img_not_found"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/img_not_found"/>
|
||||||
|
<ListView android:id="@+id/group_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="@null"
|
||||||
|
android:dividerHeight="0dp"/>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
|
Copyright 2017 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
This file is part of KeePass DX.
|
This file is part of KeePass DX.
|
||||||
|
|
||||||
@@ -19,10 +19,6 @@
|
|||||||
-->
|
-->
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item android:id="@+id/menu_search"
|
|
||||||
android:icon="@drawable/ic_search_white_24dp"
|
|
||||||
android:title="@string/menu_search"
|
|
||||||
app:showAsAction="always" />
|
|
||||||
<item android:id="@+id/menu_lock"
|
<item android:id="@+id/menu_lock"
|
||||||
android:icon="@drawable/ic_lock_white_24dp"
|
android:icon="@drawable/ic_lock_white_24dp"
|
||||||
android:title="@string/menu_lock"
|
android:title="@string/menu_lock"
|
||||||
@@ -30,13 +26,5 @@
|
|||||||
<item android:id="@+id/menu_change_master_key"
|
<item android:id="@+id/menu_change_master_key"
|
||||||
android:icon="@drawable/ic_key_white_24dp"
|
android:icon="@drawable/ic_key_white_24dp"
|
||||||
android:title="@string/menu_change_key"
|
android:title="@string/menu_change_key"
|
||||||
app:showAsAction="never" />
|
|
||||||
<item android:id="@+id/menu_sort"
|
|
||||||
android:icon="@drawable/ic_sort_white_24dp"
|
|
||||||
android:title="@string/sort_name"
|
|
||||||
app:showAsAction="never" />
|
|
||||||
<item android:id="@+id/menu_app_settings"
|
|
||||||
android:icon="@drawable/ic_settings_white_24dp"
|
|
||||||
android:title="@string/menu_app_settings"
|
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
</menu>
|
</menu>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<item android:id="@+id/menu_app_settings"
|
<item android:id="@+id/menu_app_settings"
|
||||||
android:icon="@drawable/ic_settings_white_24dp"
|
android:icon="@drawable/ic_settings_white_24dp"
|
||||||
android:title="@string/menu_app_settings"
|
android:title="@string/menu_app_settings"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="ifRoom" />
|
||||||
<item android:id="@+id/menu_about"
|
<item android:id="@+id/menu_about"
|
||||||
android:icon="@drawable/ic_help_white_24dp"
|
android:icon="@drawable/ic_help_white_24dp"
|
||||||
android:title="@string/menu_about"
|
android:title="@string/menu_about"
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
|
This file is part of KeePass DX.
|
||||||
|
|
||||||
|
KeePass DX is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
KeePass DX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item android:id="@+id/menu_donate"
|
<item android:id="@+id/menu_donate"
|
||||||
|
|||||||
@@ -23,10 +23,6 @@
|
|||||||
android:icon="@drawable/ic_visibility_white_24dp"
|
android:icon="@drawable/ic_visibility_white_24dp"
|
||||||
android:title="@string/menu_showpass"
|
android:title="@string/menu_showpass"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
<item android:id="@+id/menu_lock"
|
|
||||||
android:icon="@drawable/ic_key_white_24dp"
|
|
||||||
android:title="@string/menu_lock"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
<item android:id="@+id/menu_goto_url"
|
<item android:id="@+id/menu_goto_url"
|
||||||
android:icon="@drawable/ic_file_upload_white_24dp"
|
android:icon="@drawable/ic_file_upload_white_24dp"
|
||||||
android:title="@string/menu_url"
|
android:title="@string/menu_url"
|
||||||
@@ -37,4 +33,5 @@
|
|||||||
<item android:id="@+id/menu_copy_pass"
|
<item android:id="@+id/menu_copy_pass"
|
||||||
android:title="@string/menu_copy_pass"
|
android:title="@string/menu_copy_pass"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
<!-- TODO Add database -->
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
27
app/src/main/res/menu/search.xml
Normal file
27
app/src/main/res/menu/search.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
|
This file is part of KeePass DX.
|
||||||
|
|
||||||
|
KeePass DX is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
KeePass DX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:id="@+id/menu_search"
|
||||||
|
android:icon="@drawable/ic_search_white_24dp"
|
||||||
|
android:title="@string/menu_search"
|
||||||
|
app:showAsAction="always|collapseActionView"
|
||||||
|
app:actionViewClass="android.support.v7.widget.SearchView" />
|
||||||
|
</menu>
|
||||||
26
app/src/main/res/menu/tree.xml
Normal file
26
app/src/main/res/menu/tree.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
|
This file is part of KeePass DX.
|
||||||
|
|
||||||
|
KeePass DX is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
KeePass DX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:id="@+id/menu_sort"
|
||||||
|
android:icon="@drawable/ic_sort_white_24dp"
|
||||||
|
android:title="@string/sort_name"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
<string name="sort_name">Sort by name</string>
|
<string name="sort_name">Sort by name</string>
|
||||||
<string name="sort_db">DB sort order</string>
|
<string name="sort_db">DB sort order</string>
|
||||||
<string name="special">Special</string>
|
<string name="special">Special</string>
|
||||||
<string name="search_hint">Entry title/description</string>
|
<string name="search_hint">Search</string>
|
||||||
<string name="search_results">Search results</string>
|
<string name="search_results">Search results</string>
|
||||||
<string name="twofish">Twofish</string>
|
<string name="twofish">Twofish</string>
|
||||||
<string name="underline">Underline</string>
|
<string name="underline">Underline</string>
|
||||||
|
|||||||
54
art/img_not_found.svg
Normal file
54
art/img_not_found.svg
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
viewBox="0 0 56 56"
|
||||||
|
enable-background="new 0 0 1000 1000"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg4136"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="img_not_found.svg"
|
||||||
|
width="56"
|
||||||
|
height="56"><defs
|
||||||
|
id="defs4146" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1154"
|
||||||
|
id="namedview4144"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="4.459355"
|
||||||
|
inkscape:cx="59.523586"
|
||||||
|
inkscape:cy="13.728515"
|
||||||
|
inkscape:window-x="3840"
|
||||||
|
inkscape:window-y="26"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="g6"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4167" /></sodipodi:namedview><metadata
|
||||||
|
id="metadata4138"> Svg Vector Icons : http://www.onlinewebfonts.com/icon <rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><g
|
||||||
|
transform="matrix(0.05064313,0,0,0.05064313,2.6557147,3.3403349)"
|
||||||
|
id="g6"
|
||||||
|
style="fill:#bcbcbc;fill-opacity:1"><path
|
||||||
|
style="fill:#bcbcbc;fill-opacity:1"
|
||||||
|
d="M 21.595703 3.8476562 C 11.386048 3.8476562 3.1621094 12.071595 3.1621094 22.28125 C 3.1621094 32.490905 11.386048 40.714844 21.595703 40.714844 C 26.133328 40.714844 30.388196 39.01375 33.507812 36.177734 L 34.357422 37.027344 L 34.357422 39.296875 L 48.539062 53.476562 L 52.792969 49.222656 L 38.613281 35.042969 L 36.34375 35.042969 L 35.492188 34.191406 C 38.328203 31.071789 40.03125 26.818874 40.03125 22.28125 C 40.03125 12.071595 31.805358 3.8476563 21.595703 3.8476562 z M 21.595703 9.5195312 C 25.986525 9.5195312 29.830306 11.696766 32.123047 15.037109 L 14.076172 32.601562 C 10.896292 30.2889 8.8339844 26.546969 8.8339844 22.28125 C 8.8339844 15.191212 14.505665 9.5195313 21.595703 9.5195312 z M 34.285156 20.916016 C 34.332046 21.364326 34.357422 21.819751 34.357422 22.28125 C 34.357422 29.371288 28.685741 35.042969 21.595703 35.042969 C 21.017982 35.042969 20.455027 34.990987 19.898438 34.917969 L 34.285156 20.916016 z "
|
||||||
|
transform="matrix(19.746015,0,0,19.746015,-52.439782,-65.958303)"
|
||||||
|
id="path8" /></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.8 KiB |
Reference in New Issue
Block a user