address reviews

This commit is contained in:
goapunk
2018-06-19 10:31:58 +02:00
parent 06deba4bd4
commit f4131d6f32
3 changed files with 49 additions and 51 deletions

View File

@@ -144,7 +144,7 @@ public class KeyAgreementFragment extends BaseEventFragment
} }
@Override @Override
public void toggleFullscreen(boolean fullscreen) { public void setFullscreen(boolean fullscreen) {
LinearLayout.LayoutParams statusParams, qrCodeParams; LinearLayout.LayoutParams statusParams, qrCodeParams;
if (fullscreen) { if (fullscreen) {
// Grow the QR code view to fill its parent // Grow the QR code view to fill its parent
@@ -278,6 +278,11 @@ public class KeyAgreementFragment extends BaseEventFragment
}); });
} }
private void keyAgreementWaiting() {
runOnUiThreadUnlessDestroyed(
() -> status.setText(R.string.waiting_for_contact_to_scan));
}
private void keyAgreementStarted() { private void keyAgreementStarted() {
runOnUiThreadUnlessDestroyed(() -> { runOnUiThreadUnlessDestroyed(() -> {
qrCodeView.setVisibility(INVISIBLE); qrCodeView.setVisibility(INVISIBLE);
@@ -286,11 +291,6 @@ public class KeyAgreementFragment extends BaseEventFragment
}); });
} }
private void keyAgreementWaiting() {
runOnUiThreadUnlessDestroyed(
() -> status.setText(R.string.waiting_for_contact_to_scan));
}
private void keyAgreementAborted(boolean remoteAborted) { private void keyAgreementAborted(boolean remoteAborted) {
runOnUiThreadUnlessDestroyed(() -> { runOnUiThreadUnlessDestroyed(() -> {
reset(); reset();

View File

@@ -29,18 +29,20 @@ public class QrCodeView extends FrameLayout {
ImageView fullscreenButton = findViewById(R.id.fullscreen_button); ImageView fullscreenButton = findViewById(R.id.fullscreen_button);
fullscreenButton.setOnClickListener(v -> { fullscreenButton.setOnClickListener(v -> {
fullscreen = !fullscreen; fullscreen = !fullscreen;
if (!fullscreen) if (!fullscreen) {
fullscreenButton.setImageResource( fullscreenButton.setImageResource(
R.drawable.ic_fullscreen_black_48dp); R.drawable.ic_fullscreen_black_48dp);
else } else {
fullscreenButton.setImageResource( fullscreenButton.setImageResource(
R.drawable.ic_fullscreen_exit_black_48dp); R.drawable.ic_fullscreen_exit_black_48dp);
}
if (listener != null) if (listener != null)
listener.toggleFullscreen(fullscreen); listener.setFullscreen(fullscreen);
} }
); );
} }
@UiThread
public void setQrCode(Bitmap qrCode) { public void setQrCode(Bitmap qrCode) {
qrCodeImageView.setImageBitmap(qrCode); qrCodeImageView.setImageBitmap(qrCode);
// Simple fade-in animation // Simple fade-in animation
@@ -55,7 +57,7 @@ public class QrCodeView extends FrameLayout {
} }
public interface FullscreenListener { public interface FullscreenListener {
void toggleFullscreen(boolean isFullscreen); void setFullscreen(boolean fullscreen);
} }
} }

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:showIn="@layout/list_item_forum"> tools:showIn="@layout/fragment_keyagreement_qr">
<ProgressBar <ProgressBar
style="?android:attr/progressBarStyleLarge" style="?android:attr/progressBarStyleLarge"
@@ -20,12 +20,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="@string/qr_code" android:contentDescription="@string/qr_code"
android:scaleType="fitCenter" android:scaleType="fitCenter"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/startup_lock"/>
<ImageView <ImageView
android:id="@+id/fullscreen_button" android:id="@+id/fullscreen_button"
@@ -39,5 +34,6 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"/> app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
</merge> </merge>