download-manager delete function
This commit is contained in:
parent
5bb53b6b84
commit
2c73665174
2 changed files with 113 additions and 12 deletions
|
|
@ -1,6 +1,12 @@
|
|||
package btools.routingapp;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
|
|
@ -9,6 +15,8 @@ import android.speech.tts.TextToSpeech.OnInitListener;
|
|||
|
||||
public class BInstallerActivity extends Activity implements OnInitListener {
|
||||
|
||||
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
|
||||
|
||||
private BInstallerView mBInstallerView;
|
||||
private PowerManager mPowerManager;
|
||||
private WakeLock mWakeLock;
|
||||
|
|
@ -58,6 +66,52 @@ public class BInstallerActivity extends Activity implements OnInitListener {
|
|||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
AlertDialog.Builder builder;
|
||||
switch ( id )
|
||||
{
|
||||
case DIALOG_CONFIRM_DELETE_ID:
|
||||
builder = new AlertDialog.Builder( this );
|
||||
builder
|
||||
.setTitle( "Confirm Delete" )
|
||||
.setMessage( "Really delete?" ).setPositiveButton( "Yes", new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick( DialogInterface dialog, int id )
|
||||
{
|
||||
mBInstallerView.deleteSelectedTiles();
|
||||
}
|
||||
} ).setNegativeButton( "No", new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick( DialogInterface dialog, int id )
|
||||
{
|
||||
}
|
||||
} );
|
||||
return builder.create();
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void showConfirmDelete()
|
||||
{
|
||||
showDialog( DIALOG_CONFIRM_DELETE_ID );
|
||||
}
|
||||
|
||||
private Set<Integer> dialogIds = new HashSet<Integer>();
|
||||
|
||||
private void showNewDialog( int id )
|
||||
{
|
||||
if ( dialogIds.contains( Integer.valueOf( id ) ) )
|
||||
{
|
||||
removeDialog( id );
|
||||
}
|
||||
dialogIds.add( Integer.valueOf( id ) );
|
||||
showDialog( id );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue