mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-05 09:05:10 -05:00
fix layouts for search results / share url results
fix crash in empty group view
This commit is contained in:
parent
7527560ba0
commit
60faa9cfab
@ -97,7 +97,7 @@ namespace keepass2android
|
||||
{
|
||||
get { return App.Kp2a.GetDb().CanWrite && ((this.Group.ParentGroup != null) || App.Kp2a.GetDb().DatabaseFormat.CanHaveEntriesInRootGroup); }
|
||||
}
|
||||
/*
|
||||
/*TODO
|
||||
public override bool OnCreateOptionsMenu(IMenu menu)
|
||||
{
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
|
@ -84,18 +84,32 @@ namespace keepass2android
|
||||
|
||||
public void SetNormalButtonVisibility(bool showAddGroup, bool showAddEntry)
|
||||
{
|
||||
FindViewById(Resource.Id.bottom_bar).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.divider2).Visibility = ViewStates.Gone;
|
||||
//check for null in the following because the "empty" layouts may not have all views
|
||||
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = ViewStates.Gone;
|
||||
if (FindViewById(Resource.Id.bottom_bar) != null)
|
||||
FindViewById(Resource.Id.bottom_bar).Visibility = BottomBarAlwaysVisible ? ViewStates.Visible : ViewStates.Gone;
|
||||
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = (showAddGroup || showAddEntry) ? ViewStates.Visible : ViewStates.Gone;
|
||||
if (FindViewById(Resource.Id.divider2) != null)
|
||||
FindViewById(Resource.Id.divider2).Visibility = BottomBarAlwaysVisible ? ViewStates.Visible : ViewStates.Gone;
|
||||
|
||||
if (FindViewById(Resource.Id.fabCancelAddNew) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = ViewStates.Gone;
|
||||
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = (showAddGroup || showAddEntry) ? ViewStates.Visible : ViewStates.Gone;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public virtual bool BottomBarAlwaysVisible
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
@ -216,28 +230,36 @@ namespace keepass2android
|
||||
_prefs = PreferenceManager.GetDefaultSharedPreferences(this);
|
||||
|
||||
|
||||
SetContentView(Resource.Layout.group);
|
||||
SetContentView(ContentResourceId);
|
||||
|
||||
FindViewById(Resource.Id.fabAddNew).Click += (sender, args) =>
|
||||
if (FindViewById(Resource.Id.fabCancelAddNew) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Visible;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = AddGroupEnabled ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = AddEntryEnabled ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Gone;
|
||||
};
|
||||
FindViewById(Resource.Id.fabAddNew).Click += (sender, args) =>
|
||||
{
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Visible;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = AddGroupEnabled ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = AddEntryEnabled ? ViewStates.Visible : ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Gone;
|
||||
};
|
||||
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Click += (sender, args) =>
|
||||
{
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Visible;
|
||||
};
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Click += (sender, args) =>
|
||||
{
|
||||
FindViewById(Resource.Id.fabCancelAddNew).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewGroup).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNewEntry).Visibility = ViewStates.Gone;
|
||||
FindViewById(Resource.Id.fabAddNew).Visibility = ViewStates.Visible;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
FindViewById(Resource.Id.cancel_insert_element).Click += (sender, args) => StopMovingElements();
|
||||
FindViewById(Resource.Id.insert_element).Click += (sender, args) => InsertElements();
|
||||
if (FindViewById(Resource.Id.cancel_insert_element) != null)
|
||||
{
|
||||
FindViewById(Resource.Id.cancel_insert_element).Click += (sender, args) => StopMovingElements();
|
||||
FindViewById(Resource.Id.insert_element).Click += (sender, args) => InsertElements();
|
||||
}
|
||||
|
||||
|
||||
SetResult(KeePass.ExitNormal);
|
||||
|
||||
@ -245,6 +267,11 @@ namespace keepass2android
|
||||
|
||||
}
|
||||
|
||||
protected virtual int ContentResourceId
|
||||
{
|
||||
get { return Resource.Layout.group; }
|
||||
}
|
||||
|
||||
private void InsertElements()
|
||||
{
|
||||
MoveElementsTask moveElementsTask = (MoveElementsTask)AppTask;
|
||||
@ -313,7 +340,6 @@ namespace keepass2android
|
||||
cursor.MoveToPosition(position);
|
||||
string entryIdAsHexString = cursor.GetString(cursor.GetColumnIndexOrThrow(SearchManager.SuggestColumnIntentDataId));
|
||||
EntryActivity.Launch(_activity, App.Kp2a.GetDb().Entries[new PwUuid(MemUtil.HexStringToByteArray(entryIdAsHexString))],-1,_activity.AppTask);
|
||||
((SearchView) _searchItem.ActionView).Iconified = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -27,5 +27,6 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/list"
|
||||
android:layout_margin="12dp"
|
||||
android:text="@string/no_results"/>
|
||||
</RelativeLayout>
|
@ -1,65 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#fff">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:baselineAligned="false">
|
||||
<Button
|
||||
android:id="@+id/select_other_entry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="?android:attr/dividerVertical"
|
||||
android:showDividers="middle"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:dividerPadding="12dp"
|
||||
android:baselineAligned="false">
|
||||
<FrameLayout
|
||||
android:id="@+id/select_other_entry"
|
||||
style="?android:attr/actionButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
style="?android:actionBarTabTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/select_other_entry" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/add_url_entry"
|
||||
style="?android:attr/actionButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
style="?android:actionBarTabTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/add_url_entry" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:text="@string/select_other_entry"
|
||||
style="@style/BottomBarButton" />
|
||||
<Button
|
||||
android:id="@+id/add_url_entry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:text="@string/add_url_entry"
|
||||
style="@style/BottomBarButton" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
<fragment
|
||||
android:name="keepass2android.GroupListFragment"
|
||||
android:id="@+id/list_fragment"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/top"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp" />
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
@ -1,72 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#fff">
|
||||
<LinearLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="horizontal" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:baselineAligned="false">
|
||||
<Button
|
||||
android:id="@+id/select_other_entry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:divider="?android:attr/dividerVertical"
|
||||
android:showDividers="middle"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:dividerPadding="12dp"
|
||||
android:baselineAligned="false">
|
||||
<FrameLayout
|
||||
android:id="@+id/select_other_entry"
|
||||
style="?android:attr/actionButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
style="?android:actionBarTabTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/select_other_entry" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/add_url_entry"
|
||||
style="?android:attr/actionButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
style="?android:actionBarTabTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/add_url_entry" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
<TextView
|
||||
android:id="@+id/no_results"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="@string/select_other_entry"
|
||||
style="@style/BottomBarButton" />
|
||||
<Button
|
||||
android:id="@+id/add_url_entry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_below="@id/top"
|
||||
android:text="@string/no_results" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/no_results"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp" />
|
||||
</RelativeLayout>
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/add_url_entry"
|
||||
style="@style/BottomBarButton" />
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_above="@id/bottom_bar"
|
||||
android:background="#b8b8b8" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_results"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_below="@id/top"
|
||||
android:text="@string/no_results" />
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider2"
|
||||
android:layout_below="@id/no_results"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingLeft="8dp" />
|
||||
</RelativeLayout>
|
||||
|
@ -122,11 +122,7 @@ namespace keepass2android
|
||||
{
|
||||
//TODO
|
||||
SetContentView(Resource.Layout.searchurlresults_empty);
|
||||
} else
|
||||
{
|
||||
//TODO
|
||||
SetContentView(Resource.Layout.searchurlresults);
|
||||
}
|
||||
}
|
||||
|
||||
SetGroupTitle();
|
||||
|
||||
@ -163,5 +159,15 @@ namespace keepass2android
|
||||
StartActivity(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool BottomBarAlwaysVisible
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected override int ContentResourceId
|
||||
{
|
||||
get { return Resource.Layout.searchurlresults; }
|
||||
}
|
||||
}}
|
||||
|
||||
|
@ -46,7 +46,6 @@ namespace keepass2android.search
|
||||
SetResult(KeePass.ExitNormal);
|
||||
|
||||
ProcessIntent(Intent);
|
||||
//TODO RegisterForContextMenu(ListView);
|
||||
}
|
||||
|
||||
protected override bool AddEntryEnabled
|
||||
|
Loading…
Reference in New Issue
Block a user