Skip to content

Commit

Permalink
remove a deprecated call
Browse files Browse the repository at this point in the history
  • Loading branch information
CampelloManuel committed Jan 14, 2024
1 parent ec27efd commit 0772d77
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
import com.nononsenseapps.helpers.ListHelper;
import com.nononsenseapps.helpers.NnnLogger;
import com.nononsenseapps.helpers.PreferencesHelper;
import com.nononsenseapps.notepad.activities.main.ActivityMain_;
import com.nononsenseapps.notepad.R;
import com.nononsenseapps.notepad.activities.main.ActivityMain_;
import com.nononsenseapps.notepad.database.Task;
import com.nononsenseapps.notepad.database.TaskList;
import com.nononsenseapps.notepad.databinding.FragmentTaskListBinding;
Expand Down Expand Up @@ -472,6 +472,9 @@ void loadList() {
return true;
});

// TODO this MultiChoiceModeListener occupies the next 220 lines.
// It handles the logic for when multiple notes are selected and a button on
// the action bar is pressed. Put this class in its own java file
listView.setMultiChoiceModeListener(new MultiChoiceModeListener() {

final HashMap<Long, Task> tasks = new HashMap<>();
Expand Down Expand Up @@ -582,6 +585,10 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return true;
}

/**
* When the user presses a button on the action bar, this function decides what to do
* with the selected notes: copy, delete, share, or move to another list
*/
@Override
public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
// Respond to clicks on the actions in the CAB
Expand Down Expand Up @@ -683,13 +690,17 @@ String getShareSubject() {
return result.length() > 0 ? result.substring(2) : result;
}

/**
* When you select multiple notes, and presses 'share' on the menu,
* this function creates the intent to call Android's app picker to choose
* who will receive the shared notes' content
*/
Intent getShareIntent() {
final Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, getShareText());
shareIntent.putExtra(Intent.EXTRA_SUBJECT, getShareSubject());
shareIntent
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
return shareIntent;
}
});
Expand Down

0 comments on commit 0772d77

Please sign in to comment.