use of com.zype.android.ui.NavigationHelper in project zype-android by zype.
the class GalleryRowItemsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final GalleryRowItemsAdapter.ViewHolder holder, int position) {
holder.item = items.get(position);
updateTitle(holder);
updateInlineTitle(holder);
loadThumbnail(holder);
updateLockIcon(holder);
holder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavigationHelper navigationHelper = NavigationHelper.getInstance(holder.view.getContext());
if (holder.item instanceof Video) {
Video video = (Video) holder.item;
navigationHelper.handleVideoClick((Activity) holder.view.getContext(), video, playlistId, false);
} else if (holder.item instanceof Playlist) {
Playlist playlist = (Playlist) holder.item;
navigationHelper.handlePlaylistClick((Activity) holder.view.getContext(), playlist);
}
}
});
}
use of com.zype.android.ui.NavigationHelper in project zype-android by zype.
the class SearchActivity method onItemClick.
// //////////
// UI
//
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Logger.d("onItemClick()");
VideosCursorAdapter.VideosViewHolder holder = (VideosCursorAdapter.VideosViewHolder) view.getTag();
NavigationHelper navigationHelper = NavigationHelper.getInstance(this);
if (AuthHelper.isVideoUnlocked(this, holder.videoId, null)) {
navigationHelper.switchToVideoDetailsScreen(this, holder.videoId, null, false);
} else {
navigationHelper.handleNotAuthorizedVideo(this, holder.videoId, null);
}
}
use of com.zype.android.ui.NavigationHelper in project zype-android by zype.
the class ActionBuyVideoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = FragmentActionBuyVideoBinding.inflate(inflater, container, false);
final NavigationHelper navigationHelper = NavigationHelper.getInstance(getActivity());
binding.actionLayout.setOnClickListener(v -> {
if (AuthHelper.isLoggedIn()) {
showPurchaseScreen();
} else {
navigationHelper.switchToLoginScreen(this);
}
});
return binding.getRoot();
}
use of com.zype.android.ui.NavigationHelper in project zype-android by zype.
the class LibraryFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
model = ViewModelProviders.of(this).get(LibraryViewModel.class);
model.getVideos().observe(this, observerVideos);
model.getSelectedVideo().observe(this, video -> {
if (video != null) {
NavigationHelper navigationHelper = NavigationHelper.getInstance(getActivity());
navigationHelper.handleVideoClick(getActivity(), video, null, false);
model.onSelectedVideoProcessed();
}
});
adapter.setVideoListener((video) -> {
model.onVideoClicked(video);
});
adapter.setPopupMenuListener((action, video) -> {
model.handleVideoAction(action, video, success -> {
if (success) {
model.retrieveVideos(false);
} else {
NavigationHelper.getInstance(getActivity()).switchToLoginScreen(getActivity());
}
});
});
}
use of com.zype.android.ui.NavigationHelper 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);
}
});
});
}
Aggregations