instructions on empty public key list for first start

This commit is contained in:
Dominik Schürmann 2014-01-07 23:48:16 +01:00
parent f76d33d230
commit 2ccfc09f44
3 changed files with 87 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical" >
@ -16,13 +16,55 @@
android:paddingRight="32dp" android:paddingRight="32dp"
android:scrollbarStyle="outsideOverlay" /> android:scrollbarStyle="outsideOverlay" />
<TextView <LinearLayout
android:id="@+id/empty" android:id="@+id/empty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:text="@string/list_empty" android:orientation="vertical"
android:textSize="30sp" android:visibility="gone" >
android:visibility="gone" />
</LinearLayout> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/key_list_empty_text1"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/key_list_empty_text2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="@+id/key_list_empty_button_create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/key_list_empty_button_create"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/key_list_empty_text3"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="@+id/key_list_empty_button_import"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/key_list_empty_button_import"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</FrameLayout>

View File

@ -104,7 +104,7 @@
<string name="menu_beam_preferences">Beam settings</string> <string name="menu_beam_preferences">Beam settings</string>
<string name="menu_key_edit_cancel">Cancel</string> <string name="menu_key_edit_cancel">Cancel</string>
<string name="menu_encrypt_to">Encrypt to…</string> <string name="menu_encrypt_to">Encrypt to…</string>
<!-- label --> <!-- label -->
<string name="label_sign">Sign</string> <string name="label_sign">Sign</string>
<string name="label_message">Message</string> <string name="label_message">Message</string>
@ -354,11 +354,18 @@
<string name="share_qr_code_dialog_progress">QR Code %1$d of %2$d</string> <string name="share_qr_code_dialog_progress">QR Code %1$d of %2$d</string>
<string name="share_nfc_dialog">Share with NFC</string> <string name="share_nfc_dialog">Share with NFC</string>
<!-- Key list -->
<plurals name="key_list_selected_keys"> <plurals name="key_list_selected_keys">
<item quantity="one">1 key selected.</item> <item quantity="one">1 key selected.</item>
<item quantity="other">%d keys selected.</item> <item quantity="other">%d keys selected.</item>
</plurals> </plurals>
<string name="key_list_empty_text1">No keys available yet…</string>
<string name="key_list_empty_text2">You can start by</string>
<string name="key_list_empty_text3">or</string>
<string name="key_list_empty_button_create">creating your own key pair</string>
<string name="key_list_empty_button_import">importing public keys.</string>
<!-- Key view --> <!-- Key view -->
<string name="key_view_action_encrypt">Encrypt to this contact</string> <string name="key_view_action_encrypt">Encrypt to this contact</string>

View File

@ -46,8 +46,10 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView; import android.widget.ListView;
/** /**
@ -57,16 +59,44 @@ import android.widget.ListView;
public class KeyListPublicFragment extends Fragment implements AdapterView.OnItemClickListener, public class KeyListPublicFragment extends Fragment implements AdapterView.OnItemClickListener,
LoaderManager.LoaderCallbacks<Cursor> { LoaderManager.LoaderCallbacks<Cursor> {
// private KeyListPublicActivity mKeyListPublicActivity;
private KeyListPublicAdapter mAdapter; private KeyListPublicAdapter mAdapter;
private StickyListHeadersListView mStickyList; private StickyListHeadersListView mStickyList;
// empty layout
private Button mButtonEmptyCreate;
private Button mButtonEmptyImport;
/** /**
* Load custom layout with StickyListView from library * Load custom layout with StickyListView from library
*/ */
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.key_list_public_fragment, container, false); View view = inflater.inflate(R.layout.key_list_public_fragment, container, false);
mButtonEmptyCreate = (Button) view.findViewById(R.id.key_list_empty_button_create);
mButtonEmptyCreate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), EditKeyActivity.class);
intent.setAction(EditKeyActivity.ACTION_CREATE_KEY);
intent.putExtra(EditKeyActivity.EXTRA_GENERATE_DEFAULT_KEYS, true);
intent.putExtra(EditKeyActivity.EXTRA_USER_IDS, ""); // show user id view
startActivityForResult(intent, 0);
}
});
mButtonEmptyImport = (Button) view.findViewById(R.id.key_list_empty_button_import);
mButtonEmptyImport.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intentImportFromFile = new Intent(getActivity(), ImportKeysActivity.class);
intentImportFromFile.setAction(ImportKeysActivity.ACTION_IMPORT_KEY);
startActivityForResult(intentImportFromFile, Id.request.import_from_qr_code);
}
});
return view; return view;
} }