Merge pull request #3694 from ByteHamster/optionsitem-crash
Do not crash when clicking menu items while loading
This commit is contained in:
commit
cc66936726
@ -214,6 +214,10 @@ public class FeedInfoFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (feed == null) {
|
||||
Toast.makeText(getContext(), R.string.please_wait_for_data, Toast.LENGTH_LONG).show();
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
boolean handled = false;
|
||||
try {
|
||||
handled = FeedMenuHandler.onOptionsItemClicked(getContext(), item, feed);
|
||||
|
@ -19,6 +19,7 @@ import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
@ -235,6 +236,10 @@ public class FeedItemlistFragment extends ListFragment {
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (!super.onOptionsItemSelected(item)) {
|
||||
if (feed == null) {
|
||||
Toast.makeText(getContext(), R.string.please_wait_for_data, Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (!FeedMenuHandler.onOptionsItemClicked(getActivity(), item, feed)) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -157,6 +157,7 @@
|
||||
<string name="filtered_label">Filtered</string>
|
||||
<string name="refresh_failed_msg">{fa-exclamation-circle} Last Refresh failed</string>
|
||||
<string name="open_podcast">Open Podcast</string>
|
||||
<string name="please_wait_for_data">Please wait until the data is loaded</string>
|
||||
|
||||
<!-- actions on feeditems -->
|
||||
<string name="download_label">Download</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user