|
@ -4,6 +4,9 @@ import android.content.Context; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
import android.util.Log; |
|
|
import android.util.Log; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
|
|
|
import android.view.Menu; |
|
|
|
|
|
import android.view.MenuInflater; |
|
|
|
|
|
import android.view.MenuItem; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewGroup; |
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
@ -12,6 +15,7 @@ import androidx.annotation.NonNull; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.appcompat.app.ActionBar; |
|
|
import androidx.appcompat.app.ActionBar; |
|
|
import androidx.appcompat.app.AppCompatActivity; |
|
|
import androidx.appcompat.app.AppCompatActivity; |
|
|
|
|
|
import androidx.appcompat.widget.SearchView; |
|
|
import androidx.fragment.app.Fragment; |
|
|
import androidx.fragment.app.Fragment; |
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
import androidx.navigation.NavDirections; |
|
|
import androidx.navigation.NavDirections; |
|
@ -51,8 +55,9 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr |
|
|
private ArchivesViewModel archivesViewModel; |
|
|
private ArchivesViewModel archivesViewModel; |
|
|
private StoriesService storiesService; |
|
|
private StoriesService storiesService; |
|
|
private Context context; |
|
|
private Context context; |
|
|
private String type, endCursor = null; |
|
|
|
|
|
|
|
|
private String type, currentQuery, endCursor = null; |
|
|
private FeedStoriesListAdapter adapter; |
|
|
private FeedStoriesListAdapter adapter; |
|
|
|
|
|
private MenuItem menuSearch; |
|
|
|
|
|
|
|
|
private final OnFeedStoryClickListener clickListener = new OnFeedStoryClickListener() { |
|
|
private final OnFeedStoryClickListener clickListener = new OnFeedStoryClickListener() { |
|
|
@Override |
|
|
@Override |
|
@ -119,6 +124,7 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr |
|
|
fragmentActivity = (AppCompatActivity) requireActivity(); |
|
|
fragmentActivity = (AppCompatActivity) requireActivity(); |
|
|
context = getContext(); |
|
|
context = getContext(); |
|
|
if (context == null) return; |
|
|
if (context == null) return; |
|
|
|
|
|
setHasOptionsMenu(true); |
|
|
storiesService = StoriesService.getInstance(null, 0L, null); |
|
|
storiesService = StoriesService.getInstance(null, 0L, null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -141,6 +147,30 @@ public final class StoryListViewerFragment extends Fragment implements SwipeRefr |
|
|
shouldRefresh = false; |
|
|
shouldRefresh = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onCreateOptionsMenu(@NonNull final Menu menu, final MenuInflater inflater) { |
|
|
|
|
|
inflater.inflate(R.menu.search, menu); |
|
|
|
|
|
menuSearch = menu.findItem(R.id.action_search); |
|
|
|
|
|
final SearchView searchView = (SearchView) menuSearch.getActionView(); |
|
|
|
|
|
searchView.setQueryHint(getResources().getString(R.string.action_search)); |
|
|
|
|
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean onQueryTextSubmit(final String query) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean onQueryTextChange(final String query) { |
|
|
|
|
|
if (adapter != null) { |
|
|
|
|
|
currentQuery = query; |
|
|
|
|
|
adapter.getFilter().filter(query); |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onResume() { |
|
|
public void onResume() { |
|
|
super.onResume(); |
|
|
super.onResume(); |
|
|