Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed Sep 15, 2019
1 parent 38b2e3b commit 60b4dbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public void onButtonReset(View v) {

public boolean isFirstButton(int keyCode) {
return (keyCode == KeyEvent.KEYCODE_VOLUME_UP && options.getBoolean(Options.PREF_VOLUME, true)) ||
keyCode == KeyEvent.KEYCODE_DPAD_CENTER ||
// keyCode == KeyEvent.KEYCODE_DPAD_CENTER ||
keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
}

Expand Down Expand Up @@ -382,9 +382,9 @@ else if (isSecondButton(keyCode)) {
else if (keyCode == KeyEvent.KEYCODE_MENU) {
onButtonMenu(null);
}
else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
onButtonSettings(null);
}
// else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
// onButtonSettings(null);
// }
return super.onKeyDown(keyCode, event);
}

Expand Down Expand Up @@ -425,6 +425,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.pace:
pace();
return true;
case R.id.go_settings:
onButtonSettings(null);
return true;
}
return super.onOptionsItemSelected(item);
}
Expand Down Expand Up @@ -550,53 +553,6 @@ public void onCancel(DialogInterface dialogInterface) {
debug("pace");
}

public void myMenuChoice(String choice) {
switch (choice) {
case MENU_COPY_TIME:
stopwatch.copyToClipboard();
break;
case MENU_COPY_LAP:
stopwatch.copyLapsToClipboard();
break;
case MENU_CLEAR_LAP:
stopwatch.clearLapData();
break;
case MENU_PACE:
pace();
break;
}
}

void myMenu() {
final ArrayList<String> menu = new ArrayList<String>();
menu.add(MENU_COPY_TIME);
if (stopwatch.lapData.length()>0) {
menu.add(MENU_COPY_LAP);
menu.add(MENU_CLEAR_LAP);
}
if (stopwatch.getTime()>0)
menu.add(MENU_PACE);

AlertDialog.Builder builder = AlertDialog_Builder();
final String[] menuArray = new String[menu.size()];
menu.toArray(menuArray);
builder.setItems(menuArray, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
myMenuChoice(menuArray[i]);
setFullScreen();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
setFullScreen();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.copy_laps).setVisible(stopwatch.lapData.length()>0);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/menu/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<item android:id="@+id/copy_laps" android:title="Copy lap data to clipboard" />
<item android:id="@+id/clear_laps" android:title="Clear lap data" />
<item android:id="@+id/pace" android:title="Pace and speed" />
<item android:id="@+id/go_settings" android:title="Settings" />
</menu>

0 comments on commit 60b4dbf

Please sign in to comment.