Search in sources :

Example 6 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Timber by naman14.

the class BaseNowplayingFragment method setSongDetails.

public void setSongDetails(View view) {
    albumart = (ImageView) view.findViewById(R.id.album_art);
    shuffle = (ImageView) view.findViewById(R.id.shuffle);
    repeat = (ImageView) view.findViewById(R.id.repeat);
    next = (MaterialIconView) view.findViewById(R.id.next);
    previous = (MaterialIconView) view.findViewById(R.id.previous);
    mPlayPause = (PlayPauseButton) view.findViewById(R.id.playpause);
    playPauseFloating = (FloatingActionButton) view.findViewById(R.id.playpausefloating);
    playPauseWrapper = view.findViewById(R.id.playpausewrapper);
    songtitle = (TextView) view.findViewById(R.id.song_title);
    songalbum = (TextView) view.findViewById(R.id.song_album);
    songartist = (TextView) view.findViewById(R.id.song_artist);
    songduration = (TextView) view.findViewById(R.id.song_duration);
    elapsedtime = (TextView) view.findViewById(R.id.song_elapsed_time);
    timelyView11 = (TimelyView) view.findViewById(R.id.timelyView11);
    timelyView12 = (TimelyView) view.findViewById(R.id.timelyView12);
    timelyView13 = (TimelyView) view.findViewById(R.id.timelyView13);
    timelyView14 = (TimelyView) view.findViewById(R.id.timelyView14);
    timelyView15 = (TimelyView) view.findViewById(R.id.timelyView15);
    hourColon = (TextView) view.findViewById(R.id.hour_colon);
    mProgress = (SeekBar) view.findViewById(R.id.song_progress);
    mCircularProgress = (CircularSeekBar) view.findViewById(R.id.song_progress_circular);
    recyclerView = (RecyclerView) view.findViewById(R.id.queue_recyclerview);
    songtitle.setSelected(true);
    Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    if (toolbar != null) {
        ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
        final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setTitle("");
    }
    if (mPlayPause != null && getActivity() != null) {
        mPlayPause.setColor(ContextCompat.getColor(getContext(), android.R.color.white));
    }
    if (playPauseFloating != null) {
        playPauseDrawable.setColorFilter(TimberUtils.getBlackWhiteColor(accentColor), PorterDuff.Mode.MULTIPLY);
        playPauseFloating.setImageDrawable(playPauseDrawable);
        if (MusicPlayer.isPlaying())
            playPauseDrawable.transformToPause(false);
        else
            playPauseDrawable.transformToPlay(false);
    }
    if (mCircularProgress != null) {
        mCircularProgress.setCircleProgressColor(accentColor);
        mCircularProgress.setPointerColor(accentColor);
        mCircularProgress.setPointerHaloColor(accentColor);
    }
    if (timelyView11 != null) {
        String time = TimberUtils.makeShortTimeString(getActivity(), MusicPlayer.position() / 1000);
        if (time.length() < 5) {
            timelyView11.setVisibility(View.GONE);
            timelyView12.setVisibility(View.GONE);
            hourColon.setVisibility(View.GONE);
            changeDigit(timelyView13, time.charAt(0) - '0');
            changeDigit(timelyView14, time.charAt(2) - '0');
            changeDigit(timelyView15, time.charAt(3) - '0');
        } else if (time.length() == 5) {
            timelyView12.setVisibility(View.VISIBLE);
            changeDigit(timelyView12, time.charAt(0) - '0');
            changeDigit(timelyView13, time.charAt(1) - '0');
            changeDigit(timelyView14, time.charAt(3) - '0');
            changeDigit(timelyView15, time.charAt(4) - '0');
        } else {
            timelyView11.setVisibility(View.VISIBLE);
            hourColon.setVisibility(View.VISIBLE);
            changeDigit(timelyView11, time.charAt(0) - '0');
            changeDigit(timelyView12, time.charAt(2) - '0');
            changeDigit(timelyView13, time.charAt(3) - '0');
            changeDigit(timelyView14, time.charAt(5) - '0');
            changeDigit(timelyView15, time.charAt(6) - '0');
        }
    }
    setSongDetails();
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 7 with Toolbar

use of androidx.appcompat.widget.Toolbar in project SmartTabLayout by ogaclejapan.

the class DemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    Demo demo = getDemo();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ViewGroup tab = (ViewGroup) findViewById(R.id.tab);
    tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false));
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
    demo.setup(viewPagerTab);
    FragmentPagerItems pages = new FragmentPagerItems(this);
    for (int titleResId : demo.tabs()) {
        pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class));
    }
    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), pages);
    viewPager.setAdapter(adapter);
    viewPagerTab.setViewPager(viewPager);
}
Also used : FragmentPagerItems(com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems) ViewGroup(android.view.ViewGroup) ViewPager(androidx.viewpager.widget.ViewPager) FragmentPagerItemAdapter(com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter) Toolbar(androidx.appcompat.widget.Toolbar) SmartTabLayout(com.ogaclejapan.smarttablayout.SmartTabLayout)

