use of org.gateshipone.malp.application.adapters.FileAdapter in project malp by gateship-one.
the class SearchFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_server_search, container, false);
// Get the main ListView of this fragment
mListView = rootView.findViewById(R.id.main_listview);
// Create the needed adapter for the ListView
mFileAdapter = new FileAdapter(getActivity(), false, true);
// Combine the two to a happy couple
mListView.setAdapter(mFileAdapter);
mListView.setOnItemClickListener(this);
registerForContextMenu(mListView);
mSelectSpinner = rootView.findViewById(R.id.search_criteria);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.server_search_choices, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
mSelectSpinner.setAdapter(adapter);
mSelectSpinner.setOnItemSelectedListener(new SpinnerSelectListener());
mSearchView = rootView.findViewById(R.id.search_text);
mSearchView.setOnQueryTextListener(new SearchViewQueryListener());
mSearchView.setOnFocusChangeListener(this);
// get swipe layout
mSwipeRefreshLayout = rootView.findViewById(R.id.refresh_layout);
// set swipe colors
mSwipeRefreshLayout.setColorSchemeColors(ThemeUtils.getThemeColor(getContext(), R.attr.colorAccent), ThemeUtils.getThemeColor(getContext(), R.attr.colorPrimary));
// set swipe refresh listener
mSwipeRefreshLayout.setOnRefreshListener(this::refreshContent);
setHasOptionsMenu(true);
// Get album sort order
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
mAlbumSortOrder = PreferenceHelper.getMPDAlbumSortOrder(sharedPref, getContext());
mClickAction = PreferenceHelper.getClickAction(sharedPref, getContext());
// Return the ready inflated and configured fragment view.
return rootView;
}
Aggregations