mirror of
https://github.com/etesync/android
synced 2025-02-02 19:01:06 +00:00
Disallow deleting the last collection.
This commit is contained in:
parent
a10015ee1a
commit
7c4e6a11e1
@ -236,7 +236,16 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
|||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.delete_collection:
|
case R.id.delete_collection:
|
||||||
DeleteCollectionFragment.ConfirmDeleteCollectionFragment.newInstance(account, info).show(getSupportFragmentManager(), null);
|
if (adapter.getCount() == 1) {
|
||||||
|
new AlertDialog.Builder(AccountActivity.this)
|
||||||
|
.setIcon(R.drawable.ic_error_dark)
|
||||||
|
.setTitle(R.string.account_delete_collection_last_title)
|
||||||
|
.setMessage(R.string.account_delete_collection_last_text)
|
||||||
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.show();
|
||||||
|
} else {
|
||||||
|
DeleteCollectionFragment.ConfirmDeleteCollectionFragment.newInstance(account, info).show(getSupportFragmentManager(), null);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,6 +108,8 @@
|
|||||||
<string name="account_create_new_address_book">Create new address book</string>
|
<string name="account_create_new_address_book">Create new address book</string>
|
||||||
<string name="account_refresh_calendar_list">Refresh calendar list</string>
|
<string name="account_refresh_calendar_list">Refresh calendar list</string>
|
||||||
<string name="account_create_new_calendar">Create new calendar</string>
|
<string name="account_create_new_calendar">Create new calendar</string>
|
||||||
|
<string name="account_delete_collection_last_title">Can\'t delete last collection</string>
|
||||||
|
<string name="account_delete_collection_last_text">Deleting the last collection is not allowed, please create a new one if you\'d like to delete this one.</string>
|
||||||
|
|
||||||
<!-- PermissionsActivity -->
|
<!-- PermissionsActivity -->
|
||||||
<string name="permissions_title">EteSync permissions</string>
|
<string name="permissions_title">EteSync permissions</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user