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;
}
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);
}
});
});
}
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;
}
Aggregations