forked from jensstein/oandbackup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRestoreOptionsDialogFragment.java
57 lines (55 loc) · 1.94 KB
/
RestoreOptionsDialogFragment.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package dk.jens.backup;
import android.app.AlertDialog;
import android.app.Dialog;
//import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
public class RestoreOptionsDialogFragment extends DialogFragment
{
final static String TAG = OAndBackup.TAG;
String packageName, label;
AppInfo appInfo;
public RestoreOptionsDialogFragment(AppInfo appInfo)
{
this.appInfo = appInfo;
this.packageName = appInfo.getPackageName();
this.label = appInfo.getLabel();
}
public Dialog onCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(label);
builder.setMessage(packageName);
//midlertidigt indtil custom layout med flere muligheder
builder.setPositiveButton("restore apk", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
OAndBackup obackup = (OAndBackup) getActivity();
obackup.callRestore(appInfo, 1);
}
});
if(appInfo.isInstalled)
{
builder.setNeutralButton("restore data", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
OAndBackup obackup = (OAndBackup) getActivity();
obackup.callRestore(appInfo, 2);
}
});
}
builder.setNegativeButton("restore apk and data", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
OAndBackup obackup = (OAndBackup) getActivity();
obackup.callRestore(appInfo, 3);
}
});
return builder.create();
}
}