tls-psk: some cleanup

This commit is contained in:
Vincent Breitmoser
2017-05-30 23:21:08 +02:00
parent a919bb3a9e
commit 99441660ca
14 changed files with 79 additions and 23 deletions

View File

@@ -65,7 +65,8 @@ import org.sufficientlysecure.keychain.util.Log;
@RequiresApi(api = VERSION_CODES.LOLLIPOP)
public class TransferPresenter implements KeyTransferCallback, LoaderCallbacks<List<SecretKeyItem>>,
OnClickTransferKeyListener, OnClickImportKeyListener {
public static final String BACKSTACK_TAG_TRANSFER = "transfer";
private static final String BACKSTACK_TAG_TRANSFER = "transfer";
private final Context context;
private final TransferMvpView view;
private final LoaderManager loaderManager;
@@ -74,12 +75,14 @@ public class TransferPresenter implements KeyTransferCallback, LoaderCallbacks<L
private final TransferKeyAdapter secretKeyAdapter;
private final ReceivedKeyAdapter receivedKeyAdapter;
private KeyTransferInteractor keyTransferClientInteractor;
private KeyTransferInteractor keyTransferServerInteractor;
private boolean wasConnected = false;
private boolean waitingForWifi = false;
public TransferPresenter(Context context, LoaderManager loaderManager, int loaderId, TransferMvpView view) {
this.context = context;
this.view = view;

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) 2017 Vincent Breitmoser <look@my.amazin.horse>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.transfer.view;
@@ -22,7 +39,7 @@ import org.sufficientlysecure.keychain.ui.util.recyclerview.DividerItemDecoratio
public class ReceivedSecretKeyList extends RecyclerView {
private static final int STATE_INVISIBLE = 0;
private static final int STATE_BUTTON = 1;
// private static final int STATE_BUTTON = 1; // used in TransferSecretKeyList
private static final int STATE_PROGRESS = 2;
private static final int STATE_TRANSFERRED = 3;
private static final int STATE_IMPORT_BUTTON = 4;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
* Copyright (C) 2017 Vincent Breitmoser <look@my.amazin.horse>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -160,8 +160,9 @@ public class TransferFragment extends Fragment implements TransferMvpView {
@Override
public void showConnectionEstablished(String hostname) {
vConnectionStatusText1.setText("Connected to: " + hostname);
vConnectionStatusText2.setText("Connected to: " + hostname);
String statusText = getString(R.string.transfer_status_connected, hostname);
vConnectionStatusText1.setText(statusText);
vConnectionStatusText2.setText(statusText);
vTransferAnimator.setDisplayedChild(VIEW_CONNECTED);
}
@@ -172,8 +173,8 @@ public class TransferFragment extends Fragment implements TransferMvpView {
@Override
public void showViewDisconnected() {
vConnectionStatusText1.setText("Disconnected!");
vConnectionStatusText2.setText("Disconnected!");
vConnectionStatusText1.setText(R.string.transfer_status_disconnected);
vConnectionStatusText2.setText(R.string.transfer_status_disconnected);
}
@Override
@@ -221,17 +222,17 @@ public class TransferFragment extends Fragment implements TransferMvpView {
@Override
public void showErrorBadKey() {
Notify.create(getActivity(), "Failed reading incoming key!", Style.ERROR).show();
Notify.create(getActivity(), R.string.transfer_error_read_incoming, Style.ERROR).show();
}
@Override
public void showErrorConnectionFailed() {
Notify.create(getActivity(), "Connection failed!", Style.ERROR).show();
Notify.create(getActivity(), R.string.transfer_error_connect, Style.ERROR).show();
}
@Override
public void showErrorListenFailed() {
Notify.create(getActivity(), "Error setting up server!", Style.ERROR).show();
Notify.create(getActivity(), R.string.transfer_error_listen, Style.ERROR).show();
}
@Override

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) 2017 Vincent Breitmoser <look@my.amazin.horse>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui.transfer.view;
@@ -28,7 +45,7 @@ public class TransferSecretKeyList extends RecyclerView {
private static final int STATE_BUTTON = 1;
private static final int STATE_PROGRESS = 2;
private static final int STATE_TRANSFERRED = 3;
private static final int STATE_IMPORT_BUTTON = 4;
// private static final int STATE_IMPORT_BUTTON = 4; // used in ReceivedSecretKeyList
public TransferSecretKeyList(Context context) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

View File

@@ -56,7 +56,7 @@
android:outAnimation="@anim/fade_out"
android:inAnimation="@anim/fade_in"
android:id="@+id/transfer_state"
custom:initialView="04">
custom:initialView="01">
<Space
android:layout_width="wrap_content"
@@ -68,8 +68,8 @@
android:layout_gravity="end|center_vertical"
android:padding="8dp"
android:id="@+id/button_transfer"
android:src="@drawable/ic_play_arrow_white_24dp"
android:tint="@color/md_black_1000"
android:src="@drawable/ic_send_24dp"
android:tint="@color/md_grey_600"
android:background="?selectableItemBackground"
/>
@@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:padding="8dp"
android:id="@+id/button_import"
android:text="Import"
android:text="@string/button_import"
/>
</org.sufficientlysecure.keychain.ui.widget.ToolableViewAnimator>

View File

@@ -33,8 +33,9 @@
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:id="@+id/button_scan"
android:text="Scan"
android:text="@string/button_scan"
android:drawableLeft="@drawable/ic_qrcode_white_24dp"
android:drawableTint="@color/md_black_1000"
android:drawablePadding="8dp"
/>
@@ -43,7 +44,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:text="Scan with either device to establish a secure connection for device setup."
android:text="@string/transfer_scan_explanation"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
@@ -58,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="Connection status:"
android:text="@string/connection_status"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
@@ -75,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Available Keys:"
android:text="@string/section_transfer_keys"
android:textAppearance="?android:attr/textAppearanceMedium"
style="@style/SectionHeader"
/>
@@ -104,7 +105,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="Connection status:"
android:text="@string/connection_status"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
@@ -121,7 +122,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Received Keys:"
android:text="@string/section_received_keys"
android:textAppearance="?android:attr/textAppearanceMedium"
style="@style/SectionHeader"
/>
@@ -161,7 +162,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:text="This feature can only be used on Wifi."
android:text="@string/transfer_scan_only_wifi"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

View File

@@ -1889,4 +1889,17 @@
<string name="identity_context_forget">Forget</string>
<string name="button_scan">"Scan"</string>
<string name="transfer_scan_explanation">"Scan with either device to establish a secure connection for device setup."</string>
<string name="connection_status">"Connection status:"</string>
<string name="section_transfer_keys">"Available keys for fransfer"</string>
<string name="section_received_keys">"Received keys"</string>
<string name="transfer_scan_only_wifi">"This feature can only be used on Wifi."</string>
<string name="button_import">"Import"</string>
<string name="transfer_status_connected">"Connected to %s"</string>
<string name="transfer_status_disconnected">"Disconnected!"</string>
<string name="transfer_error_read_incoming">"Failed reading incoming key!"</string>
<string name="transfer_error_connect">"Connection failed!"</string>
<string name="transfer_error_listen">"Error waiting for connection!"</string>
</resources>

View File

@@ -0,0 +1,4 @@
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 201 B

View File

@@ -22,7 +22,7 @@ SRC_DIR=./drawables/
#inkscape -w 512 -h 512 -e "$PLAY_DIR/$NAME.png" $NAME.svg
for NAME in "ic_cloud_unknown" "ic_cloud_off" "ic_wifi_lock" "broken_heart" "ic_cloud_search" "ic_action_encrypt_file" "ic_action_encrypt_text" "ic_action_verified_cutout" "ic_action_encrypt_copy" "ic_action_encrypt_paste" "ic_action_encrypt_save" "ic_action_encrypt_share" "status_lock_closed" "status_lock_error" "status_lock_open" "status_signature_expired_cutout" "status_signature_invalid_cutout" "status_signature_revoked_cutout" "status_signature_unknown_cutout" "status_signature_unverified_cutout" "status_signature_verified_cutout" "key_flag_authenticate" "key_flag_certify" "key_flag_encrypt" "key_flag_sign" "yubi_icon" "ic_stat_notify" "status_signature_verified_inner" "link" "octo_link"
for NAME in "ic_send" "ic_cloud_unknown" "ic_cloud_off" "ic_wifi_lock" "broken_heart" "ic_cloud_search" "ic_action_encrypt_file" "ic_action_encrypt_text" "ic_action_verified_cutout" "ic_action_encrypt_copy" "ic_action_encrypt_paste" "ic_action_encrypt_save" "ic_action_encrypt_share" "status_lock_closed" "status_lock_error" "status_lock_open" "status_signature_expired_cutout" "status_signature_invalid_cutout" "status_signature_revoked_cutout" "status_signature_unknown_cutout" "status_signature_unverified_cutout" "status_signature_verified_cutout" "key_flag_authenticate" "key_flag_certify" "key_flag_encrypt" "key_flag_sign" "yubi_icon" "ic_stat_notify" "status_signature_verified_inner" "link" "octo_link"
do
echo $NAME
inkscape -w 24 -h 24 -e "$MDPI_DIR/${NAME}_24dp.png" "$SRC_DIR/$NAME.svg"