diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java
index 7c05d524d..19d1739b6 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java
@@ -41,7 +41,6 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
-import android.view.View;
import android.widget.ImageView;
import com.getkeepsafe.taptargetview.TapTarget;
@@ -102,7 +101,11 @@ public class GroupActivity extends ListNodesActivity
protected boolean readOnly = false;
private static final String OLD_GROUP_TO_UPDATE_KEY = "OLD_GROUP_TO_UPDATE_KEY";
+ private static final String NODE_TO_COPY_KEY = "NODE_TO_COPY_KEY";
+ private static final String NODE_TO_MOVE_KEY = "NODE_TO_MOVE_KEY";
private PwGroup oldGroupToUpdate;
+ private PwNode nodeToCopy;
+ private PwNode nodeToMove;
public static void launch(Activity act) {
startRecordTime(act);
@@ -160,11 +163,6 @@ public class GroupActivity extends ListNodesActivity
attachFragmentToContentView();
- if (savedInstanceState != null
- && savedInstanceState.containsKey(OLD_GROUP_TO_UPDATE_KEY)) {
- oldGroupToUpdate = (PwGroup) savedInstanceState.getSerializable(OLD_GROUP_TO_UPDATE_KEY);
- }
-
iconView = findViewById(R.id.icon);
addNodeButtonView = findViewById(R.id.add_node_button);
addNodeButtonView.enableAddGroup(addGroupEnabled);
@@ -178,18 +176,26 @@ public class GroupActivity extends ListNodesActivity
toolbarPasteExpandableLayout = findViewById(R.id.expandable_toolbar_paste_layout);
toolbarPaste = findViewById(R.id.toolbar_paste);
toolbarPaste.inflateMenu(R.menu.node_paste_menu);
- toolbarPaste.setTitle(R.string.where);
- toolbarPasteExpandableLayout.setOnExpansionUpdateListener((expansionFraction, state) -> {
- switch (state) {
- case ExpandableLayout.State.COLLAPSED:
- toolbarPaste.setVisibility(View.GONE);
- break;
- case ExpandableLayout.State.EXPANDING:
- toolbarPaste.setVisibility(View.VISIBLE);
- break;
- }
+ toolbarPaste.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
+ toolbarPaste.setNavigationOnClickListener(view -> {
+ toolbarPasteExpandableLayout.collapse();
+ nodeToCopy = null;
+ nodeToMove = null;
});
- toolbarPasteExpandableLayout.collapse(false);
+
+ if (savedInstanceState != null) {
+ if (savedInstanceState.containsKey(OLD_GROUP_TO_UPDATE_KEY))
+ oldGroupToUpdate = (PwGroup) savedInstanceState.getSerializable(OLD_GROUP_TO_UPDATE_KEY);
+
+ if (savedInstanceState.containsKey(NODE_TO_COPY_KEY)) {
+ nodeToCopy = (PwNode) savedInstanceState.getSerializable(NODE_TO_COPY_KEY);
+ toolbarPaste.setOnMenuItemClickListener(new OnCopyMenuItemClickListener());
+ }
+ else if (savedInstanceState.containsKey(NODE_TO_MOVE_KEY)) {
+ nodeToMove = (PwNode) savedInstanceState.getSerializable(NODE_TO_MOVE_KEY);
+ toolbarPaste.setOnMenuItemClickListener(new OnMoveMenuItemClickListener());
+ }
+ }
addNodeButtonView.setAddGroupClickListener(v -> {
GroupEditDialogFragment.build()
@@ -210,6 +216,10 @@ public class GroupActivity extends ListNodesActivity
protected void onSaveInstanceState(Bundle outState) {
outState.putSerializable(GROUP_ID_KEY, mCurrentGroup.getId());
outState.putSerializable(OLD_GROUP_TO_UPDATE_KEY, oldGroupToUpdate);
+ if (nodeToCopy != null)
+ outState.putSerializable(NODE_TO_COPY_KEY, nodeToCopy);
+ if (nodeToMove != null)
+ outState.putSerializable(NODE_TO_MOVE_KEY, nodeToMove);
super.onSaveInstanceState(outState);
}
@@ -305,25 +315,32 @@ public class GroupActivity extends ListNodesActivity
public boolean onCopyMenuClick(PwNode node) {
toolbarPasteExpandableLayout.expand();
- toolbarPaste.setOnMenuItemClickListener(item -> {
+ nodeToCopy = node;
+ toolbarPaste.setOnMenuItemClickListener(new OnCopyMenuItemClickListener());
+ return false;
+ }
+
+ private class OnCopyMenuItemClickListener implements Toolbar.OnMenuItemClickListener{
+
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
toolbarPasteExpandableLayout.collapse();
switch (item.getItemId()) {
case R.id.menu_paste:
- switch (node.getType()) {
+ switch (nodeToCopy.getType()) {
case GROUP:
Log.e(TAG, "Copy not allowed for group");
break;
case ENTRY:
- copyNode((PwEntry) node, mCurrentGroup);
+ copyNode((PwEntry) nodeToCopy, mCurrentGroup);
break;
}
+ nodeToCopy = null;
return true;
}
return true;
- });
-
- return false;
+ }
}
private void copyNode(PwEntry entryToCopy, PwGroup newParent) {
@@ -341,25 +358,32 @@ public class GroupActivity extends ListNodesActivity
public boolean onMoveMenuClick(PwNode node) {
toolbarPasteExpandableLayout.expand();
- toolbarPaste.setOnMenuItemClickListener(item -> {
+ nodeToMove = node;
+ toolbarPaste.setOnMenuItemClickListener(new OnMoveMenuItemClickListener());
+ return false;
+ }
+
+ private class OnMoveMenuItemClickListener implements Toolbar.OnMenuItemClickListener{
+
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
toolbarPasteExpandableLayout.collapse();
switch (item.getItemId()) {
case R.id.menu_paste:
- switch (node.getType()) {
+ switch (nodeToMove.getType()) {
case GROUP:
- moveGroup((PwGroup) node, mCurrentGroup);
+ moveGroup((PwGroup) nodeToMove, mCurrentGroup);
break;
case ENTRY:
- moveEntry((PwEntry) node, mCurrentGroup);
+ moveEntry((PwEntry) nodeToMove, mCurrentGroup);
break;
}
+ nodeToMove = null;
return true;
}
return true;
- });
-
- return false;
+ }
}
private void moveGroup(PwGroup groupToMove, PwGroup newParent) {
diff --git a/app/src/main/res/drawable/ic_arrow_left_white_24dp.xml b/app/src/main/res/drawable/ic_arrow_left_white_24dp.xml
new file mode 100644
index 000000000..c433e1fa9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_left_white_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/list_nodes_fragment.xml b/app/src/main/res/layout/list_nodes_fragment.xml
index 26ace3d6d..2bdcfa380 100644
--- a/app/src/main/res/layout/list_nodes_fragment.xml
+++ b/app/src/main/res/layout/list_nodes_fragment.xml
@@ -3,4 +3,4 @@
android:id="@+id/nodes_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="?android:attr/colorBackground" />
\ No newline at end of file
+ android:background="?android:attr/windowBackground" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_nodes_with_add_button.xml b/app/src/main/res/layout/list_nodes_with_add_button.xml
index a353c1bc6..a942b6643 100644
--- a/app/src/main/res/layout/list_nodes_with_add_button.xml
+++ b/app/src/main/res/layout/list_nodes_with_add_button.xml
@@ -88,18 +88,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
- app:el_duration="250"
- app:el_expanded="true"
+ app:el_duration="300"
+ app:el_expanded="false"
app:el_parallax="0.5">
diff --git a/app/src/main/res/menu/node_paste_menu.xml b/app/src/main/res/menu/node_paste_menu.xml
index 2f482141c..3f51ca3ee 100644
--- a/app/src/main/res/menu/node_paste_menu.xml
+++ b/app/src/main/res/menu/node_paste_menu.xml
@@ -22,5 +22,5 @@
+ app:showAsAction="ifRoom|withText" />
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
index bd93afdab..2077f5448 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -19,6 +19,7 @@
-->
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3341ea272..90e609b7f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -127,6 +127,7 @@
Move
Paste
Delete
+ Cancel
Hide Pass
Lock Database
Open
@@ -134,7 +135,6 @@
Show pass
Remove the fingerprint key
Go to URL
- Where ?
Minus
Never
No search results
diff --git a/app/src/main/res/values/style_blue.xml b/app/src/main/res/values/style_blue.xml
index 94cea587d..500cc7c2c 100644
--- a/app/src/main/res/values/style_blue.xml
+++ b/app/src/main/res/values/style_blue.xml
@@ -29,6 +29,7 @@
- @color/blue_lighter
- @color/background_light
- @style/KeepassDXStyle.Toolbar.Blue
+ - @style/KeepassDXStyle.Toolbar.Bottom.Blue
- @style/KeepassDXStyle.ActionMode.Blue
@@ -40,6 +41,9 @@
- @color/colorTextInverse
- @color/blue_lighter
+
@@ -42,6 +43,9 @@
- @color/colorTextInverse
- @color/purple_lighter
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index a1c9ac57c..9b34d1b73 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -71,6 +71,7 @@
- @style/KeepassDXStyle.Toolbar.Light
- @style/KeepassDXStyle.Light.Toolbar.Popup
+ - @style/KeepassDXStyle.Toolbar.Night
- @style/KeepassDXStyle.ActionMode
@@ -124,6 +125,7 @@
- @style/KeepassDXStyle.Toolbar.Night
- @style/KeepassDXStyle.Night.Toolbar.Popup
+ - @style/KeepassDXStyle.Toolbar.Night
- @style/KeepassDXStyle.ActionMode