some improvements to decrypt ui

This commit is contained in:
knuthy 2014-08-15 13:36:14 +02:00
parent ffadf9e8b6
commit e6ad605d17
6 changed files with 83 additions and 35 deletions

View File

@ -171,6 +171,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
return; return;
} }
PasswordRepository.createRepository(localDir); PasswordRepository.createRepository(localDir);
checkLocalRepository();
} }
} }

View File

@ -20,6 +20,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.GridLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
@ -98,6 +99,10 @@ public class PgpHandler extends Activity {
if (extra.getString("Operation").equals("DECRYPT")) { if (extra.getString("Operation").equals("DECRYPT")) {
setContentView(R.layout.decrypt_layout); setContentView(R.layout.decrypt_layout);
((TextView) findViewById(R.id.crypto_password_file)).setText(extra.getString("NAME")); ((TextView) findViewById(R.id.crypto_password_file)).setText(extra.getString("NAME"));
String cat = new File(extra.getString("FILE_PATH").replace(PasswordRepository.getWorkTree().getAbsolutePath(), ""))
.getParentFile().getName();
((TextView) findViewById(R.id.crypto_password_category)).setText(cat + "/");
} else if (extra.getString("Operation").equals("ENCRYPT")) { } else if (extra.getString("Operation").equals("ENCRYPT")) {
setContentView(R.layout.encrypt_layout); setContentView(R.layout.encrypt_layout);
String cat = extra.getString("FILE_PATH"); String cat = extra.getString("FILE_PATH");
@ -221,6 +226,7 @@ public class PgpHandler extends Activity {
protected void onPostExecute(Boolean b) { protected void onPostExecute(Boolean b) {
//clear password //clear password
((TextView) findViewById(R.id.crypto_password_show)).setText(""); ((TextView) findViewById(R.id.crypto_password_show)).setText("");
((TextView) findViewById(R.id.crypto_extra_show)).setText("");
findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE); findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE);
findViewById(R.id.crypto_container).setVisibility(View.INVISIBLE); findViewById(R.id.crypto_container).setVisibility(View.INVISIBLE);
} }

View File

@ -0,0 +1,24 @@
<?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:radius="2dp"/>
<solid android:color="#ccc" />
</shape>
</item>
<item>
<shape android:shape="rectangle" android:dither="true">
<corners android:radius="2dp" />
<solid android:color="@android:color/holo_blue_light" />
<padding android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
</shape>
</item>
</layer-list>

View File

@ -10,7 +10,7 @@
</shape> </shape>
</item> </item>
<item android:bottom="2dp"> <item>
<shape android:shape="rectangle" android:dither="true"> <shape android:shape="rectangle" android:dither="true">
<corners android:radius="2dp" /> <corners android:radius="2dp" />
<solid android:color="@android:color/holo_red_light" /> <solid android:color="@android:color/holo_red_light" />

View File

@ -1,12 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.zeapo.pwdstore.crypto.PgpHandler" tools:context="com.zeapo.pwdstore.crypto.PgpHandler"
android:orientation="vertical" android:orientation="vertical"
android:background="#eee"> android:background="#eee">
@ -19,30 +15,59 @@
<GridLayout <GridLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rectangle" android:background="@drawable/rectangle">
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_blue_light"
android:text="CATEGORY HERE"
android:id="@+id/crypto_password_category"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_column="0"
android:layout_row="0"
android:layout_columnSpan="2"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@android:color/holo_orange_dark" android:textColor="@android:color/holo_orange_dark"
android:text="Large Text" android:textStyle="bold"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
android:text="PASSWORD FILE NAME HERE"
android:id="@+id/crypto_password_file" android:id="@+id/crypto_password_file"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_column="0" android:layout_column="0"
android:layout_row="0"/> android:layout_columnSpan="2"
android:layout_row="1"/>
<ImageButton
android:id="@+id/crypto_delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ico_del"
android:background="@drawable/red_rectangle"
android:layout_gravity="center_vertical"
android:onClick="handleClick"
android:layout_column="3"
android:layout_row="0"
android:layout_rowSpan="2"/>
<ImageButton <ImageButton
android:id="@+id/crypto_show_button" android:id="@+id/crypto_show_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ico_key" android:src="@drawable/ico_key"
android:background="@android:drawable/screen_background_light_transparent" android:background="@drawable/blue_rectangle"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:onClick="handleClick" android:onClick="handleClick"
android:layout_column="2" android:layout_column="4"
android:layout_row="0"/> android:layout_row="0"
android:layout_rowSpan="2"/>
</GridLayout> </GridLayout>
@ -53,6 +78,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rectangle" android:background="@drawable/rectangle"
android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:visibility="invisible"> android:visibility="invisible">
<GridLayout <GridLayout
@ -102,16 +131,12 @@
android:textStyle="bold" android:textStyle="bold"
android:textColor="@android:color/black" android:textColor="@android:color/black"
android:text="Extra content: "/> android:text="Extra content: "/>
<ScrollView <TextView
android:layout_width="wrap_content" android:id="@+id/crypto_extra_show"
android:layout_height="wrap_content"> android:layout_width="match_parent"
<TextView android:layout_height="wrap_content"
android:id="@+id/crypto_extra_show" android:textColor="@android:color/black"
android:layout_width="match_parent" android:typeface="monospace"/>
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:typeface="monospace"/>
</ScrollView>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -119,15 +144,4 @@
</LinearLayout> </LinearLayout>
<ImageButton </ScrollView>
android:id="@+id/crypto_delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ico_del"
android:background="@drawable/oval"
android:layout_gravity="center_vertical"
android:onClick="handleClick"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"/>
</RelativeLayout>

View File

@ -26,5 +26,8 @@
<string name="crypto_pass_label">Password</string> <string name="crypto_pass_label">Password</string>
<string name="crypto_extra_label">Extra</string> <string name="crypto_extra_label">Extra</string>
<!-- DECRYPT Layout -->
<string name="crypto_category">Category</string>
</resources> </resources>