From b36d082b9f91c4fe6e9c360fe5e2fe914c88589b Mon Sep 17 00:00:00 2001 From: DSIW Date: Fri, 10 Jun 2016 03:13:09 +0200 Subject: Restyle password cards --- .../pwdstore/utils/PasswordRecyclerAdapter.java | 27 ++++---- app/src/main/res/layout/password_recycler_view.xml | 6 +- app/src/main/res/layout/password_row_layout.xml | 72 +++++++++++++--------- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java index 45dd0d0b..3f240515 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -71,19 +71,18 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter + android:layout_height="match_parent"/> - + android:layout_marginBottom="0dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:layout_marginTop="0dp"> - + card_view:cardElevation="4dp" + card_view:cardUseCompatPadding="true" + card_view:contentPaddingLeft="4dp" + card_view:contentPaddingTop="4dp"> - - - - \ No newline at end of file + android:gravity="left"> + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 09f12c81c12ed1993446e98779661d25ced42ad3 Mon Sep 17 00:00:00 2001 From: DSIW Date: Fri, 10 Jun 2016 03:23:35 +0200 Subject: Remove CardView and use divider for separation --- .../com/zeapo/pwdstore/DividerItemDecoration.java | 51 +++++++++++++++++ .../java/com/zeapo/pwdstore/PasswordFragment.java | 7 ++- .../pwdstore/utils/PasswordRecyclerAdapter.java | 18 +++--- app/src/main/res/drawable/divider.xml | 6 ++ app/src/main/res/layout/password_row_layout.xml | 66 +++++++++------------- 5 files changed, 97 insertions(+), 51 deletions(-) create mode 100644 app/src/main/java/com/zeapo/pwdstore/DividerItemDecoration.java create mode 100644 app/src/main/res/drawable/divider.xml diff --git a/app/src/main/java/com/zeapo/pwdstore/DividerItemDecoration.java b/app/src/main/java/com/zeapo/pwdstore/DividerItemDecoration.java new file mode 100644 index 00000000..7bc66b62 --- /dev/null +++ b/app/src/main/java/com/zeapo/pwdstore/DividerItemDecoration.java @@ -0,0 +1,51 @@ +package com.zeapo.pwdstore; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; +import android.support.v4.content.ContextCompat; +import android.support.v7.widget.RecyclerView; +import android.view.View; + +public class DividerItemDecoration extends RecyclerView.ItemDecoration { + + private static final int[] ATTRS = new int[]{android.R.attr.listDivider}; + + private Drawable mDivider; + + /** + * Default divider will be used + */ + public DividerItemDecoration(Context context) { + final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS); + mDivider = styledAttributes.getDrawable(0); + styledAttributes.recycle(); + } + + /** + * Custom divider will be used + */ + public DividerItemDecoration(Context context, int resId) { + mDivider = ContextCompat.getDrawable(context, resId); + } + + @Override + public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { + int left = parent.getPaddingLeft(); + int right = parent.getWidth() - parent.getPaddingRight(); + + int childCount = parent.getChildCount(); + for (int i = 0; i < childCount; i++) { + View child = parent.getChildAt(i); + + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams(); + + int top = child.getBottom() + params.bottomMargin; + int bottom = top + mDivider.getIntrinsicHeight(); + + mDivider.setBounds(left, top, right, bottom); + mDivider.draw(c); + } + } +} diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java index 1daa4f90..79401fbd 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordFragment.java @@ -74,8 +74,11 @@ public class PasswordFragment extends Fragment{ recyclerView = (RecyclerView) view.findViewById(R.id.pass_recycler); recyclerView.setLayoutManager(mLayoutManager); -// -// // Set the adapter + + // use divider + recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), R.drawable.divider)); + + // Set the adapter recyclerView.setAdapter(recyclerAdapter); final FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab); diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java index 3f240515..af9a6776 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -33,14 +33,12 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/password_row_layout.xml b/app/src/main/res/layout/password_row_layout.xml index 61c089df..0b877934 100644 --- a/app/src/main/res/layout/password_row_layout.xml +++ b/app/src/main/res/layout/password_row_layout.xml @@ -8,49 +8,37 @@ android:layout_marginRight="8dp" android:layout_marginTop="0dp"> - + android:padding="8dp" + android:gravity="left"> - + android:alpha="0.5" + android:maxLines="1" + android:ellipsize="start" + android:text="TYPE" + android:textSize="14dp" + android:textColor="@android:color/black" + android:layout_alignParentTop="true" + android:layout_alignLeft="@+id/label" + android:layout_alignStart="@+id/label" /> - + + - - - \ No newline at end of file -- cgit v1.2.3 From 0e700ce21b042030f41d3c488807afb925461f08 Mon Sep 17 00:00:00 2001 From: DSIW Date: Fri, 10 Jun 2016 04:49:35 +0200 Subject: Add icons to list item --- .../pwdstore/utils/PasswordRecyclerAdapter.java | 13 +++++++- .../main/res/drawable-hdpi/ic_action_secure.png | Bin 0 -> 394 bytes .../res/drawable-hdpi/ic_folder_grey600_24dp.png | Bin 0 -> 140 bytes .../main/res/drawable-mdpi/ic_action_secure.png | Bin 0 -> 317 bytes .../res/drawable-mdpi/ic_folder_grey600_24dp.png | Bin 0 -> 123 bytes .../main/res/drawable-xhdpi/ic_action_secure.png | Bin 0 -> 510 bytes .../res/drawable-xhdpi/ic_folder_grey600_24dp.png | Bin 0 -> 194 bytes .../main/res/drawable-xxhdpi/ic_action_secure.png | Bin 0 -> 624 bytes .../res/drawable-xxhdpi/ic_folder_grey600_24dp.png | Bin 0 -> 259 bytes app/src/main/res/layout/password_row_layout.xml | 34 +++++++++++++-------- 10 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/ic_action_secure.png create mode 100644 app/src/main/res/drawable-hdpi/ic_folder_grey600_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_action_secure.png create mode 100644 app/src/main/res/drawable-mdpi/ic_folder_grey600_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_action_secure.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_folder_grey600_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_secure.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_folder_grey600_24dp.png diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java index af9a6776..e1b33e2a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -1,5 +1,6 @@ package com.zeapo.pwdstore.utils; +import android.os.Build; import android.support.v7.view.ActionMode; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; @@ -8,6 +9,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import com.zeapo.pwdstore.PasswordFragment; @@ -35,12 +37,14 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter + android:layout_height="wrap_content"> + + + android:textColor="@color/grey_500" + android:layout_alignTop="@+id/type_image" + android:layout_toRightOf="@+id/type_image" + android:layout_toEndOf="@+id/type_image" /> + android:layout_alignLeft="@+id/type" + android:layout_alignStart="@+id/type" /> \ No newline at end of file -- cgit v1.2.3 From 7a25cbf1d69d74142e1f694481a8aebbb90ab466 Mon Sep 17 00:00:00 2001 From: DSIW Date: Fri, 10 Jun 2016 04:50:24 +0200 Subject: Fix multiple selection with RecyclerView --- .../pwdstore/utils/PasswordRecyclerAdapter.java | 33 +++++++++++----------- app/src/main/res/layout/password_recycler_view.xml | 2 +- app/src/main/res/layout/password_row_layout.xml | 2 +- app/src/main/res/values/colors.xml | 2 ++ 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java index e1b33e2a..e9109bce 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -1,8 +1,8 @@ package com.zeapo.pwdstore.utils; +import android.graphics.Color; import android.os.Build; import android.support.v7.view.ActionMode; -import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.Menu; @@ -91,7 +91,8 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter + android:background="?android:attr/activatedBackgroundIndicator"> + #ff7043 + #fde0dc #f9bdbb #f69988 -- cgit v1.2.3 From da1e95241db7c4377058c1abff9115ca3557c81a Mon Sep 17 00:00:00 2001 From: DSIW Date: Fri, 10 Jun 2016 05:43:56 +0200 Subject: Restyle password entry activity --- app/src/main/res/drawable/category_rectangle.xml | 15 --------- app/src/main/res/drawable/gray_rectangle.xml | 24 -------------- app/src/main/res/drawable/oval.xml | 37 ---------------------- app/src/main/res/drawable/password_rectangle.xml | 15 --------- .../main/res/drawable/password_row_background.xml | 5 --- app/src/main/res/layout/activity_pgp_handler.xml | 1 - app/src/main/res/layout/decrypt_layout.xml | 26 ++++++++------- app/src/main/res/layout/encrypt_layout.xml | 2 -- 8 files changed, 15 insertions(+), 110 deletions(-) delete mode 100644 app/src/main/res/drawable/category_rectangle.xml delete mode 100644 app/src/main/res/drawable/gray_rectangle.xml delete mode 100644 app/src/main/res/drawable/oval.xml delete mode 100644 app/src/main/res/drawable/password_rectangle.xml delete mode 100644 app/src/main/res/drawable/password_row_background.xml diff --git a/app/src/main/res/drawable/category_rectangle.xml b/app/src/main/res/drawable/category_rectangle.xml deleted file mode 100644 index 1516662d..00000000 --- a/app/src/main/res/drawable/category_rectangle.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/gray_rectangle.xml b/app/src/main/res/drawable/gray_rectangle.xml deleted file mode 100644 index b1858c80..00000000 --- a/app/src/main/res/drawable/gray_rectangle.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/oval.xml b/app/src/main/res/drawable/oval.xml deleted file mode 100644 index d2149d04..00000000 --- a/app/src/main/res/drawable/oval.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/password_rectangle.xml b/app/src/main/res/drawable/password_rectangle.xml deleted file mode 100644 index e1a19127..00000000 --- a/app/src/main/res/drawable/password_rectangle.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/password_row_background.xml b/app/src/main/res/drawable/password_row_background.xml deleted file mode 100644 index 8f39b056..00000000 --- a/app/src/main/res/drawable/password_row_background.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_pgp_handler.xml b/app/src/main/res/layout/activity_pgp_handler.xml index b5dfba53..3c79b37d 100644 --- a/app/src/main/res/layout/activity_pgp_handler.xml +++ b/app/src/main/res/layout/activity_pgp_handler.xml @@ -13,7 +13,6 @@ + android:textSize="18dp" + android:textIsSelectable="false" + android:layout_marginLeft="16dp" /> + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:textSize="24dp" /> + + @@ -40,7 +39,6 @@ android:layout_height="fill_parent" android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/rectangle" android:layout_weight="1"> Date: Fri, 10 Jun 2016 06:30:25 +0200 Subject: Restyle new password formular --- .../java/com/zeapo/pwdstore/crypto/PgpHandler.java | 23 +++-- app/src/main/res/drawable-hdpi/ic_action_save.png | Bin 394 -> 0 bytes app/src/main/res/drawable-mdpi/ic_action_save.png | Bin 362 -> 0 bytes app/src/main/res/drawable-xhdpi/ic_action_save.png | Bin 441 -> 0 bytes .../main/res/drawable-xxhdpi/ic_action_save.png | Bin 495 -> 0 bytes app/src/main/res/drawable/selected_rectangle.xml | 21 ----- app/src/main/res/layout/encrypt_layout.xml | 102 ++++++++------------- app/src/main/res/menu/pgp_handler_new_password.xml | 15 +++ 8 files changed, 69 insertions(+), 92 deletions(-) delete mode 100644 app/src/main/res/drawable-hdpi/ic_action_save.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_action_save.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_action_save.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_action_save.png delete mode 100644 app/src/main/res/drawable/selected_rectangle.xml create mode 100644 app/src/main/res/menu/pgp_handler_new_password.xml diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index a80e4800..f984ad31 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -81,6 +81,10 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne this.activity = this; this.clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + if (getIntent().getStringExtra("Operation").equals("ENCRYPT")) { + setTitle("New password"); + } + // some persistance settings = PreferenceManager.getDefaultSharedPreferences(this); String providerPackageName = settings.getString("openpgp_provider_list", ""); @@ -121,7 +125,11 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.pgp_handler, menu); + if (getIntent().getStringExtra("Operation").equals("ENCRYPT")) { + getMenuInflater().inflate(R.menu.pgp_handler_new_password, menu); + } else { + getMenuInflater().inflate(R.menu.pgp_handler, menu); + } return true; } @@ -141,6 +149,13 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne break; case R.id.edit_password: editPassword(); + case R.id.crypto_confirm_add: + encrypt(new Intent()); + break; + case R.id.crypto_cancel_add: + setResult(RESULT_CANCELED); + finish(); + return true; } return super.onOptionsItemSelected(item); } @@ -205,12 +220,6 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne case R.id.crypto_show_button: decryptAndVerify(new Intent()); break; - case R.id.crypto_confirm_add: - encrypt(new Intent()); - break; - case R.id.crypto_cancel_add: - finish(); - break; case R.id.crypto_delete_button: // deletePassword(); break; diff --git a/app/src/main/res/drawable-hdpi/ic_action_save.png b/app/src/main/res/drawable-hdpi/ic_action_save.png deleted file mode 100644 index 0fe36a1e..00000000 Binary files a/app/src/main/res/drawable-hdpi/ic_action_save.png and /dev/null differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_save.png b/app/src/main/res/drawable-mdpi/ic_action_save.png deleted file mode 100644 index 664260d8..00000000 Binary files a/app/src/main/res/drawable-mdpi/ic_action_save.png and /dev/null differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_save.png b/app/src/main/res/drawable-xhdpi/ic_action_save.png deleted file mode 100644 index dde278b5..00000000 Binary files a/app/src/main/res/drawable-xhdpi/ic_action_save.png and /dev/null differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_save.png b/app/src/main/res/drawable-xxhdpi/ic_action_save.png deleted file mode 100644 index ccf8c82c..00000000 Binary files a/app/src/main/res/drawable-xxhdpi/ic_action_save.png and /dev/null differ diff --git a/app/src/main/res/drawable/selected_rectangle.xml b/app/src/main/res/drawable/selected_rectangle.xml deleted file mode 100644 index ec8d2ad8..00000000 --- a/app/src/main/res/drawable/selected_rectangle.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/encrypt_layout.xml b/app/src/main/res/layout/encrypt_layout.xml index 1ee8e3c9..98a6b04d 100644 --- a/app/src/main/res/layout/encrypt_layout.xml +++ b/app/src/main/res/layout/encrypt_layout.xml @@ -5,24 +5,24 @@ android:layout_height="match_parent" android:orientation="vertical" tools:context="com.zeapo.pwdstore.crypto.PgpHandler" - android:background="#eee"> + android:background="#eee" + android:padding="@dimen/activity_horizontal_margin"> + android:orientation="vertical"> + android:textColor="@color/grey_500" + android:text="CATEGORY HERE" + android:id="@+id/crypto_password_category" + android:layout_gravity="center_vertical" + android:textSize="18dp" + android:textIsSelectable="false" + android:layout_marginLeft="@dimen/activity_horizontal_margin" /> - + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" + android:textSize="24dp" + android:textColor="@color/accent" /> - + android:layout_height="wrap_content"> - @@ -57,20 +55,29 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" - android:text="@string/crypto_pass_label"/> - -