prettify upload key

This commit is contained in:
Dominik Schürmann 2014-01-18 20:40:41 +01:00
parent b6240f8927
commit b4b2a12a45
3 changed files with 60 additions and 72 deletions

View File

@ -1,18 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
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:orientation="vertical" >
<Spinner <LinearLayout
android:id="@+id/sign_key_keyserver" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn_export_to_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/btn_export_to_server" /> android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical" >
</LinearLayout> <TextView
style="@style/SectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="14dp"
android:text="@string/section_key_server" />
<Spinner
android:id="@+id/sign_key_keyserver"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/btn_export_to_server"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="14dp"
android:text="@string/btn_export_to_server"
bootstrapbutton:bb_icon_left="fa-upload"
bootstrapbutton:bb_type="info" />
</LinearLayout>
</ScrollView>

View File

@ -1,21 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de>
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources> <resources>
<!-- title --> <!-- title -->
@ -41,7 +24,7 @@
<string name="title_export_keys">Export Keys</string> <string name="title_export_keys">Export Keys</string>
<string name="title_key_not_found">Key Not Found</string> <string name="title_key_not_found">Key Not Found</string>
<string name="title_key_server_query">Query Key Server</string> <string name="title_key_server_query">Query Key Server</string>
<string name="title_send_key">Export to Key Server</string> <string name="title_send_key">Upload to Key Server</string>
<string name="title_unknown_signature_key">Unknown Signature Key</string> <string name="title_unknown_signature_key">Unknown Signature Key</string>
<string name="title_sign_key">Sign Key</string> <string name="title_sign_key">Sign Key</string>
<string name="title_key_details">Key Details</string> <string name="title_key_details">Key Details</string>
@ -59,6 +42,7 @@
<string name="section_actions">Actions</string> <string name="section_actions">Actions</string>
<string name="section_signing_key">Your Key used for Signing</string> <string name="section_signing_key">Your Key used for Signing</string>
<string name="section_upload_key">Upload Key</string> <string name="section_upload_key">Upload Key</string>
<string name="section_key_server">Key Server</string>
<!-- button --> <!-- button -->
<string name="btn_sign_to_clipboard">Sign (Clipboard)</string> <string name="btn_sign_to_clipboard">Sign (Clipboard)</string>
@ -78,7 +62,7 @@
<string name="btn_change_passphrase">Change Passphrase</string> <string name="btn_change_passphrase">Change Passphrase</string>
<string name="btn_set_passphrase">Set Passphrase</string> <string name="btn_set_passphrase">Set Passphrase</string>
<string name="btn_search">Search</string> <string name="btn_search">Search</string>
<string name="btn_export_to_server">Export To Server</string> <string name="btn_export_to_server">Upload To Key Server</string>
<string name="btn_next">Next</string> <string name="btn_next">Next</string>
<string name="btn_back">Back</string> <string name="btn_back">Back</string>
@ -98,8 +82,8 @@
<string name="menu_edit_key">Edit key</string> <string name="menu_edit_key">Edit key</string>
<string name="menu_search">Search</string> <string name="menu_search">Search</string>
<string name="menu_key_server">Import from key server</string> <string name="menu_key_server">Import from key server</string>
<string name="menu_update_key">Update from server</string> <string name="menu_update_key">Update from key server</string>
<string name="menu_export_key_to_server">Export to server</string> <string name="menu_export_key_to_server">Upload to key server</string>
<string name="menu_share">Share with…</string> <string name="menu_share">Share with…</string>
<string name="menu_share_qr_code">Share with QR Code</string> <string name="menu_share_qr_code">Share with QR Code</string>
<string name="menu_share_nfc">Share with NFC</string> <string name="menu_share_nfc">Share with NFC</string>
@ -139,7 +123,7 @@
<string name="label_name">Name</string> <string name="label_name">Name</string>
<string name="label_comment">Comment</string> <string name="label_comment">Comment</string>
<string name="label_email">Email</string> <string name="label_email">Email</string>
<string name="label_send_key">Upload key to selected keyserver after signing</string> <string name="label_send_key">Upload key to selected key server after signing</string>
<string name="label_fingerprint">Fingerprint</string> <string name="label_fingerprint">Fingerprint</string>
<string name="no_keys_selected">Select</string> <string name="no_keys_selected">Select</string>
<string name="one_key_selected">1 Selected</string> <string name="one_key_selected">1 Selected</string>

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Dominik Schürmann <dominik@dominikschuermann.de> * Copyright (C) 2012-2014 Dominik Schürmann <dominik@dominikschuermann.de>
* Copyright (C) 2011 Senecaso * Copyright (C) 2011 Senecaso
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,13 +18,10 @@
package org.sufficientlysecure.keychain.ui; package org.sufficientlysecure.keychain.ui;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.R;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
@ -34,10 +31,12 @@ import android.os.Messenger;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.Toast; import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.beardedhen.androidbootstrap.BootstrapButton;
/** /**
* gpg --send-key activity * gpg --send-key activity
* *
@ -49,28 +48,10 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity {
public static final String ACTION_EXPORT_KEY_TO_SERVER = Constants.INTENT_PREFIX public static final String ACTION_EXPORT_KEY_TO_SERVER = Constants.INTENT_PREFIX
+ "EXPORT_KEY_TO_SERVER"; + "EXPORT_KEY_TO_SERVER";
public static final String EXTRA_KEYRING_ROW_ID = "key_id"; public static final String EXTRA_KEYRING_ROW_ID = "key_row_id";
private Button export; private BootstrapButton mUploadButton;
private Spinner keyServer; private Spinner mKeyServerSpinner;
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// app icon in Action Bar clicked; go home
Intent intent = new Intent(this, KeyListPublicActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
default:
break;
}
return false;
}
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -78,21 +59,21 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity {
setContentView(R.layout.key_server_export); setContentView(R.layout.key_server_export);
export = (Button) findViewById(R.id.btn_export_to_server); mUploadButton = (BootstrapButton) findViewById(R.id.btn_export_to_server);
keyServer = (Spinner) findViewById(R.id.sign_key_keyserver); mKeyServerSpinner = (Spinner) findViewById(R.id.sign_key_keyserver);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, Preferences.getPreferences(this) android.R.layout.simple_spinner_item, Preferences.getPreferences(this)
.getKeyServers()); .getKeyServers());
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
keyServer.setAdapter(adapter); mKeyServerSpinner.setAdapter(adapter);
if (adapter.getCount() > 0) { if (adapter.getCount() > 0) {
keyServer.setSelection(0); mKeyServerSpinner.setSelection(0);
} else { } else {
export.setEnabled(false); mUploadButton.setEnabled(false);
} }
export.setOnClickListener(new OnClickListener() { mUploadButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
uploadKey(); uploadKey();
@ -112,14 +93,14 @@ public class KeyServerUploadActivity extends SherlockFragmentActivity {
int keyRingId = getIntent().getIntExtra(EXTRA_KEYRING_ROW_ID, -1); int keyRingId = getIntent().getIntExtra(EXTRA_KEYRING_ROW_ID, -1);
data.putInt(KeychainIntentService.UPLOAD_KEY_KEYRING_ROW_ID, keyRingId); data.putInt(KeychainIntentService.UPLOAD_KEY_KEYRING_ROW_ID, keyRingId);
String server = (String) keyServer.getSelectedItem(); String server = (String) mKeyServerSpinner.getSelectedItem();
data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, server); data.putString(KeychainIntentService.UPLOAD_KEY_SERVER, server);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data); intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
// Message is received after uploading is done in ApgService // Message is received after uploading is done in ApgService
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, R.string.progress_exporting, KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
ProgressDialog.STYLE_HORIZONTAL) { R.string.progress_exporting, ProgressDialog.STYLE_HORIZONTAL) {
public void handleMessage(Message message) { public void handleMessage(Message message) {
// handle messages by standard ApgHandler first // handle messages by standard ApgHandler first
super.handleMessage(message); super.handleMessage(message);