mirror of
https://github.com/jamessanford/kegs.git
synced 2024-06-17 18:29:37 +00:00
Ask user what to do with each image.
This commit is contained in:
parent
39d3208185
commit
b0db2876b9
|
@ -265,7 +265,9 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||||
public void run() {
|
public void run() {
|
||||||
withUIActive(new Runnable() {
|
withUIActive(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
new DiskImageFragment(mConfigFile).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE);
|
if (findFragment(FRAGMENT_DISKIMAGE) == null) {
|
||||||
|
new DiskImageFragment(mConfigFile, DiskImage.BOOT).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -437,7 +439,7 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||||
supportInvalidateOptionsMenu(); // update icon
|
supportInvalidateOptionsMenu(); // update icon
|
||||||
return true;
|
return true;
|
||||||
} else if (item_id == R.id.action_diskimage) {
|
} else if (item_id == R.id.action_diskimage) {
|
||||||
new DiskImageFragment(mConfigFile).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE);
|
new DiskImageFragment(mConfigFile, DiskImage.ASK).show(getSupportFragmentManager(), FRAGMENT_DISKIMAGE);
|
||||||
return true;
|
return true;
|
||||||
} else if (item_id == R.id.action_more_keys) {
|
} else if (item_id == R.id.action_more_keys) {
|
||||||
final int vis = areControlsVisible() ? View.GONE : View.VISIBLE;
|
final int vis = areControlsVisible() ? View.GONE : View.VISIBLE;
|
||||||
|
@ -452,8 +454,12 @@ public class KegsMain extends SherlockFragmentActivity implements KegsKeyboard.S
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean dismissFragment(String tag) {
|
private SherlockDialogFragment findFragment(final String tag) {
|
||||||
final SherlockDialogFragment frag = (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(tag);
|
return (SherlockDialogFragment)getSupportFragmentManager().findFragmentByTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean dismissFragment(final String tag) {
|
||||||
|
final SherlockDialogFragment frag = findFragment(tag);
|
||||||
if (frag == null) {
|
if (frag == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,9 +25,14 @@ public class DiskImageFragment extends SherlockDialogFragment {
|
||||||
// TODO: This should be the title name, and then we should index to it.
|
// TODO: This should be the title name, and then we should index to it.
|
||||||
private static int mLastSelected = -1;
|
private static int mLastSelected = -1;
|
||||||
|
|
||||||
public DiskImageFragment(final ConfigFile config) {
|
// DiskImage.BOOT, DiskImage.ASK, etc.
|
||||||
|
private final int mDiskImageAction;
|
||||||
|
|
||||||
|
public DiskImageFragment(final ConfigFile config, int image_action) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
mDiskImageAction = image_action;
|
||||||
|
|
||||||
// NOTE: We scan the directories in the UI thread before displaying
|
// NOTE: We scan the directories in the UI thread before displaying
|
||||||
// the dialog. The user is waiting, but considering this is just
|
// the dialog. The user is waiting, but considering this is just
|
||||||
// peeking at the directory listing on local disk it should be quick.
|
// peeking at the directory listing on local disk it should be quick.
|
||||||
|
@ -70,6 +75,7 @@ public class DiskImageFragment extends SherlockDialogFragment {
|
||||||
mLastSelected = item;
|
mLastSelected = item;
|
||||||
DiskImage image = mFoundImages.get(item);
|
DiskImage image = mFoundImages.get(item);
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
|
image.action = mDiskImageAction;
|
||||||
((KegsMain)getActivity()).prepareDiskImage(image);
|
((KegsMain)getActivity()).prepareDiskImage(image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user