-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#51 added action and move methods to application service
- Loading branch information
Showing
12 changed files
with
159 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:id="@+id/action_add_exercise" | ||
android:showAsAction="collapseActionView" | ||
android:title="add exercise" /> | ||
<item | ||
android:id="@+id/action_move_exercise_up" | ||
android:showAsAction="collapseActionView" | ||
android:title="move up" /> | ||
<item | ||
android:id="@+id/action_move_exercise_down" | ||
android:showAsAction="collapseActionView" | ||
android:title="move down" /> | ||
<item | ||
android:id="@+id/action_delete_exercise" | ||
android:showAsAction="collapseActionView" | ||
android:title="delete" /> | ||
</menu> |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...ava/de/avalax/fitbuddy/presentation/edit/workout/ExerciseListMultiChoiceModeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package de.avalax.fitbuddy.presentation.edit.workout; | ||
|
||
import android.util.Log; | ||
import android.view.ActionMode; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.widget.AbsListView; | ||
import de.avalax.fitbuddy.presentation.R; | ||
|
||
class ExerciseListMultiChoiceModeListener implements AbsListView.MultiChoiceModeListener { | ||
private ExerciseListFragment exerciseListFragment; | ||
private MenuItem addExerciseMenuItem; | ||
private MenuItem moveExerciseUpMenuItem; | ||
private MenuItem moveExerciseDownMenuItem; | ||
|
||
public ExerciseListMultiChoiceModeListener(ExerciseListFragment exerciseListFragment) { | ||
this.exerciseListFragment = exerciseListFragment; | ||
} | ||
|
||
@Override | ||
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { | ||
updateMenuItems(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateActionMode(ActionMode mode, Menu menu) { | ||
mode.getMenuInflater().inflate(R.menu.edit_exerciselist_actions, mode.getMenu()); | ||
mode.setTitle(exerciseListFragment.getResources().getText(R.string.cab_title_manage_exercises)); | ||
addExerciseMenuItem = menu.findItem(R.id.action_add_exercise); | ||
moveExerciseUpMenuItem = menu.findItem(R.id.action_move_exercise_up); | ||
moveExerciseDownMenuItem = menu.findItem(R.id.action_move_exercise_down); | ||
updateMenuItems(); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { | ||
if (item.getItemId() == R.id.action_add_exercise) { | ||
Log.d("onActionItemClicked","add exercise"); | ||
} | ||
if (item.getItemId() == R.id.action_move_exercise_up) { | ||
Log.d("onActionItemClicked","move exercise up"); | ||
} | ||
if (item.getItemId() == R.id.action_move_exercise_down) { | ||
Log.d("onActionItemClicked","move exercise down"); | ||
} | ||
if (item.getItemId() == R.id.action_delete_exercise) { | ||
Log.d("onActionItemClicked","add exercise after"); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public void onDestroyActionMode(ActionMode mode) { | ||
|
||
} | ||
|
||
private void updateMenuItems() { | ||
boolean multiSelect = exerciseListFragment.getListView().getCheckedItemCount() > 1; | ||
addExerciseMenuItem.setVisible(!multiSelect); | ||
moveExerciseUpMenuItem.setVisible(!multiSelect); | ||
moveExerciseDownMenuItem.setVisible(!multiSelect); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters