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) {