Search in sources :

Example 41 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class HomeActivity method addArtistToQueue.

@Override
public void addArtistToQueue() {
    List<LocalTrack> list = tempArtist.getArtistSongs();
    for (LocalTrack lt : list) {
        HomeActivity.queue.addToQueue(new UnifiedTrack(true, lt, null));
    }
    if (playerFragment != null && playerFragment.snappyRecyclerView != null) {
        playerFragment.snappyRecyclerView.getAdapter().notifyDataSetChanged();
        playerFragment.snappyRecyclerView.setTransparency();
    }
    Toast.makeText(ctx, "Added " + list.size() + " song(s) to queue", Toast.LENGTH_SHORT).show();
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack)

Example 42 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class HomeActivity method onQueueItemClicked.

// //////////////////////////////////////////////////////////////////////////////////////////////
/*
     *  QueueFragment callbacks START
     *  onQueueItemClicked() -> when a song is selected from queue.
     *  onQueueSave() -> queue save as playlist fab is clicked.
     *  onQueueClear() -> when queue clear option is selected.
     */
@Override
public void onQueueItemClicked(final int position) {
    if (isPlayerVisible && isQueueVisible)
        showPlayer3();
    final Handler handler = new Handler();
    handler.postDelayed(new Runnable() {

        @Override
        public void run() {
            queueCurrentIndex = position;
            UnifiedTrack ut = queue.getQueue().get(position);
            if (ut.getType()) {
                LocalTrack track = ut.getLocalTrack();
                localSelectedTrack = track;
                streamSelected = false;
                localSelected = true;
                queueCall = false;
                isReloaded = false;
                onLocalTrackSelected(position);
            } else {
                Track track = ut.getStreamTrack();
                selectedTrack = track;
                streamSelected = true;
                localSelected = false;
                queueCall = false;
                isReloaded = false;
                onTrackSelected(position);
            }
        }
    }, 500);
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) Handler(android.os.Handler) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) LocalTrack(com.sdsmdg.harjot.MusicDNA.models.LocalTrack) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) Track(com.sdsmdg.harjot.MusicDNA.models.Track)

Example 43 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class HomeActivity method onShuffleEnabled.

@Override
public void onShuffleEnabled() {
    originalQueue = new Queue();
    for (UnifiedTrack ut : queue.getQueue()) {
        originalQueue.addToQueue(ut);
    }
    originalQueueIndex = queueCurrentIndex;
    UnifiedTrack ut = queue.getQueue().get(queueCurrentIndex);
    Collections.shuffle(queue.getQueue());
    for (int i = 0; i < queue.getQueue().size(); i++) {
        if (ut.equals(queue.getQueue().get(i))) {
            queue.getQueue().remove(i);
            break;
        }
    }
    queue.getQueue().add(0, ut);
    queueCurrentIndex = 0;
    new SaveQueue().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) Queue(com.sdsmdg.harjot.MusicDNA.models.Queue) TextPaint(android.text.TextPaint)

Example 44 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class HomeActivity method newPlaylistNameDialog.

