use of com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog in project MusicDNA by harjot-oberai.
the class ViewAlbumFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
backBtn = (ImageView) view.findViewById(R.id.view_album_back_btn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
backDrop = (ImageView) view.findViewById(R.id.album_backdrop);
imgLoader.DisplayImage(HomeActivity.tempAlbum.getAlbumSongs().get(0).getPath(), backDrop);
fragTitle = (TextView) view.findViewById(R.id.album_fragment_title);
if (SplashActivity.tf4 != null)
fragTitle.setTypeface(SplashActivity.tf4);
albumTitle = (TextView) view.findViewById(R.id.album_title);
albumTitle.setText(HomeActivity.tempAlbum.getName());
albumTracksText = (TextView) view.findViewById(R.id.album_tracks_text);
addToQueueIcon = (ImageView) view.findViewById(R.id.add_album_to_queue_icon);
addToQueueIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.addAlbumToQueue();
}
});
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.getLayoutParams().height = 0;
else
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
int tmp = HomeActivity.tempAlbum.getAlbumSongs().size();
String details1;
if (tmp == 1) {
details1 = "1 Song ";
} else {
details1 = tmp + " Songs ";
}
albumTracksText.setText(details1);
fab = (FloatingActionButton) view.findViewById(R.id.play_all_from_album);
fab.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
rv = (RecyclerView) view.findViewById(R.id.album_songs_recycler);
aslAdapter = new LocalTrackRecyclerAdapter(HomeActivity.tempAlbum.getAlbumSongs(), getContext());
LinearLayoutManager mLayoutManager2 = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
rv.setLayoutManager(mLayoutManager2);
rv.setItemAnimator(new DefaultItemAnimator());
rv.setAdapter(aslAdapter);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.tempAlbum.getAlbumSongs().size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.tempAlbum.getAlbumSongs().get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
mCallback.onAlbumPlayAll();
}
});
rv.addOnItemTouchListener(new ClickItemTouchListener(rv) {
@Override
public boolean onClick(RecyclerView parent, View view, int position, long id) {
LocalTrack track = HomeActivity.tempAlbum.getAlbumSongs().get(position);
if (HomeActivity.queue.getQueue().size() == 0) {
HomeActivity.queueCurrentIndex = 0;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.queueCurrentIndex == HomeActivity.queue.getQueue().size() - 1) {
HomeActivity.queueCurrentIndex++;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.isReloaded) {
HomeActivity.isReloaded = false;
HomeActivity.queueCurrentIndex = HomeActivity.queue.getQueue().size();
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else {
HomeActivity.queue.getQueue().add(++HomeActivity.queueCurrentIndex, new UnifiedTrack(true, track, null));
}
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onAlbumSongClick();
return true;
}
@Override
public boolean onLongClick(RecyclerView parent, View view, final int position, long id) {
CustomLocalBottomSheetDialog localBottomSheetDialog = new CustomLocalBottomSheetDialog();
localBottomSheetDialog.setPosition(position);
localBottomSheetDialog.setLocalTrack(activity.tempAlbum.getAlbumSongs().get(position));
localBottomSheetDialog.setFragment("Album");
localBottomSheetDialog.show(activity.getSupportFragmentManager(), "local_song_bottom_sheet");
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
}
use of com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog in project MusicDNA by harjot-oberai.
the class RecentlyAddedSongsFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded) {
bottomMarginLayout.getLayoutParams().height = 0;
} else {
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
}
playAllFAB = (FloatingActionButton) view.findViewById(R.id.play_all_fab_local);
if (HomeActivity.recentlyAddedTrackList.size() == 0) {
playAllFAB.setVisibility(View.INVISIBLE);
}
playAllFAB.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
playAllFAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.recentlyAddedTrackList.size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.recentlyAddedTrackList.get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
HomeActivity.queueCurrentIndex = 0;
LocalTrack track = HomeActivity.recentlyAddedTrackList.get(0);
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onLocalTrackSelected(-1);
}
});
lv = (RecyclerView) view.findViewById(R.id.recentlyAddedLocalMusicList);
adapter = new LocalTrackRecyclerAdapter(HomeActivity.finalRecentlyAddedTrackSearchResultList, getContext());
mLayoutManager2 = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
lv.setLayoutManager(mLayoutManager2);
lv.setItemAnimator(new DefaultItemAnimator());
lv.setAdapter(adapter);
lv.addOnItemTouchListener(new ClickItemTouchListener(lv) {
@Override
public boolean onClick(RecyclerView parent, View view, int position, long id) {
if (position >= 0) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.recentlyAddedTrackList.size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.recentlyAddedTrackList.get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
HomeActivity.queueCurrentIndex = getPosition(HomeActivity.finalRecentlyAddedTrackSearchResultList.get(position));
LocalTrack track = HomeActivity.finalRecentlyAddedTrackSearchResultList.get(position);
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onLocalTrackSelected(-1);
}
return true;
}
@Override
public boolean onLongClick(RecyclerView parent, View view, final int position, long id) {
if (position >= 0) {
CustomLocalBottomSheetDialog localBottomSheetDialog = new CustomLocalBottomSheetDialog();
localBottomSheetDialog.setPosition(position);
localBottomSheetDialog.setLocalTrack(activity.finalRecentlyAddedTrackSearchResultList.get(position));
localBottomSheetDialog.show(activity.getSupportFragmentManager(), "local_song_bottom_sheet");
}
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
Button mEndButton = new Button(getContext());
mEndButton.setBackgroundColor(HomeActivity.themeColor);
mEndButton.setTextColor(Color.WHITE);
}
use of com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog in project MusicDNA by harjot-oberai.
the class ViewArtistFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
backBtn = (ImageView) view.findViewById(R.id.view_artist_back_btn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
backdrop = (ImageView) view.findViewById(R.id.artist_backdrop);
imgLoader.DisplayImage(HomeActivity.tempArtist.getArtistSongs().get(0).getPath(), backdrop);
fragTitle = (TextView) view.findViewById(R.id.artist_fragment_title);
if (SplashActivity.tf4 != null)
fragTitle.setTypeface(SplashActivity.tf4);
artistTitle = (TextView) view.findViewById(R.id.artist_title);
artistTitle.setText(HomeActivity.tempArtist.getName());
artistTrackText = (TextView) view.findViewById(R.id.artist_tracks_text);
int tmp = HomeActivity.tempArtist.getArtistSongs().size();
String details1;
if (tmp == 1) {
details1 = "1 Song ";
} else {
details1 = tmp + " Songs ";
}
artistTrackText.setText(details1);
addToQueueIcon = (ImageView) view.findViewById(R.id.add_artist_to_queue_icon);
addToQueueIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.addArtistToQueue();
}
});
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.getLayoutParams().height = 0;
else
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
rv = (RecyclerView) view.findViewById(R.id.artist_songs_recycler);
lAdapter = new LocalTrackRecyclerAdapter(HomeActivity.tempArtist.getArtistSongs(), getContext());
LinearLayoutManager llManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
rv.setLayoutManager(llManager);
rv.setItemAnimator(new DefaultItemAnimator());
rv.setAdapter(lAdapter);
rv.addOnItemTouchListener(new ClickItemTouchListener(rv) {
@Override
public boolean onClick(RecyclerView parent, View view, int position, long id) {
LocalTrack track = HomeActivity.tempArtist.getArtistSongs().get(position);
if (HomeActivity.queue.getQueue().size() == 0) {
HomeActivity.queueCurrentIndex = 0;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.queueCurrentIndex == HomeActivity.queue.getQueue().size() - 1) {
HomeActivity.queueCurrentIndex++;
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else if (HomeActivity.isReloaded) {
HomeActivity.isReloaded = false;
HomeActivity.queueCurrentIndex = HomeActivity.queue.getQueue().size();
HomeActivity.queue.getQueue().add(new UnifiedTrack(true, track, null));
} else {
HomeActivity.queue.getQueue().add(++HomeActivity.queueCurrentIndex, new UnifiedTrack(true, track, null));
}
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onArtistSongClick();
return true;
}
@Override
public boolean onLongClick(RecyclerView parent, View view, final int position, long id) {
CustomLocalBottomSheetDialog localBottomSheetDialog = new CustomLocalBottomSheetDialog();
localBottomSheetDialog.setPosition(position);
localBottomSheetDialog.setLocalTrack(activity.tempArtist.getArtistSongs().get(position));
localBottomSheetDialog.setFragment("Artist");
localBottomSheetDialog.show(activity.getSupportFragmentManager(), "local_song_bottom_sheet");
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
playAllfab = (FloatingActionButton) view.findViewById(R.id.play_all_fab_artist);
playAllfab.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
playAllfab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.tempArtist.getArtistSongs().size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.tempArtist.getArtistSongs().get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
mCallback.onArtistPlayAll();
}
});
}
use of com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog in project MusicDNA by harjot-oberai.
the class LocalMusicFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.getLayoutParams().height = 0;
else
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
shuffleFab = (FloatingActionButton) view.findViewById(R.id.play_all_fab_local);
if (HomeActivity.localTrackList.size() == 0) {
shuffleFab.setVisibility(View.INVISIBLE);
}
shuffleFab.setBackgroundTintList(ColorStateList.valueOf(HomeActivity.themeColor));
shuffleFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.localTrackList.size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.localTrackList.get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
if (HomeActivity.queue.getQueue().size() > 0) {
Random r = new Random();
int tmp = r.nextInt(HomeActivity.queue.getQueue().size());
HomeActivity.queueCurrentIndex = tmp;
LocalTrack track = HomeActivity.localTrackList.get(tmp);
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onLocalTrackSelected(-1);
}
}
});
lv = (RecyclerView) view.findViewById(R.id.localMusicList);
adapter = new LocalTrackRecyclerAdapter(HomeActivity.finalLocalSearchResultList, getContext());
mLayoutManager2 = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
lv.setLayoutManager(mLayoutManager2);
lv.setItemAnimator(new DefaultItemAnimator());
lv.setAdapter(adapter);
lv.addOnItemTouchListener(new ClickItemTouchListener(lv) {
@Override
public boolean onClick(RecyclerView parent, View view, int position, long id) {
if (position >= 0) {
HomeActivity.queue.getQueue().clear();
for (int i = 0; i < HomeActivity.localTrackList.size(); i++) {
UnifiedTrack ut = new UnifiedTrack(true, HomeActivity.localTrackList.get(i), null);
HomeActivity.queue.getQueue().add(ut);
}
HomeActivity.queueCurrentIndex = getPosition(HomeActivity.finalLocalSearchResultList.get(position));
LocalTrack track = HomeActivity.finalLocalSearchResultList.get(position);
HomeActivity.localSelectedTrack = track;
HomeActivity.streamSelected = false;
HomeActivity.localSelected = true;
HomeActivity.queueCall = false;
HomeActivity.isReloaded = false;
mCallback.onLocalTrackSelected(-1);
}
return true;
}
@Override
public boolean onLongClick(RecyclerView parent, View view, final int position, long id) {
if (position >= 0) {
CustomLocalBottomSheetDialog localBottomSheetDialog = new CustomLocalBottomSheetDialog();
localBottomSheetDialog.setPosition(position);
localBottomSheetDialog.setLocalTrack(activity.finalLocalSearchResultList.get(position));
localBottomSheetDialog.show(activity.getSupportFragmentManager(), "local_song_bottom_sheet");
}
return true;
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
Button mEndButton = new Button(getContext());
mEndButton.setBackgroundColor(HomeActivity.themeColor);
mEndButton.setTextColor(Color.WHITE);
showCase = new ShowcaseView.Builder(getActivity()).blockAllTouches().singleShot(1).setStyle(R.style.CustomShowcaseTheme).useDecorViewAsParent().replaceEndButton(mEndButton).setContentTitlePaint(HomeActivity.tp).setTarget(new ViewTarget(R.id.songs_tab_alt_showcase, getActivity())).setContentTitle("All Songs").setContentText("All local Songs listed here.Click to Play.Long click for more options").build();
showCase.setButtonText("Next");
showCase.setButtonPosition(HomeActivity.lps);
showCase.overrideButtonClick(new View.OnClickListener() {
int count1 = 0;
@Override
public void onClick(View v) {
count1++;
switch(count1) {
case 1:
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
int margin = ((Number) (getResources().getDisplayMetrics().density * 12)).intValue();
lps.setMargins(margin, margin, margin, 5 + HomeActivity.navBarHeightSizeinDp);
showCase.setTarget(new ViewTarget(shuffleFab.getId(), getActivity()));
showCase.setContentTitle("Shuffle");
showCase.setContentText("Play all songs, shuffled randomly");
showCase.setButtonText("Done");
showCase.setButtonPosition(lps);
break;
case 2:
showCase.hide();
break;
}
}
});
}
Aggregations