mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use title bar for qr-scan-activity, providing 'back', a title, and options in the future. the 'white only' should really be used only for the welcome screen
This commit is contained in:
@@ -8,28 +8,10 @@
|
||||
tools:context=".WelcomeActivity">
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/welcome_icon"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:src="@drawable/intro1"
|
||||
android:padding="8dp"
|
||||
tools:ignore="contentDescription"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="@string/qrscan_title"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -47,8 +29,8 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.legacy.widget.Space
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -78,7 +78,7 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
||||
View backupButton = findViewById(R.id.backup_button);
|
||||
|
||||
loginButton.setOnClickListener((view) -> startRegistrationActivity());
|
||||
addAsSecondDeviceButton.setOnClickListener((view) -> startAddAsAnotherDeviceActivity());
|
||||
addAsSecondDeviceButton.setOnClickListener((view) -> startAddAsSecondDeviceActivity());
|
||||
scanQrButton.setOnClickListener((view) -> startRegistrationQrActivity());
|
||||
backupButton.setOnClickListener((view) -> startImportBackup());
|
||||
|
||||
@@ -156,9 +156,11 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
||||
new IntentIntegrator(this).setCaptureActivity(RegistrationQrActivity.class).initiateScan();
|
||||
}
|
||||
|
||||
private void startAddAsAnotherDeviceActivity() {
|
||||
private void startAddAsSecondDeviceActivity() {
|
||||
manualConfigure = false;
|
||||
new IntentIntegrator(this).setCaptureActivity(RegistrationQrActivity.class).initiateScan();
|
||||
new IntentIntegrator(this).setCaptureActivity(RegistrationQrActivity.class)
|
||||
.addExtra(RegistrationQrActivity.ADD_AS_SECOND_DEVICE_EXTRA, true)
|
||||
.initiateScan();
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
|
||||
@@ -16,12 +16,13 @@ import org.thoughtcrime.securesms.BaseActionBarActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
public class RegistrationQrActivity extends BaseActionBarActivity {
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||
public static final String ADD_AS_SECOND_DEVICE_EXTRA = "add_as_second_device";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
|
||||
private CaptureManager capture;
|
||||
@@ -34,7 +35,15 @@ public class RegistrationQrActivity extends BaseActionBarActivity {
|
||||
dynamicTheme.onCreate(this);
|
||||
dynamicLanguage.onCreate(this);
|
||||
|
||||
setContentView(R.layout.activity_registration_qr);
|
||||
boolean addAsAnotherDevice = getIntent().getBooleanExtra(ADD_AS_SECOND_DEVICE_EXTRA, false);
|
||||
if (addAsAnotherDevice) {
|
||||
setContentView(R.layout.activity_registration_qr);
|
||||
getSupportActionBar().setTitle(R.string.multidevice_receiver_title);
|
||||
} else {
|
||||
setContentView(R.layout.activity_registration_qr);
|
||||
getSupportActionBar().setTitle(R.string.scan_invitation_code);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
|
||||
barcodeScannerView.setStatusText(getString(R.string.qrscan_hint) + "\n ");
|
||||
|
||||
Reference in New Issue
Block a user