some ui improvements (icons and return from pgphandler to top)

This commit is contained in:
Zeapo 2014-08-06 17:25:47 +01:00
parent 42d22abfbc
commit b1896c4221
8 changed files with 26 additions and 6 deletions

View file

@ -177,7 +177,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
intent.putExtra("NAME", item.getName());
intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath());
intent.putExtra("Operation", "DECRYPT");
startActivity(intent);
startActivityForResult(intent, 0);
} catch (IOException e) {
e.printStackTrace();
@ -201,9 +201,16 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
intent.putExtra("NAME", "test.gpg");
intent.putExtra("FILE_PATH", this.currentDir.getAbsolutePath());
intent.putExtra("Operation", "ENCRYPT");
// TODO Define different operations here
startActivityForResult(intent, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
System.out.println(resultCode);
checkLocalRepository(this.currentDir);
}
}

View file

@ -92,6 +92,11 @@ public class PgpHandler extends Activity {
mServiceConnection = new OpenPgpServiceConnection(
PgpHandler.this, providerPackageName);
mServiceConnection.bindToService();
ActionBar actionBar = getActionBar();
// actionBar.setHomeButtonEnabled(true);
// actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}
@ -108,8 +113,10 @@ public class PgpHandler extends Activity {
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
switch (id) {
case android.R.id.home:
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
@ -123,6 +130,7 @@ public class PgpHandler extends Activity {
encrypt(new Intent());
break;
case R.id.crypto_cancel_add:
finish();
break;
default:
// should not happen
@ -257,11 +265,12 @@ public class PgpHandler extends Activity {
+ ".gpg";
OutputStream outputStream = FileUtils.openOutputStream(new File(path));
outputStream.write(os.toByteArray());
finishActivity(0);
} else {
showToast(os.toString());
}
setResult(998);
finish();
} catch (Exception e) {
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
}
@ -330,6 +339,7 @@ public class PgpHandler extends Activity {
public void encrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
// TODO add preference so that the user sets his account name
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[] {"default"});
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 1,021 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -32,7 +32,7 @@
android:id="@+id/crypto_show_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_input_get"
android:src="@drawable/ic_key"
android:background="@android:drawable/screen_background_light_transparent"
android:layout_gravity="center_vertical"
android:visibility="invisible"

View file

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">PwdStore</string>
<!-- Activity names -->
<string name="app_name">Password Store</string>
<string name="activity_clone_name">Clone a Git repo</string>
<string name="clone_settings">Clone</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>