mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
UI stuff
This commit is contained in:
parent
0b9308753d
commit
2768671206
@ -80,7 +80,7 @@
|
||||
<activity
|
||||
android:name=".ui.KeyListActivity"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
|
||||
android:label="@string/app_name"
|
||||
android:label="@string/nav_keys"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -73,7 +73,6 @@ public class AddKeysActivity extends ActionBarActivity implements
|
||||
ImageView mActionSafeSlingerIcon;
|
||||
View mActionQrCode;
|
||||
View mActionNfc;
|
||||
View mActionSearchCloud;
|
||||
|
||||
ProviderHelper mProviderHelper;
|
||||
|
||||
@ -103,7 +102,6 @@ public class AddKeysActivity extends ActionBarActivity implements
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
mActionQrCode = findViewById(R.id.add_keys_qr_code);
|
||||
mActionNfc = findViewById(R.id.add_keys_nfc);
|
||||
mActionSearchCloud = findViewById(R.id.add_keys_search_cloud);
|
||||
|
||||
mSafeSlingerKeySpinner.setOnKeyChangedListener(new KeySpinner.OnKeyChangedListener() {
|
||||
@Override
|
||||
@ -135,14 +133,6 @@ public class AddKeysActivity extends ActionBarActivity implements
|
||||
startActivityForResult(intent, REQUEST_CODE_RESULT);
|
||||
}
|
||||
});
|
||||
|
||||
mActionSearchCloud.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchCloud();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void startExchange() {
|
||||
@ -171,12 +161,6 @@ public class AddKeysActivity extends ActionBarActivity implements
|
||||
new IntentIntegrator(this).initiateScan();
|
||||
}
|
||||
|
||||
private void searchCloud() {
|
||||
finish();
|
||||
Intent importIntent = new Intent(this, ImportKeysActivity.class);
|
||||
startActivity(importIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
|
@ -150,12 +150,13 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
}
|
||||
|
||||
Bundle serverBundle = null;
|
||||
int showTabOnly = ALL_TABS;
|
||||
int showTabOnly = TAB_CLOUD;
|
||||
if (ACTION_IMPORT_KEY.equals(action)) {
|
||||
/* Keychain's own Actions */
|
||||
|
||||
// display file fragment
|
||||
mViewPager.setCurrentItem(TAB_FILE);
|
||||
showTabOnly = TAB_FILE;
|
||||
mSwitchToTab = TAB_FILE;
|
||||
|
||||
if (dataUri != null) {
|
||||
// action: directly load data
|
||||
@ -229,6 +230,7 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
}
|
||||
} else if (ACTION_IMPORT_KEY_FROM_FILE.equals(action)) {
|
||||
// NOTE: this only displays the appropriate fragment, no actions are taken
|
||||
showTabOnly = TAB_FILE;
|
||||
mSwitchToTab = TAB_FILE;
|
||||
|
||||
// no immediate actions!
|
||||
@ -243,14 +245,14 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
startListFragment(savedInstanceState, null, null, null);
|
||||
} else if (ACTION_IMPORT_KEY_FROM_QR_CODE.equals(action)) {
|
||||
// also exposed in AndroidManifest
|
||||
|
||||
showTabOnly = ALL_TABS;
|
||||
// NOTE: this only displays the appropriate fragment, no actions are taken
|
||||
mSwitchToTab = TAB_QR_CODE;
|
||||
|
||||
// no immediate actions!
|
||||
startListFragment(savedInstanceState, null, null, null);
|
||||
} else if (ACTION_IMPORT_KEY_FROM_NFC.equals(action)) {
|
||||
|
||||
showTabOnly = ALL_TABS;
|
||||
// NOTE: this only displays the appropriate fragment, no actions are taken
|
||||
mSwitchToTab = TAB_QR_CODE;
|
||||
|
||||
@ -334,32 +336,36 @@ public class ImportKeysActivity extends ActionBarActivity {
|
||||
getSupportFragmentManager().executePendingTransactions();
|
||||
}
|
||||
|
||||
private String getFingerprintFromUri(Uri dataUri) {
|
||||
public static String getFingerprintFromUri(Uri dataUri) {
|
||||
String fingerprint = dataUri.toString().split(":")[1].toLowerCase(Locale.ENGLISH);
|
||||
Log.d(Constants.TAG, "fingerprint: " + fingerprint);
|
||||
return fingerprint;
|
||||
}
|
||||
|
||||
public void loadFromFingerprintUri(Uri dataUri) {
|
||||
String query = "0x" + getFingerprintFromUri(dataUri);
|
||||
public void loadFromFingerprint(String fingerprint) {
|
||||
// String fingerprint = "0x" + getFingerprintFromUri(dataUri);
|
||||
|
||||
// setCurrentItem does not work directly after onResume (from qr code scanner)
|
||||
// see http://stackoverflow.com/q/19316729
|
||||
// so, reset adapter completely!
|
||||
if (mViewPager.getAdapter() != null)
|
||||
mViewPager.setAdapter(null);
|
||||
mViewPager.setAdapter(mTabsAdapter);
|
||||
mViewPager.setCurrentItem(TAB_CLOUD);
|
||||
// if (mViewPager.getAdapter() != null)
|
||||
// mViewPager.setAdapter(null);
|
||||
// mViewPager.setAdapter(mTabsAdapter);
|
||||
// mViewPager.setCurrentItem(TAB_CLOUD);
|
||||
|
||||
ImportKeysCloudFragment f = (ImportKeysCloudFragment)
|
||||
getActiveFragment(mViewPager, TAB_CLOUD);
|
||||
// ImportKeysCloudFragment f = (ImportKeysCloudFragment)
|
||||
// getActiveFragment(mViewPager, TAB_CLOUD);
|
||||
|
||||
// search config
|
||||
Preferences prefs = Preferences.getPreferences(ImportKeysActivity.this);
|
||||
Preferences.CloudSearchPrefs cloudPrefs = new Preferences.CloudSearchPrefs(true, true, prefs.getPreferredKeyserver());
|
||||
Intent searchIntent = new Intent(this, ImportKeysActivity.class);
|
||||
searchIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
|
||||
startActivity(searchIntent);
|
||||
|
||||
// search directly
|
||||
loadCallback(new ImportKeysListFragment.CloudLoaderState(query, cloudPrefs));
|
||||
// // search config
|
||||
// Preferences prefs = Preferences.getPreferences(ImportKeysActivity.this);
|
||||
// Preferences.CloudSearchPrefs cloudPrefs = new Preferences.CloudSearchPrefs(true, true, prefs.getPreferredKeyserver());
|
||||
//
|
||||
// // search directly
|
||||
// loadCallback(new ImportKeysListFragment.CloudLoaderState(query, cloudPrefs));
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/a/9293207
|
||||
|
@ -31,8 +31,6 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class ImportKeysFileFragment extends Fragment {
|
||||
private ImportKeysActivity mImportActivity;
|
||||
private View mBrowse;
|
||||
@ -80,12 +78,8 @@ public class ImportKeysFileFragment extends Fragment {
|
||||
String sendText = "";
|
||||
if (clipboardText != null) {
|
||||
sendText = clipboardText.toString();
|
||||
if (sendText.toLowerCase(Locale.ENGLISH).startsWith(Constants.FINGERPRINT_SCHEME)) {
|
||||
mImportActivity.loadFromFingerprintUri(Uri.parse(sendText));
|
||||
return;
|
||||
}
|
||||
mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(sendText.getBytes(), null));
|
||||
}
|
||||
mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(sendText.getBytes(), null));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -132,7 +132,7 @@ public class ImportKeysQrCodeFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void importFingerprint(Uri dataUri) {
|
||||
mImportActivity.loadFromFingerprintUri(dataUri);
|
||||
mImportActivity.loadFromFingerprint(ImportKeysActivity.getFingerprintFromUri(dataUri));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,6 +87,10 @@ public class KeyListActivity extends DrawerActivity {
|
||||
addKeys();
|
||||
return true;
|
||||
|
||||
case R.id.menu_key_list_search_cloud:
|
||||
searchCloud();
|
||||
return true;
|
||||
|
||||
case R.id.menu_key_list_create:
|
||||
createKey();
|
||||
return true;
|
||||
@ -144,6 +148,12 @@ public class KeyListActivity extends DrawerActivity {
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
|
||||
private void searchCloud() {
|
||||
Intent importIntent = new Intent(this, ImportKeysActivity.class);
|
||||
importIntent.putExtra(ImportKeysActivity.EXTRA_QUERY, (String) null); // hack to show only cloud tab
|
||||
startActivity(importIntent);
|
||||
}
|
||||
|
||||
private void createKey() {
|
||||
Intent intent = new Intent(this, CreateKeyActivity.class);
|
||||
startActivityForResult(intent, 0);
|
||||
|
@ -470,6 +470,11 @@ public class KeyListFragment extends LoaderFragment
|
||||
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = true;
|
||||
getActivity().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
// disable swipe-to-refresh
|
||||
// mSwipeRefreshLayout.setIsLocked(true);
|
||||
return true;
|
||||
@ -479,6 +484,11 @@ public class KeyListFragment extends LoaderFragment
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
mQuery = null;
|
||||
getLoaderManager().restartLoader(0, null, KeyListFragment.this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = false;
|
||||
getActivity().invalidateOptionsMenu();
|
||||
}
|
||||
// enable swipe-to-refresh
|
||||
// mSwipeRefreshLayout.setIsLocked(false);
|
||||
return true;
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 913 B |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -135,34 +135,6 @@
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="@string/add_keys_section_import" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_keys_search_cloud"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
style="@style/SelectableItem"
|
||||
android:text="@string/add_keys_cloud"
|
||||
android:drawableRight="@drawable/ic_action_search"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -7,18 +7,23 @@
|
||||
android:title="@string/menu_search"
|
||||
android:icon="@drawable/ic_action_search"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
app:showAsAction="collapseActionView|ifRoom" />
|
||||
app:showAsAction="collapseActionView|always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_search_cloud"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_action_search_cloud"
|
||||
android:title="@string/menu_add_keys" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_add"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_action_new_account"
|
||||
android:title="@string/menu_add_keys" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_export"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="@drawable/ic_action_import_export"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_all_keys" />
|
||||
|
||||
<item
|
||||
|
@ -277,13 +277,10 @@
|
||||
<!-- Add keys -->
|
||||
<string name="add_keys_section_secure_exchange">"Secure Exchange"</string>
|
||||
<string name="add_keys_section_secure_add">"Secure Add"</string>
|
||||
<string name="add_keys_section_import">"Import (untrusted)"</string>
|
||||
<string name="add_keys_my_key">"My key:"</string>
|
||||
<string name="add_keys_start_exchange">"Start exchange"</string>
|
||||
<string name="add_keys_qr_code">"Scan QR Code"</string>
|
||||
<string name="add_keys_nfc">"Receive via NFC"</string>
|
||||
<string name="add_keys_cloud">"Search cloud"</string>
|
||||
|
||||
|
||||
<!-- progress dialogs, usually ending in '…' -->
|
||||
<string name="progress_done">"Done."</string>
|
||||
|
148
Resources/graphics/ic_action_search_cloud.svg
Normal file
148
Resources/graphics/ic_action_search_cloud.svg
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="512"
|
||||
height="512"
|
||||
id="svg4241"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="ic_action_search_cloud.svg">
|
||||
<defs
|
||||
id="defs4243">
|
||||
<clipPath
|
||||
id="SVGID_173_">
|
||||
<use
|
||||
xlink:href="#SVGID_172_"
|
||||
overflow="visible"
|
||||
id="use1170"
|
||||
style="overflow:visible"
|
||||
x="0"
|
||||
y="0"
|
||||
width="595.28003"
|
||||
height="841.89001" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="SVGID_153_">
|
||||
<use
|
||||
xlink:href="#SVGID_152_"
|
||||
overflow="visible"
|
||||
id="use1012"
|
||||
style="overflow:visible"
|
||||
x="0"
|
||||
y="0"
|
||||
width="595.28003"
|
||||
height="841.89001" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.49497476"
|
||||
inkscape:cx="-17.897931"
|
||||
inkscape:cy="203.11843"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1364"
|
||||
inkscape:window-height="747"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="19"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata4246">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-540.36218)">
|
||||
<g
|
||||
id="g1006"
|
||||
transform="matrix(5.1617797,0,0,5.1617797,-3144.7765,-2159.0339)"
|
||||
style="opacity:0.6;fill:#333333;fill-opacity:1">
|
||||
<defs
|
||||
id="defs1008">
|
||||
<rect
|
||||
id="SVGID_152_"
|
||||
x="488.004"
|
||||
y="603"
|
||||
width="96"
|
||||
height="96" />
|
||||
</defs>
|
||||
<clipPath
|
||||
id="clipPath4228">
|
||||
<use
|
||||
xlink:href="#SVGID_152_"
|
||||
overflow="visible"
|
||||
id="use4230"
|
||||
style="overflow:visible"
|
||||
x="0"
|
||||
y="0"
|
||||
width="595.28003"
|
||||
height="841.89001" />
|
||||
</clipPath>
|
||||
<path
|
||||
clip-path="url(#SVGID_153_)"
|
||||
clip-rule="evenodd"
|
||||
d="m 561.652,653.42 c -0.518,-6.998 -6.348,-12.521 -13.477,-12.521 -2.758,0 -5.318,0.829 -7.463,2.248 -1.537,-6.011 -6.977,-10.462 -13.469,-10.462 -7.688,0 -13.922,6.234 -13.922,13.921 0,0.567 0.045,1.122 0.109,1.674 -0.078,-0.004 -0.158,-0.013 -0.238,-0.013 -5.812,0 -10.523,4.713 -10.523,10.525 0,5.633 4.436,10.223 10.001,10.496 v 0.025 h 48.388 v -0.033 c 0.107,0.004 0.209,0.033 0.316,0.033 4.4,0 7.963,-3.566 7.963,-7.963 10e-4,-4.303 -3.415,-7.786 -7.685,-7.93"
|
||||
id="path1014"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333;fill-opacity:1;fill-rule:evenodd"
|
||||
transform="translate(123.22638,-60.338615)" />
|
||||
</g>
|
||||
<g
|
||||
id="g1164"
|
||||
transform="matrix(3.5253364,0,0,3.5253364,99.049835,89.306818)"
|
||||
style="opacity:0.6;fill:#333333;fill-opacity:1">
|
||||
<defs
|
||||
id="defs1166">
|
||||
<rect
|
||||
id="SVGID_172_"
|
||||
x="13.005"
|
||||
y="130.713"
|
||||
width="96"
|
||||
height="96" />
|
||||
</defs>
|
||||
<clipPath
|
||||
id="clipPath4236">
|
||||
<use
|
||||
xlink:href="#SVGID_172_"
|
||||
overflow="visible"
|
||||
id="use4238"
|
||||
style="overflow:visible"
|
||||
x="0"
|
||||
y="0"
|
||||
width="595.28003"
|
||||
height="841.89001" />
|
||||
</clipPath>
|
||||
<path
|
||||
clip-path="url(#SVGID_173_)"
|
||||
d="M 92.499,200.893 80.335,188.725 c -1.07,-1.068 -3.008,-0.967 -4.951,0.045 l -5.307,-5.305 c 6.914,-9.034 6.262,-22.002 -2.004,-30.269 -8.998,-8.995 -23.586,-8.995 -32.586,0 -8.995,9 -8.995,23.588 0,32.588 8.268,8.265 21.236,8.917 30.27,2.001 l 5.307,5.304 c -1.012,1.946 -1.115,3.882 -0.047,4.952 l 12.166,12.168 c 1.537,1.535 4.873,0.691 7.441,-1.883 2.57,-2.567 3.414,-5.898 1.875,-7.433 M 38.914,182.359 c -7.104,-7.11 -7.104,-18.632 0,-25.736 7.108,-7.109 18.622,-7.103 25.735,0 7.104,7.104 7.104,18.622 0,25.736 -7.113,7.105 -18.63,7.105 -25.735,0"
|
||||
id="path1172"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333;fill-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.8 KiB |
@ -37,7 +37,7 @@ inkscape -w 512 -h 512 -e "$PLAY_DIR/$NAME.png" $NAME.svg
|
||||
# xhdpi: 64x64
|
||||
# xxhdpi: 96x96
|
||||
|
||||
for NAME in "ic_action_nfc" "ic_action_qr_code" "ic_action_safeslinger"
|
||||
for NAME in "ic_action_nfc" "ic_action_qr_code" "ic_action_safeslinger" "ic_action_search_cloud"
|
||||
do
|
||||
echo $NAME
|
||||
inkscape -w 32 -h 32 -e "$MDPI_DIR/$NAME.png" $NAME.svg
|
||||
|
Loading…
Reference in New Issue
Block a user