public void newPlaylistNameDialog() {
    final Dialog dialog = new Dialog(ctx);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.save_image_dialog);
    TextView titleText = (TextView) dialog.findViewById(R.id.dialog_title);
    titleText.setText("Playlist Name");
    if (SplashActivity.tf4 != null)
        titleText.setTypeface(SplashActivity.tf4);
    Button btn = (Button) dialog.findViewById(R.id.save_image_btn);
    final EditText newName = (EditText) dialog.findViewById(R.id.save_image_filename_text);
    CheckBox cb = (CheckBox) dialog.findViewById(R.id.text_checkbox);
    cb.setVisibility(GONE);
    btn.setBackgroundColor(themeColor);
    btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            boolean isNameRepeat = false;
            if (newName.getText().toString().trim().equals("")) {
                newName.setError("Enter Playlist Name!");
            } else {
                for (int i = 0; i < allPlaylists.getPlaylists().size(); i++) {
                    if (newName.getText().toString().equals(allPlaylists.getPlaylists().get(i).getPlaylistName())) {
                        isNameRepeat = true;
                        newName.setError("Playlist with same name exists!");
                        break;
                    }
                }
                if (!isNameRepeat) {
                    UnifiedTrack ut;
                    Playlist pl = new Playlist(newName.getText().toString());
                    for (int i = 0; i < finalSelectedTracks.size(); i++) {
                        ut = new UnifiedTrack(true, finalSelectedTracks.get(i), null);
                        pl.getSongList().add(ut);
                    }
                    allPlaylists.addPlaylist(pl);
                    finalSelectedTracks.clear();
                    if (pAdapter != null) {
                        pAdapter.notifyDataSetChanged();
                        if (allPlaylists.getPlaylists().size() > 0) {
                            playlistsRecycler.setVisibility(View.VISIBLE);
                            playlistNothingText.setVisibility(View.INVISIBLE);
                        }
                    }
                    AllPlaylistsFragment plFrag = (AllPlaylistsFragment) fragMan.findFragmentByTag("allPlaylists");
                    if (plFrag != null) {
                        plFrag.dataChanged();
                    }
                    new SavePlaylists().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    dialog.dismiss();
                    onBackPressed();
                }
            }
        }
    });
    dialog.show();
}
Also used : EditText(android.widget.EditText) Playlist(com.sdsmdg.harjot.MusicDNA.models.Playlist) Button(android.widget.Button) Dialog(android.app.Dialog) CustomLocalBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog) CustomGeneralBottomSheetDialog(com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomGeneralBottomSheetDialog) CheckBox(android.widget.CheckBox) UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) TextView(android.widget.TextView) AllPlaylistsFragment(com.sdsmdg.harjot.MusicDNA.fragments.AllPlaylistsFragment.AllPlaylistsFragment) ImageView(android.widget.ImageView) VisualizerView(com.sdsmdg.harjot.MusicDNA.visualizers.VisualizerView) RecyclerView(android.support.v7.widget.RecyclerView) NavigationView(android.support.design.widget.NavigationView) SearchView(android.support.v7.widget.SearchView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) WheelView(com.lantouzi.wheelview.WheelView) ListView(android.widget.ListView)

Example 45 with UnifiedTrack

use of com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack in project MusicDNA by harjot-oberai.

the class HomeActivity method onFolderContentPlayAll.

// //////////////////////////////////////////////////////////////////////////////////////////////
/*
     * FolderContentFragment callbacks START
     */
@Override
public void onFolderContentPlayAll() {
    queue.getQueue().clear();
    for (int i = 0; i < tempFolderContent.size(); i++) {
        queue.getQueue().add(new UnifiedTrack(true, tempFolderContent.get(i), null));
    }
    queueCurrentIndex = 0;
    onPlaylistMenuPLayAll();
}
Also used : UnifiedTrack(com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack) TextPaint(android.text.TextPaint)

Aggregations

UnifiedTrack (com.sdsmdg.harjot.MusicDNA.models.UnifiedTrack)51 LocalTrack (com.sdsmdg.harjot.MusicDNA.models.LocalTrack)25 RecyclerView (android.support.v7.widget.RecyclerView)17 View (android.view.View)17 Track (com.sdsmdg.harjot.MusicDNA.models.Track)16 ImageView (android.widget.ImageView)14 TextView (android.widget.TextView)14 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)11 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 ClickItemTouchListener (com.sdsmdg.harjot.MusicDNA.clickitemtouchlistener.ClickItemTouchListener)11 TextPaint (android.text.TextPaint)9 Playlist (com.sdsmdg.harjot.MusicDNA.models.Playlist)8 CustomLocalBottomSheetDialog (com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomLocalBottomSheetDialog)7 ShowcaseView (com.github.amlcurran.showcaseview.ShowcaseView)6 HomeActivity (com.sdsmdg.harjot.MusicDNA.activities.HomeActivity)6 CustomGeneralBottomSheetDialog (com.sdsmdg.harjot.MusicDNA.custombottomsheets.CustomGeneralBottomSheetDialog)6 Button (android.widget.Button)5 VisualizerView (com.sdsmdg.harjot.MusicDNA.visualizers.VisualizerView)4 Dialog (android.app.Dialog)3 Handler (android.os.Handler)3