mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 19:26:17 +00:00
Update contact name editor.
This commit is contained in:
committed by
Cody Henthorne
parent
00d5724cec
commit
17b00734ac
@@ -7,11 +7,10 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
||||
@@ -22,10 +21,8 @@ public class ContactNameEditActivity extends PassphraseRequiredActivity {
|
||||
public static final String KEY_NAME = "name";
|
||||
public static final String KEY_CONTACT_INDEX = "contact_index";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||
|
||||
private TextView displayNameView;
|
||||
private ContactNameEditViewModel viewModel;
|
||||
|
||||
static Intent getIntent(@NonNull Context context, @NonNull Name name, int contactPosition) {
|
||||
@@ -38,7 +35,6 @@ public class ContactNameEditActivity extends PassphraseRequiredActivity {
|
||||
@Override
|
||||
protected void onPreCreate() {
|
||||
dynamicTheme.onCreate(this);
|
||||
dynamicLanguage.onCreate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,16 +55,14 @@ public class ContactNameEditActivity extends PassphraseRequiredActivity {
|
||||
initializeToolbar();
|
||||
initializeViews(name);
|
||||
|
||||
viewModel = ViewModelProviders.of(this).get(ContactNameEditViewModel.class);
|
||||
viewModel = new ViewModelProvider(this).get(ContactNameEditViewModel.class);
|
||||
viewModel.setName(name);
|
||||
viewModel.getDisplayName().observe(this, displayNameView::setText);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
dynamicTheme.onResume(this);
|
||||
dynamicLanguage.onResume(this);
|
||||
}
|
||||
|
||||
private void initializeToolbar() {
|
||||
@@ -86,8 +80,6 @@ public class ContactNameEditActivity extends PassphraseRequiredActivity {
|
||||
}
|
||||
|
||||
private void initializeViews(@NonNull Name name) {
|
||||
displayNameView = findViewById(R.id.name_edit_display_name);
|
||||
|
||||
TextView givenName = findViewById(R.id.name_edit_given_name);
|
||||
TextView familyName = findViewById(R.id.name_edit_family_name);
|
||||
TextView middleName = findViewById(R.id.name_edit_middle_name);
|
||||
|
||||
@@ -39,10 +39,6 @@ public class ContactNameEditViewModel extends ViewModel {
|
||||
return new Name(displayName.getValue(), givenName, familyName, prefix, suffix, middleName);
|
||||
}
|
||||
|
||||
LiveData<String> getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
void updateGivenName(@NonNull String givenName) {
|
||||
this.givenName = givenName;
|
||||
displayName.postValue(buildDisplayName());
|
||||
|
||||
Reference in New Issue
Block a user