mirror of
https://github.com/status-im/syng-client.git
synced 2025-02-23 08:28:07 +00:00
Fixed issue#31 concerning profile edit without password
This commit is contained in:
parent
1d8925c53e
commit
f7ad4460db
@ -283,9 +283,6 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
|
||||||
|
|
||||||
|
|
||||||
private void flipDrawer() {
|
private void flipDrawer() {
|
||||||
ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
|
ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
|
||||||
if (isDrawerFrontViewActive()) {
|
if (isDrawerFrontViewActive()) {
|
||||||
@ -320,11 +317,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProfileClick(Profile profile) {
|
public void onProfileClick(Profile profile) {
|
||||||
if (ProfileManager.getCurrentProfile().getId().equals(profile.getId())) {
|
if (!ProfileManager.getCurrentProfile().getId().equals(profile.getId())) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
requestChangeProfile(profile);
|
requestChangeProfile(profile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProfileImport() {
|
public void onProfileImport() {
|
||||||
@ -339,8 +335,34 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
public void onProfilePress(final Profile profile) {
|
public void onProfilePress(final Profile profile) {
|
||||||
|
if (ProfileManager.getCurrentProfile().getId().equals(profile.getId())) {
|
||||||
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
||||||
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
||||||
|
} else {
|
||||||
|
Dialog dialog = new MaterialDialog.Builder(BaseActivity.this)
|
||||||
|
.title(R.string.request_profile_password)
|
||||||
|
.customView(R.layout.profile_password, true)
|
||||||
|
.positiveText(R.string.ok)
|
||||||
|
.negativeText(R.string.cancel)
|
||||||
|
.callback(new MaterialDialog.ButtonCallback() {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
|
@Override
|
||||||
|
public void onPositive(MaterialDialog dialog) {
|
||||||
|
View view = dialog.getCustomView();
|
||||||
|
EditText password = (EditText) view.findViewById(R.id.et_pass);
|
||||||
|
if (profile.checkPassword(password.getText().toString())) {
|
||||||
|
ProfileDialogFragment dialogFragment = ProfileDialogFragment.newInstance(profile);
|
||||||
|
dialogFragment.show(getSupportFragmentManager(), "profile_dialog");
|
||||||
|
} else {
|
||||||
|
Toast.makeText(BaseActivity.this, "Password is not correct", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
EditText name = (EditText) dialog.findViewById(R.id.et_pass);
|
||||||
|
GeneralUtil.showKeyBoard(name, this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user