nicer layout for pass list

This commit is contained in:
zeapo 2014-10-19 18:14:35 +02:00
parent 24892e6a95
commit 639031737f
12 changed files with 354 additions and 25 deletions

Binary file not shown.

View file

@ -74,7 +74,7 @@ public class PasswordFragment extends Fragment{
}
@Override
public void onAttach(Activity activity) {
public void onAttach(final Activity activity) {
super.onAttach(activity);
try {
mListener = new OnFragmentInteractionListener() {
@ -89,6 +89,8 @@ public class PasswordFragment extends Fragment{
((ActionBarActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} else {
((PasswordStore) getActivity()).decryptPassword(item);
}
}

View file

@ -31,6 +31,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
@ -46,7 +47,7 @@ import com.zeapo.pwdstore.R;
import com.zeapo.pwdstore.UserPreference;
import com.zeapo.pwdstore.utils.PasswordRepository;
public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnBound{
public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConnection.OnBound{
private OpenPgpServiceConnection mServiceConnection;
@ -109,9 +110,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB
bindingDialog.show();
registered = true;
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}

View file

@ -1,5 +1,6 @@
package com.zeapo.pwdstore.utils;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@ -57,8 +58,29 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final PasswordItem pass = values.get(position);
holder.name.setText(pass.getName());
holder.type.setText((pass.getType() == PasswordItem.TYPE_CATEGORY ? "Category" : "Password"));
holder.name.setText(pass.toString());
int sdk = android.os.Build.VERSION.SDK_INT;
if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
holder.type.setText("C");
if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
holder.type.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.category_rectangle));
} else {
holder.type.setBackground(activity.getResources().getDrawable(R.drawable.category_rectangle));
}
holder.type.setTextColor(activity.getResources().getColor(R.color.deep_orange_50));
} else {
holder.type.setText("P");
if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
holder.type.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.password_rectangle));
} else {
holder.type.setBackground(activity.getResources().getDrawable(R.drawable.password_rectangle));
}
holder.type.setTextColor(activity.getResources().getColor(R.color.blue_grey_50));
}
holder.position = position;
holder.view.setOnClickListener(new View.OnClickListener() {

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" android:dither="true">
<corners android:topLeftRadius="2dp" android:bottomLeftRadius="2dp"/>
<solid android:color="@color/deep_orange_500" />
<padding android:bottom="16dp"
android:left="16dp"
android:right="16dp"
android:top="16dp" />
</shape>
</item>
</layer-list>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" android:dither="true">
<corners android:topLeftRadius="2dp" android:bottomLeftRadius="2dp"/>
<solid android:color="@color/blue_grey_500" />
<padding android:bottom="16dp"
android:left="16dp"
android:right="16dp"
android:top="16dp" />
</shape>
</item>
</layer-list>

View file

@ -5,20 +5,17 @@
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp"/>
<solid android:color="#ccc" />
<solid android:color="@color/blue_grey_200" />
</shape>
</item>
<item android:bottom="2dp">
<item android:bottom="2dp" android:left="1dp" android:right="1dp">
<shape android:shape="rectangle" android:dither="true">
<corners android:radius="2dp" />
<solid android:color="@android:color/white" />
<padding android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
<padding android:bottom="2dp" android:left="1dp"/>
</shape>
</item>
</layer-list>

View file

@ -2,7 +2,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eee"
tools:context=".pwdstore"
android:orientation="vertical">

View file

@ -3,25 +3,26 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/front"
android:tag="front"
android:background="@drawable/rectangle"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_gravity="start|center_vertical">
<TextView
android:id="@+id/type"
android:text="TYPE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_gravity="center_horizontal|center_vertical"
/>
<TextView
android:id="@+id/label"
android:text="FILE_NAME"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"

View file

@ -0,0 +1,277 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
<color name="red_800">#c41411</color>
<color name="red_900">#b0120a</color>
<color name="red_A100">#ff7997</color>
<color name="red_A200">#ff5177</color>
<color name="red_A400">#ff2d6f</color>
<color name="red_A700">#e00032</color>
<color name="pink_50">#fce4ec</color>
<color name="pink_100">#f8bbd0</color>
<color name="pink_200">#f48fb1</color>
<color name="pink_300">#f06292</color>
<color name="pink_400">#ec407a</color>
<color name="pink_500">#e91e63</color>
<color name="pink_600">#d81b60</color>
<color name="pink_700">#c2185b</color>
<color name="pink_800">#ad1457</color>
<color name="pink_900">#880e4f</color>
<color name="pink_A100">#ff80ab</color>
<color name="pink_A200">#ff4081</color>
<color name="pink_A400">#f50057</color>
<color name="pink_A700">#c51162</color>
<color name="purple_50">#f3e5f5</color>
<color name="purple_100">#e1bee7</color>
<color name="purple_200">#ce93d8</color>
<color name="purple_300">#ba68c8</color>
<color name="purple_400">#ab47bc</color>
<color name="purple_500">#9c27b0</color>
<color name="purple_600">#8e24aa</color>
<color name="purple_700">#7b1fa2</color>
<color name="purple_800">#6a1b9a</color>
<color name="purple_900">#4a148c</color>
<color name="purple_A100">#ea80fc</color>
<color name="purple_A200">#e040fb</color>
<color name="purple_A400">#d500f9</color>
<color name="purple_A700">#aa00ff</color>
<color name="dark_purple_50">#ede7f6</color>
<color name="dark_purple_100">#d1c4e9</color>
<color name="dark_purple_200">#b39ddb</color>
<color name="dark_purple_300">#9575cd</color>
<color name="dark_purple_400">#7e57c2</color>
<color name="dark_purple_500">#673ab7</color>
<color name="dark_purple_600">#5e35b1</color>
<color name="dark_purple_700">#512da8</color>
<color name="dark_purple_800">#4527a0</color>
<color name="dark_purple_900">#311b92</color>
<color name="dark_purple_A100">#b388ff</color>
<color name="dark_purple_A200">#7c4dff</color>
<color name="dark_purple_A400">#651fff</color>
<color name="dark_purple_A700">#6200ea</color>
<color name="indigo_50">#e8eaf6</color>
<color name="indigo_100">#c5cae9</color>
<color name="indigo_200">#9fa8da</color>
<color name="indigo_300">#7986cb</color>
<color name="indigo_400">#5c6bc0</color>
<color name="indigo_500">#3f51b5</color>
<color name="indigo_600">#3949ab</color>
<color name="indigo_700">#303f9f</color>
<color name="indigo_800">#283593</color>
<color name="indigo_900">#1a237e</color>
<color name="indigo_A100">#8c9eff</color>
<color name="indigo_A200">#536dfe</color>
<color name="indigo_A400">#3d5afe</color>
<color name="indigo_A700">#304ffe</color>
<color name="blue_50">#e7e9fd</color>
<color name="blue_100">#d0d9ff</color>
<color name="blue_200">#afbfff</color>
<color name="blue_300">#91a7ff</color>
<color name="blue_400">#738ffe</color>
<color name="blue_500">#5677fc</color>
<color name="blue_600">#4e6cef</color>
<color name="blue_700">#455ede</color>
<color name="blue_800">#3b50ce</color>
<color name="blue_900">#2a36b1</color>
<color name="blue_A100">#a6baff</color>
<color name="blue_A200">#6889ff</color>
<color name="blue_A400">#4d73ff</color>
<color name="blue_A700">#4d69ff</color>
<color name="light_blue_50">#e1f5fe</color>
<color name="light_blue_100">#b3e5fc</color>
<color name="light_blue_200">#81d4fa</color>
<color name="light_blue_300">#4fc3f7</color>
<color name="light_blue_400">#29b6f6</color>
<color name="light_blue_500">#03a9f4</color>
<color name="light_blue_600">#039be5</color>
<color name="light_blue_700">#0288d1</color>
<color name="light_blue_800">#0277bd</color>
<color name="light_blue_900">#01579b</color>
<color name="light_blue_A100">#80d8ff</color>
<color name="light_blue_A200">#40c4ff</color>
<color name="light_blue_A400">#00b0ff</color>
<color name="light_blue_A700">#0091ea</color>
<color name="cyan_50">#e0f7fa</color>
<color name="cyan_100">#b2ebf2</color>
<color name="cyan_200">#80deea</color>
<color name="cyan_300">#4dd0e1</color>
<color name="cyan_400">#26c6da</color>
<color name="cyan_500">#00bcd4</color>
<color name="cyan_600">#00acc1</color>
<color name="cyan_700">#0097a7</color>
<color name="cyan_800">#00838f</color>
<color name="cyan_900">#006064</color>
<color name="cyan_A100">#84ffff</color>
<color name="cyan_A200">#18ffff</color>
<color name="cyan_A400">#00e5ff</color>
<color name="cyan_A700">#00b8d4</color>
<color name="teal_50">#e0f2f1</color>
<color name="teal_100">#b2dfdb</color>
<color name="teal_200">#80cbc4</color>
<color name="teal_300">#4db6ac</color>
<color name="teal_400">#26a69a</color>
<color name="teal_500">#9688</color>
<color name="teal_600">#00897b</color>
<color name="teal_700">#00796b</color>
<color name="teal_800">#00695c</color>
<color name="teal_900">#004d40</color>
<color name="teal_A100">#a7ffeb</color>
<color name="teal_A200">#64ffda</color>
<color name="teal_A400">#1de9b6</color>
<color name="teal_A700">#00bfa5</color>
<color name="green_50">#d0f8ce</color>
<color name="green_100">#a3e9a4</color>
<color name="green_200">#72d572</color>
<color name="green_300">#42bd41</color>
<color name="green_400">#2baf2b</color>
<color name="green_500">#259b24</color>
<color name="green_600">#0a8f08</color>
<color name="green_700">#0a7e07</color>
<color name="green_800">#056f00</color>
<color name="green_900">#0d5302</color>
<color name="green_A100">#a2f78d</color>
<color name="green_A200">#5af158</color>
<color name="green_A400">#14e715</color>
<color name="green_A700">#12c700</color>
<color name="light_green_50">#f1f8e9</color>
<color name="light_green_100">#dcedc8</color>
<color name="light_green_200">#c5e1a5</color>
<color name="light_green_300">#aed581</color>
<color name="light_green_400">#9ccc65</color>
<color name="light_green_500">#8bc34a</color>
<color name="light_green_600">#7cb342</color>
<color name="light_green_700">#689f38</color>
<color name="light_green_800">#558b2f</color>
<color name="light_green_900">#33691e</color>
<color name="light_green_A100">#ccff90</color>
<color name="light_green_A200">#b2ff59</color>
<color name="light_green_A400">#76ff03</color>
<color name="light_green_A700">#64dd17</color>
<color name="lime_50">#f9fbe7</color>
<color name="lime_100">#f0f4c3</color>
<color name="lime_200">#e6ee9c</color>
<color name="lime_300">#dce775</color>
<color name="lime_400">#d4e157</color>
<color name="lime_500">#cddc39</color>
<color name="lime_600">#c0ca33</color>
<color name="lime_700">#afb42b</color>
<color name="lime_800">#9e9d24</color>
<color name="lime_900">#827717</color>
<color name="lime_A100">#f4ff81</color>
<color name="lime_A200">#eeff41</color>
<color name="lime_A400">#c6ff00</color>
<color name="lime_A700">#aeea00</color>
<color name="yellow_50">#fffde7</color>
<color name="yellow_100">#fff9c4</color>
<color name="yellow_200">#fff59d</color>
<color name="yellow_300">#fff176</color>
<color name="yellow_400">#ffee58</color>
<color name="yellow_500">#ffeb3b</color>
<color name="yellow_600">#fdd835</color>
<color name="yellow_700">#fbc02d</color>
<color name="yellow_800">#f9a825</color>
<color name="yellow_900">#f57f17</color>
<color name="yellow_A100">#ffff8d</color>
<color name="yellow_A200">#ffff00</color>
<color name="yellow_A400">#ffea00</color>
<color name="yellow_A700">#ffd600</color>
<color name="amber_50">#fff8e1</color>
<color name="amber_100">#ffecb3</color>
<color name="amber_200">#ffe082</color>
<color name="amber_300">#ffd54f</color>
<color name="amber_400">#ffca28</color>
<color name="amber_500">#ffc107</color>
<color name="amber_600">#ffb300</color>
<color name="amber_700">#ffa000</color>
<color name="amber_800">#ff8f00</color>
<color name="amber_900">#ff6f00</color>
<color name="amber_A100">#ffe57f</color>
<color name="amber_A200">#ffd740</color>
<color name="amber_A400">#ffc400</color>
<color name="amber_A700">#ffab00</color>
<color name="orange_50">#fff3e0</color>
<color name="orange_100">#ffe0b2</color>
<color name="orange_200">#ffcc80</color>
<color name="orange_300">#ffb74d</color>
<color name="orange_400">#ffa726</color>
<color name="orange_500">#ff9800</color>
<color name="orange_600">#fb8c00</color>
<color name="orange_700">#f57c00</color>
<color name="orange_800">#ef6c00</color>
<color name="orange_900">#e65100</color>
<color name="orange_A100">#ffd180</color>
<color name="orange_A200">#ffab40</color>
<color name="orange_A400">#ff9100</color>
<color name="orange_A700">#ff6d00</color>
<color name="deep_orange_50">#fbe9e7</color>
<color name="deep_orange_100">#ffccbc</color>
<color name="deep_orange_200">#ffab91</color>
<color name="deep_orange_300">#ff8a65</color>
<color name="deep_orange_400">#ff7043</color>
<color name="deep_orange_500">#ff5722</color>
<color name="deep_orange_600">#f4511e</color>
<color name="deep_orange_700">#e64a19</color>
<color name="deep_orange_800">#d84315</color>
<color name="deep_orange_900">#bf360c</color>
<color name="deep_orange_A100">#ff9e80</color>
<color name="deep_orange_A200">#ff6e40</color>
<color name="deep_orange_A400">#ff3d00</color>
<color name="deep_orange_A700">#dd2c00</color>
<color name="brown_50">#efebe9</color>
<color name="brown_100">#d7ccc8</color>
<color name="brown_200">#bcaaa4</color>
<color name="brown_300">#a1887f</color>
<color name="brown_400">#8d6e63</color>
<color name="brown_500">#795548</color>
<color name="brown_600">#6d4c41</color>
<color name="brown_700">#5d4037</color>
<color name="brown_800">#4e342e</color>
<color name="brown_900">#3e2723</color>
<color name="grey_50">#fafafa</color>
<color name="grey_100">#f5f5f5</color>
<color name="grey_200">#eeeeee</color>
<color name="grey_300">#e0e0e0</color>
<color name="grey_400">#bdbdbd</color>
<color name="grey_500">#9e9e9e</color>
<color name="grey_600">#757575</color>
<color name="grey_700">#616161</color>
<color name="grey_800">#424242</color>
<color name="grey_900">#212121</color>
<color name="grey_black_1000">#000000</color>
<color name="grey_white_1000">#ffffff</color>
<color name="blue_grey_50">#eceff1</color>
<color name="blue_grey_100">#cfd8dc</color>
<color name="blue_grey_200">#b0bec5</color>
<color name="blue_grey_300">#90a4ae</color>
<color name="blue_grey_400">#78909c</color>
<color name="blue_grey_500">#607d8b</color>
<color name="blue_grey_600">#546e7a</color>
<color name="blue_grey_700">#455a64</color>
<color name="blue_grey_800">#37474f</color>
<color name="blue_grey_900">#263238</color>
</resources>

View file

@ -8,7 +8,4 @@
For more on layout aliases, see:
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
-->
<item name="fragment_password" type="layout">@layout/fragment_password_list</item>
</resources>

View file

@ -1,6 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/blue_grey_500</item>
<item name="colorPrimaryDark">@color/blue_grey_500</item>
<item name="android:windowBackground">@color/blue_grey_100</item>
<item name="android:textColorPrimary">@color/blue_grey_50</item>
<item name="android:textColor">@color/blue_grey_900</item>
</style>
</resources>