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