mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-19 13:29:13 +00:00
Merge 136de4a6bb
into 19fe7bd4d2
This commit is contained in:
commit
f30b13c14c
3 changed files with 56 additions and 19 deletions
|
@ -10,6 +10,7 @@ import android.graphics.Color;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -47,6 +48,8 @@ public class TransferEntriesActivity extends AegisActivity {
|
|||
private Button _previousButton;
|
||||
private Button _copyButton;
|
||||
private int _currentEntryCount = 1;
|
||||
private float _deviceBrightness;
|
||||
private boolean isMaxBrightnessSet = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -146,14 +149,35 @@ public class TransferEntriesActivity extends AegisActivity {
|
|||
_qrImage.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
}
|
||||
});
|
||||
|
||||
_deviceBrightness = getSystemBrightness();
|
||||
_qrImage.setOnClickListener(v -> {
|
||||
if (!isMaxBrightnessSet) {
|
||||
setBrightness(1f);
|
||||
isMaxBrightnessSet = true;
|
||||
} else {
|
||||
setBrightness(_deviceBrightness);
|
||||
isMaxBrightnessSet = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
// Max brightness to make the QR codes easier to scan
|
||||
private float getSystemBrightness() {
|
||||
int brightness = 0;
|
||||
try {
|
||||
brightness = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return brightness / 255f;
|
||||
}
|
||||
|
||||
private void setBrightness(float brightnessAmount) {
|
||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||
attrs.screenBrightness = 1.0f;
|
||||
attrs.screenBrightness = brightnessAmount;
|
||||
getWindow().setAttributes(attrs);
|
||||
getSystemBrightness();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
android:id="@+id/layoutShareEntry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingHorizontal="30dp"
|
||||
android:layout_marginTop="?attr/actionBarSize">
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:paddingHorizontal="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDescription"
|
||||
|
@ -34,44 +34,44 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/transfer_entry_description"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ivQrCode"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/ivQrCode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Aegis.ImageView.Rounded"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintVertical_bias="0.3"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.3"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Aegis.ImageView.Rounded" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvIssuer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
tools:text="Issuer"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivQrCode" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivQrCode"
|
||||
tools:text="Issuer" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAccountName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
tools:text="Accountname"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvIssuer" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvIssuer"
|
||||
tools:text="Accountname" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCopyClipboard"
|
||||
|
@ -80,17 +80,19 @@
|
|||
android:text="@string/copy_uri"
|
||||
android:textAllCaps="false"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvEntriesCount"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAccountName"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvEntriesCount" />
|
||||
app:layout_constraintVertical_bias="0.134" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnNext"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="4dp"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:text="@string/next"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
@ -98,11 +100,11 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/btnPrevious"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:text="@string/previous"
|
||||
android:textAllCaps="false"
|
||||
android:visibility="invisible"
|
||||
|
@ -118,6 +120,16 @@
|
|||
app:layout_constraintEnd_toEndOf="@+id/btnNext"
|
||||
app:layout_constraintStart_toStartOf="@+id/btnPrevious" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/transfer_entry_brightness"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tvEntriesCount"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/btnCopyClipboard" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
|
@ -497,6 +497,7 @@
|
|||
<string name="unable_to_copy_uri_to_clipboard">Unable to copy URI to clipboard</string>
|
||||
<string name="uri_copied_to_clipboard">URI copied to clipboard</string>
|
||||
<string name="transfer_entry_description">Scan this QR code with the authenticator app you would like to transfer this entry to</string>
|
||||
<string name="transfer_entry_brightness">Tap the QR code to toggle full screen brightness</string>
|
||||
<string name="google_auth_compatible_transfer_description">Scan these QR codes with Aegis or Google Authenticator.\n\nDue to limitations of the Google Authenticator app, only TOTP & HOTP tokens that use SHA1 and produce 6-digit codes are included</string>
|
||||
|
||||
<string name="password_strength_very_weak">Very weak</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue