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);
|
startActivityForResult(manageSpecificPoiIntent, 2000);
|
||||||
break;
|
break;
|
||||||
case 1:
|
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()))
|
if(pointOfInterest.delete(Miscellaneous.getAnyContext()))
|
||||||
updateListView();
|
updateListView();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deleteDialog.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteDialog.show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,12 +186,31 @@ public class ActivityMainProfiles extends ActivityGeneric
|
|||||||
case 2:
|
case 2:
|
||||||
Rule user = profile.isInUseByRules();
|
Rule user = profile.isInUseByRules();
|
||||||
if(user == null)
|
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))
|
if (profile.delete(ActivityMainProfiles.this))
|
||||||
updateListView();
|
updateListView();
|
||||||
else
|
else
|
||||||
Toast.makeText(ActivityMainProfiles.this, getResources().getString(R.string.profileCouldNotBeDeleted), Toast.LENGTH_LONG).show();
|
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
|
else
|
||||||
Toast.makeText(ActivityMainProfiles.this, String.format(getResources().getString(R.string.ruleXIsUsingProfileY), user.getName(), profile.getName()), Toast.LENGTH_LONG).show();
|
Toast.makeText(ActivityMainProfiles.this, String.format(getResources().getString(R.string.ruleXIsUsingProfileY), user.getName(), profile.getName()), Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
|
@ -18,6 +18,7 @@ import android.widget.ListView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.jens.automation2.AutomationService.serviceCommands;
|
import com.jens.automation2.AutomationService.serviceCommands;
|
||||||
import com.jens.automation2.receivers.DateTimeListener;
|
import com.jens.automation2.receivers.DateTimeListener;
|
||||||
|
|
||||||
@ -213,11 +214,30 @@ public class ActivityMainRules extends ActivityGeneric
|
|||||||
startActivityForResult(manageSpecificRuleIntent, requestCodeChangeRule);
|
startActivityForResult(manageSpecificRuleIntent, requestCodeChangeRule);
|
||||||
break;
|
break;
|
||||||
case 2:
|
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())
|
if(ruleThisIsAbout.delete())
|
||||||
{
|
{
|
||||||
ruleToEdit = null; //clear cache
|
ruleToEdit = null; //clear cache
|
||||||
updateListView();
|
updateListView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deleteDialog.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialogInterface, int i)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
deleteDialog.show();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ruleToEdit = ruleThisIsAbout;
|
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