forked from jens/Automation
confirmation dialog for deletions
This commit is contained in:
parent
2fd79140cb
commit
374a5c4263
@ -190,8 +190,27 @@ public class ActivityMainPoi extends ActivityGeneric
|
||||
startActivityForResult(manageSpecificPoiIntent, 2000);
|
||||
break;
|
||||
case 1:
|
||||
AlertDialog.Builder deleteDialog = new AlertDialog.Builder(ActivityMainPoi.this);
|
||||
deleteDialog.setMessage(getResources().getString(R.string.areYouSure));
|
||||
deleteDialog.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
if(pointOfInterest.delete(Miscellaneous.getAnyContext()))
|
||||
updateListView();
|
||||
}
|
||||
});
|
||||
deleteDialog.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
deleteDialog.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -186,12 +186,31 @@ public class ActivityMainProfiles extends ActivityGeneric
|
||||
case 2:
|
||||
Rule user = profile.isInUseByRules();
|
||||
if(user == null)
|
||||
{
|
||||
AlertDialog.Builder deleteDialog = new AlertDialog.Builder(ActivityMainProfiles.this);
|
||||
deleteDialog.setMessage(getResources().getString(R.string.areYouSure));
|
||||
deleteDialog.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
if (profile.delete(ActivityMainProfiles.this))
|
||||
updateListView();
|
||||
else
|
||||
Toast.makeText(ActivityMainProfiles.this, getResources().getString(R.string.profileCouldNotBeDeleted), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
deleteDialog.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
deleteDialog.show();
|
||||
}
|
||||
else
|
||||
Toast.makeText(ActivityMainProfiles.this, String.format(getResources().getString(R.string.ruleXIsUsingProfileY), user.getName(), profile.getName()), Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
|
@ -18,6 +18,7 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.jens.automation2.AutomationService.serviceCommands;
|
||||
import com.jens.automation2.receivers.DateTimeListener;
|
||||
|
||||
@ -213,11 +214,30 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
startActivityForResult(manageSpecificRuleIntent, requestCodeChangeRule);
|
||||
break;
|
||||
case 2:
|
||||
AlertDialog.Builder deleteDialog = new AlertDialog.Builder(ActivityMainRules.this);
|
||||
deleteDialog.setMessage(getResources().getString(R.string.areYouSure));
|
||||
deleteDialog.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
if(ruleThisIsAbout.delete())
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
}
|
||||
}
|
||||
});
|
||||
deleteDialog.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
deleteDialog.show();
|
||||
break;
|
||||
case 3:
|
||||
ruleToEdit = ruleThisIsAbout;
|
||||
|
1
fastlane/metadata/android/en-US/changelogs/123.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/123.txt
Normal file
@ -0,0 +1 @@
|
||||
* New: Confirmation dialog before deleting locations, rules and profile
|
Loading…
Reference in New Issue
Block a user