From f2a7af986a747a2841b47926bbaaf0dc9ebea826 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 19 Feb 2020 13:04:59 +0100 Subject: [PATCH 1/4] no special handling for empty names --- .../securesms/CreateProfileActivity.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index 1069cf026..03b9777b1 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -76,7 +76,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { private EmojiDrawer emojiDrawer; private TextInputEditText statusView; private View reveal; - private MenuItem finishMenuItem; private Intent nextIntent; private byte[] avatarBytes; @@ -107,7 +106,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { public boolean onPrepareOptionsMenu(Menu menu) { MenuInflater inflater = this.getMenuInflater(); inflater.inflate(R.menu.preferences_create_profile_menu, menu); - finishMenuItem = menu.findItem(R.id.menu_create_profile); return true; } @@ -230,21 +228,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { .onAnyResult(this::handleAvatarSelectionWithPermissions) .execute()); - this.name.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) {} - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) {} - @Override - public void afterTextChanged(Editable s) { - if(finishMenuItem != null){ - if (name.getError() != null || !finishMenuItem.isEnabled()) { - name.setError(null); - finishMenuItem.setEnabled(true); - } - }} - }); - passwordAccountSettings.setOnClickListener(view -> { Intent intent = new Intent(this, RegistrationActivity.class); startActivity(intent); From a7975bbd3794ecd9a29ae98afe76da0b4d206881 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 19 Feb 2020 13:21:40 +0100 Subject: [PATCH 2/4] remove dead code --- .../securesms/CreateProfileActivity.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index 03b9777b1..e098d0d2f 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -14,10 +14,7 @@ import android.provider.MediaStore; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.material.textfield.TextInputEditText; -import androidx.appcompat.app.AlertDialog; -import android.text.Editable; import android.text.TextUtils; -import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -63,8 +60,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { private static final String TAG = CreateProfileActivity.class.getSimpleName(); - public static final String NEXT_INTENT = "next_intent"; - private static final int REQUEST_CODE_AVATAR = 1; private final DynamicTheme dynamicTheme = new DynamicTheme(); @@ -77,7 +72,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { private TextInputEditText statusView; private View reveal; - private Intent nextIntent; private byte[] avatarBytes; private File captureFile; @@ -218,7 +212,6 @@ public class CreateProfileActivity extends BaseActionBarActivity { this.container = ViewUtil.findById(this, R.id.container); this.reveal = ViewUtil.findById(this, R.id.reveal); this.statusView = ViewUtil.findById(this, R.id.status_text); - this.nextIntent = getIntent().getParcelableExtra(NEXT_INTENT); this.avatar.setImageDrawable(new ResourceContactPhoto(R.drawable.ic_camera_alt_white_24dp).asDrawable(this, getResources().getColor(R.color.grey_400))); @@ -376,7 +369,7 @@ public class CreateProfileActivity extends BaseActionBarActivity { if (result) { if (captureFile != null) captureFile.delete(); - handleFinishedLegacy(); + finish(); } else { Toast.makeText(CreateProfileActivity.this, R.string.error, Toast.LENGTH_LONG).show(); } @@ -388,9 +381,4 @@ public class CreateProfileActivity extends BaseActionBarActivity { String newStatus = statusView.getText().toString().trim(); DcHelper.set(this, DcHelper.CONFIG_SELF_STATUS, newStatus); } - - private void handleFinishedLegacy() { - if (nextIntent != null) startActivity(nextIntent); - finish(); - } } From 673082fb66bf764997609c56bb4ea2d1dc0139bf Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 19 Feb 2020 16:26:04 +0100 Subject: [PATCH 3/4] add option 'fromWelcome' to create-profile activity that forward to the chatlist once done and displays some slightly different text+controls --- res/layout/profile_create_activity.xml | 13 +++++++ .../securesms/CreateProfileActivity.java | 37 ++++++++++++++++--- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/res/layout/profile_create_activity.xml b/res/layout/profile_create_activity.xml index 66e09c4cb..a23f9793a 100644 --- a/res/layout/profile_create_activity.xml +++ b/res/layout/profile_create_activity.xml @@ -13,6 +13,18 @@ android:layout_marginTop="20dp" android:orientation="vertical"> + + Date: Wed, 19 Feb 2020 16:27:24 +0100 Subject: [PATCH 4/4] forward to enter-profile-name after crating a burner-account --- .../thoughtcrime/securesms/WelcomeActivity.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/org/thoughtcrime/securesms/WelcomeActivity.java b/src/org/thoughtcrime/securesms/WelcomeActivity.java index ff0d95d11..c0a3a7386 100644 --- a/src/org/thoughtcrime/securesms/WelcomeActivity.java +++ b/src/org/thoughtcrime/securesms/WelcomeActivity.java @@ -165,11 +165,18 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen progressDialog.setMessage(getResources().getString(R.string.one_moment)+String.format(" %d%%", percent)); } - private void progressSuccess() { + private void progressSuccess(boolean enterDisplayname) { dcContext.endCaptureNextError(); progressDialog.dismiss(); - Intent conversationList = new Intent(getApplicationContext(), ConversationListActivity.class); - startActivity(conversationList); + + if (enterDisplayname) { + Intent intent = new Intent(getApplicationContext(), CreateProfileActivity.class); + intent.putExtra(CreateProfileActivity.FROM_WELCOME, true); + startActivity(intent); + } else { + startActivity(new Intent(getApplicationContext(), ConversationListActivity.class)); + } + finish(); } @@ -184,7 +191,7 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen progressUpdate((int)progress); } else if (progress==1000/*done*/) { - progressSuccess(); + progressSuccess(false); } } else if (manualConfigure && eventId==DcContext.DC_EVENT_CONFIGURE_PROGRESS) { @@ -202,7 +209,7 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen progressUpdate((int)progress); } else if (progress==1000/*done*/) { - progressSuccess(); + progressSuccess(true); } } }