Search in sources :

Example 1 with BaseActivity

use of com.naman14.timber.activities.BaseActivity in project Timber by naman14.

the class QuickControlsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_playback_controls, container, false);
    this.rootView = rootView;
    mPlayPause = (PlayPauseButton) rootView.findViewById(R.id.play_pause);
    mPlayPauseExpanded = (PlayPauseButton) rootView.findViewById(R.id.playpause);
    playPauseWrapper = rootView.findViewById(R.id.play_pause_wrapper);
    playPauseWrapperExpanded = rootView.findViewById(R.id.playpausewrapper);
    playPauseWrapper.setOnClickListener(mPlayPauseListener);
    playPauseWrapperExpanded.setOnClickListener(mPlayPauseExpandedListener);
    mProgress = (ProgressBar) rootView.findViewById(R.id.song_progress_normal);
    mSeekBar = (SeekBar) rootView.findViewById(R.id.song_progress);
    mTitle = (TextView) rootView.findViewById(R.id.title);
    mArtist = (TextView) rootView.findViewById(R.id.artist);
    mTitleExpanded = (TextView) rootView.findViewById(R.id.song_title);
    mArtistExpanded = (TextView) rootView.findViewById(R.id.song_artist);
    mAlbumArt = (ImageView) rootView.findViewById(R.id.album_art_nowplayingcard);
    mBlurredArt = (ImageView) rootView.findViewById(R.id.blurredAlbumart);
    next = (MaterialIconView) rootView.findViewById(R.id.next);
    previous = (MaterialIconView) rootView.findViewById(R.id.previous);
    topContainer = rootView.findViewById(R.id.topContainer);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) mProgress.getLayoutParams();
    mProgress.measure(0, 0);
    layoutParams.setMargins(0, -(mProgress.getMeasuredHeight() / 2), 0, 0);
    mProgress.setLayoutParams(layoutParams);
    mPlayPause.setColor(Config.accentColor(getActivity(), Helpers.getATEKey(getActivity())));
    mPlayPauseExpanded.setColor(Color.WHITE);
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            if (b) {
                MusicPlayer.seek((long) i);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    next.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    MusicPlayer.next();
                }
            }, 200);
        }
    });
    previous.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    MusicPlayer.previous(getActivity(), false);
                }
            }, 200);
        }
    });
    ((BaseActivity) getActivity()).setMusicStateListenerListener(this);
    if (PreferencesUtility.getInstance(getActivity()).isGesturesEnabled()) {
        new SlideTrackSwitcher() {

            @Override
            public void onClick() {
                NavigationUtils.navigateToNowplaying(getActivity(), false);
            }
        }.attach(rootView.findViewById(R.id.root_view));
    }
    return rootView;
}
Also used : SeekBar(android.widget.SeekBar) Handler(android.os.Handler) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) BaseActivity(com.naman14.timber.activities.BaseActivity) SlideTrackSwitcher(com.naman14.timber.utils.SlideTrackSwitcher) LinearLayout(android.widget.LinearLayout)

Example 2 with BaseActivity

use of com.naman14.timber.activities.BaseActivity in project Timber by naman14.

the class QueueFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_queue, container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.playing_queue);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(null);
    new loadQueueSongs().execute("");
    ((BaseActivity) getActivity()).setMusicStateListenerListener(this);
    return rootView;
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) BaseActivity(com.naman14.timber.activities.BaseActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with BaseActivity

use of com.naman14.timber.activities.BaseActivity in project Timber by naman14.

the class SongsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_recyclerview, container, false);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    fastScroller.setRecyclerView(recyclerView);
    new loadSongs().execute("");
    ((BaseActivity) getActivity()).setMusicStateListenerListener(this);
    return rootView;
}
Also used : BaseActivity(com.naman14.timber.activities.BaseActivity) FastScroller(com.naman14.timber.widgets.FastScroller) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

View (android.view.View)3 BaseActivity (com.naman14.timber.activities.BaseActivity)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Handler (android.os.Handler)1 ActionBar (android.support.v7.app.ActionBar)1 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 Toolbar (android.support.v7.widget.Toolbar)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 SeekBar (android.widget.SeekBar)1 TextView (android.widget.TextView)1 SlideTrackSwitcher (com.naman14.timber.utils.SlideTrackSwitcher)1 FastScroller (com.naman14.timber.widgets.FastScroller)1 MaterialIconView (net.steamcrafted.materialiconlib.MaterialIconView)1