tls-psk: display a note if there are no keys to send
This commit is contained in:
@@ -340,6 +340,7 @@ public class TransferPresenter implements KeyTransferCallback, LoaderCallbacks<L
|
||||
@Override
|
||||
public void onLoadFinished(Loader<List<SecretKeyItem>> loader, List<SecretKeyItem> data) {
|
||||
secretKeyAdapter.setData(data);
|
||||
view.setShowSecretKeyEmptyView(data.isEmpty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -367,6 +368,7 @@ public class TransferPresenter implements KeyTransferCallback, LoaderCallbacks<L
|
||||
void showResultNotification(ImportKeyResult result);
|
||||
|
||||
void setSecretKeyAdapter(Adapter adapter);
|
||||
void setShowSecretKeyEmptyView(boolean isEmpty);
|
||||
void setReceivedKeyAdapter(Adapter secretKeyAdapter);
|
||||
|
||||
<T extends Parcelable, S extends OperationResult> CryptoOperationHelper<T,S> createCryptoOperationHelper(Callback<T, S> callback);
|
||||
|
||||
@@ -75,6 +75,7 @@ public class TransferFragment extends Fragment implements TransferMvpView {
|
||||
private TextView vConnectionStatusText1;
|
||||
private TextView vConnectionStatusText2;
|
||||
private RecyclerView vTransferKeyList;
|
||||
private View vTransferKeyListEmptyView;
|
||||
private RecyclerView vReceivedKeyList;
|
||||
|
||||
private CryptoOperationHelper currentCryptoOperationHelper;
|
||||
@@ -100,6 +101,7 @@ public class TransferFragment extends Fragment implements TransferMvpView {
|
||||
vConnectionStatusText1 = (TextView) view.findViewById(R.id.connection_status_1);
|
||||
vConnectionStatusText2 = (TextView) view.findViewById(R.id.connection_status_2);
|
||||
vTransferKeyList = (RecyclerView) view.findViewById(R.id.transfer_key_list);
|
||||
vTransferKeyListEmptyView = view.findViewById(R.id.transfer_key_list_empty);
|
||||
vReceivedKeyList = (RecyclerView) view.findViewById(R.id.received_key_list);
|
||||
|
||||
vQrCodeImage = (ImageView) view.findViewById(R.id.qr_code_image);
|
||||
@@ -203,6 +205,11 @@ public class TransferFragment extends Fragment implements TransferMvpView {
|
||||
vTransferKeyList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowSecretKeyEmptyView(boolean isEmpty) {
|
||||
vTransferKeyListEmptyView.setVisibility(isEmpty ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReceivedKeyAdapter(Adapter adapter) {
|
||||
vReceivedKeyList.setAdapter(adapter);
|
||||
|
||||
@@ -104,11 +104,30 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.transfer.view.TransferSecretKeyList
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/transfer_key_list"
|
||||
/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.sufficientlysecure.keychain.ui.transfer.view.TransferSecretKeyList
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/transfer_key_list"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="12dp"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:id="@+id/transfer_key_list_empty"
|
||||
android:text="@string/transfer_list_empty"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@@ -1902,5 +1902,6 @@
|
||||
<string name="transfer_error_connect">"Connection failed!"</string>
|
||||
<string name="transfer_error_listen">"Error waiting for connection!"</string>
|
||||
<string name="transfer_not_available">"Sorry, this feature can only be used on Android 5 or newer :("</string>
|
||||
<string name="transfer_list_empty">No keys on this device that could be sent. Waiting for incoming keys…</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user