mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Hide the delete menu item in EditProfileActivity if the key profile is new
This commit is contained in:
parent
44139de212
commit
88670dfa96
2 changed files with 6 additions and 3 deletions
|
@ -22,6 +22,7 @@ import me.impy.aegis.encoding.Base32;
|
|||
import me.impy.aegis.helpers.SpinnerHelper;
|
||||
|
||||
public class EditProfileActivity extends AegisActivity {
|
||||
private boolean _isNew = false;
|
||||
private boolean _edited = false;
|
||||
private KeyProfile _profile;
|
||||
|
||||
|
@ -44,9 +45,10 @@ public class EditProfileActivity extends AegisActivity {
|
|||
bar.setHomeAsUpIndicator(R.drawable.ic_close);
|
||||
bar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
// if the intent doesn't contain a KeyProfile, create a new oneZ
|
||||
// if the intent doesn't contain a KeyProfile, create a new one
|
||||
_profile = (KeyProfile) getIntent().getSerializableExtra("KeyProfile");
|
||||
if (_profile == null) {
|
||||
_isNew = true;
|
||||
_profile = new KeyProfile();
|
||||
setTitle("Add profile");
|
||||
}
|
||||
|
@ -141,6 +143,9 @@ public class EditProfileActivity extends AegisActivity {
|
|||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu_edit, menu);
|
||||
if (_isNew) {
|
||||
menu.findItem(R.id.action_delete).setVisible(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,14 +10,12 @@ import android.media.MediaScannerConnection;
|
|||
import android.support.design.widget.BottomSheetDialog;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.getbase.floatingactionbutton.FloatingActionButton;
|
||||
import com.getbase.floatingactionbutton.FloatingActionsMenu;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue