move restore backup button from context menu on welcome screen

This commit is contained in:
kosyak 2024-05-18 13:41:39 +02:00
parent c3489836c4
commit 920656b45d
3 changed files with 15 additions and 11 deletions

View file

@ -11,6 +11,7 @@ import android.security.KeyChainAliasCallback;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -140,7 +141,11 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
addInviteUri(intent); addInviteUri(intent);
startActivity(intent); startActivity(intent);
}); });
binding.restoreBackup.setOnClickListener(v -> {
if (hasStoragePermission(REQUEST_IMPORT_BACKUP)) {
startActivity(new Intent(this, ImportBackupActivity.class));
}
});
} }
@Override @Override
@ -156,11 +161,6 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_import_backup:
if (hasStoragePermission(REQUEST_IMPORT_BACKUP)) {
startActivity(new Intent(this, ImportBackupActivity.class));
}
break;
case R.id.action_scan_qr_code: case R.id.action_scan_qr_code:
UriHandlerActivity.scan(this, true); UriHandlerActivity.scan(this, true);
break; break;

View file

@ -68,6 +68,15 @@
android:layout_gravity="right" android:layout_gravity="right"
android:text="@string/i_already_have_an_account" android:text="@string/i_already_have_an_account"
android:textColor="?android:textColorSecondary" /> android:textColor="?android:textColorSecondary" />
<Button
android:id="@+id/restore_backup"
style="@style/Widget.Conversations.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/restore_backup"
android:textColor="?android:textColorSecondary" />
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout

View file

@ -14,9 +14,4 @@
android:title="@string/action_add_account_with_certificate" android:title="@string/action_add_account_with_certificate"
android:visible="true" android:visible="true"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/action_import_backup"
android:title="@string/restore_backup"
app:showAsAction="never" />
</menu> </menu>