Search in sources :

Example 1 with VideosAdapter

use of com.zype.android.ui.v2.videos.VideosAdapter in project zype-android by zype.

the class LibraryFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_library, container, false);
    listVideos = rootView.findViewById(R.id.listVideos);
    adapter = new VideosAdapter(null);
    listVideos.setAdapter(adapter);
    layoutEmpty = rootView.findViewById(R.id.layoutEmpty);
    layoutSignedOut = rootView.findViewById(R.id.layoutSignedOut);
    progressBar = rootView.findViewById(R.id.progress);
    showProgress();
    return rootView;
}
Also used : View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) VideosAdapter(com.zype.android.ui.v2.videos.VideosAdapter)

Example 2 with VideosAdapter

use of com.zype.android.ui.v2.videos.VideosAdapter in project zype-android by zype.

the class SearchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_v2);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    listVideos = findViewById(R.id.listVideos);
    adapter = new VideosAdapter(null);
    listVideos.setAdapter(adapter);
    progressBar = findViewById(R.id.progress);
    viewSearch = findViewById(R.id.viewSearch);
    viewSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            if (!TextUtils.isEmpty(query)) {
                model.search(query, ZypeConfiguration.getRootPlaylistId(SearchActivity.this));
            }
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    viewSearch.setOnCloseListener(new SearchView.OnCloseListener() {

        @Override
        public boolean onClose() {
            hideProgress();
            model.clearSearchResults();
            showEmptyQuery(true);
            return false;
        }
    });
    textEmptyResult = findViewById(R.id.textEmptyResult);
    textErrorEmptyQuery = findViewById(R.id.textErrorEmptyQuery);
    viewSearch.setQuery("", false);
    viewSearch.setIconified(false);
    viewSearch.setFocusable(false);
    viewSearch.clearFocus();
    model = ViewModelProviders.of(this).get(SearchViewModel.class);
    model.getVideos().observe(this, createVideosObserver());
    model.getSelectedVideo().observe(this, video -> {
        if (video != null) {
            NavigationHelper navigationHelper = NavigationHelper.getInstance(this);
            navigationHelper.handleVideoClick(this, video, null, false);
            model.onSelectedVideoProcessed();
        }
    });
    adapter.setVideoListener((video) -> {
        model.onVideoClicked(video);
    });
    adapter.setPopupMenuListener((action, video) -> {
        model.handleVideoAction(action, video, success -> {
            if (success) {
                model.refresh();
            } else {
                NavigationHelper.getInstance(SearchActivity.this).switchToLoginScreen(SearchActivity.this);
            }
        });
    });
}
Also used : SearchView(androidx.appcompat.widget.SearchView) NavigationHelper(com.zype.android.ui.NavigationHelper) Toolbar(androidx.appcompat.widget.Toolbar) VideosAdapter(com.zype.android.ui.v2.videos.VideosAdapter)

Example 3 with VideosAdapter

use of com.zype.android.ui.v2.videos.VideosAdapter in project zype-android by zype.

the class FavoritesFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_favorites_v2, container, false);
    listVideos = rootView.findViewById(R.id.listVideos);
    adapter = new VideosAdapter(null);
    listVideos.setAdapter(adapter);
    layoutEmpty = rootView.findViewById(R.id.layoutEmpty);
    progressBar = rootView.findViewById(R.id.progress);
    return rootView;
}
Also used : View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) VideosAdapter(com.zype.android.ui.v2.videos.VideosAdapter)

Aggregations

VideosAdapter (com.zype.android.ui.v2.videos.VideosAdapter)3 View (android.view.View)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 SearchView (androidx.appcompat.widget.SearchView)1 Toolbar (androidx.appcompat.widget.Toolbar)1 NavigationHelper (com.zype.android.ui.NavigationHelper)1