Example 8 with Toolbar

use of androidx.appcompat.widget.Toolbar in project SmartTabLayout by ogaclejapan.

the class DemoLikeMediumActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_like_a_medium);
    Demo demo = getDemo();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ViewGroup tab = (ViewGroup) findViewById(R.id.tab);
    tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false));
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
    demo.setup(viewPagerTab);
    FragmentPagerItems pages = new FragmentPagerItems(this);
    for (int titleResId : demo.tabs()) {
        pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class));
    }
    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), pages);
    viewPager.setAdapter(adapter);
    viewPagerTab.setViewPager(viewPager);
}
Also used : FragmentPagerItems(com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems) ViewGroup(android.view.ViewGroup) ViewPager(androidx.viewpager.widget.ViewPager) FragmentPagerItemAdapter(com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter) Toolbar(androidx.appcompat.widget.Toolbar) SmartTabLayout(com.ogaclejapan.smarttablayout.SmartTabLayout)

Example 9 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Timber by naman14.

the class MainFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, 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);
    viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
        viewPager.setOffscreenPageLimit(2);
    }
    TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    return rootView;
}
Also used : TabLayout(com.google.android.material.tabs.TabLayout) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) View(android.view.View) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 10 with Toolbar

use of androidx.appcompat.widget.Toolbar in project Timber by naman14.

the class PlaylistDetailActivity method onCreate.

@TargetApi(21)
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_playlist_detail);
    action = getIntent().getAction();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");
    playlistsMap.put(Constants.NAVIGATE_PLAYLIST_LASTADDED, playlistLastAdded);
    playlistsMap.put(Constants.NAVIGATE_PLAYLIST_RECENT, playlistRecents);
    playlistsMap.put(Constants.NAVIGATE_PLAYLIST_TOPTRACKS, playlistToptracks);
    playlistsMap.put(Constants.NAVIGATE_PLAYLIST_USERCREATED, playlistUsercreated);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    blurFrame = (ImageView) findViewById(R.id.blurFrame);
    playlistname = (TextView) findViewById(R.id.name);
    foreground = findViewById(R.id.foreground);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    setAlbumart();
    animate = getIntent().getBooleanExtra(Constants.ACTIVITY_TRANSITION, false);
    if (animate && TimberUtils.isLollipop()) {
        if (savedInstanceState != null && savedInstanceState.containsKey("ROTATION_RECREATION")) {
            setUpSongs();
        } else {
            getWindow().getEnterTransition().addListener(new EnterTransitionListener());
        }
    } else {
        setUpSongs();
    }
}
Also used : LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Toolbar(androidx.appcompat.widget.Toolbar) TargetApi(android.annotation.TargetApi)

Aggregations

Toolbar (androidx.appcompat.widget.Toolbar)271 View (android.view.View)110 TextView (android.widget.TextView)55 RecyclerView (androidx.recyclerview.widget.RecyclerView)44 Bundle (android.os.Bundle)42 NonNull (androidx.annotation.NonNull)36 Intent (android.content.Intent)34 Fragment (androidx.fragment.app.Fragment)32 ActionBar (androidx.appcompat.app.ActionBar)29 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)29 Nullable (androidx.annotation.Nullable)28 BarPainter (com.xabber.android.ui.color.BarPainter)26 R (org.thoughtcrime.securesms.R)26 ViewGroup (android.view.ViewGroup)25 Context (android.content.Context)24 EditText (android.widget.EditText)22 MenuItem (android.view.MenuItem)21 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)20 Navigation (androidx.navigation.Navigation)20 Drawable (android.graphics.drawable.Drawable)18