Search in sources :

Example 6 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Timber by naman14.

the class Timber5 method setupSlidingQueue.

private void setupSlidingQueue() {
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
    adapter = new SlidingQueueAdapter((AppCompatActivity) getActivity(), QueueLoader.getQueueSongs(getActivity()));
    recyclerView.setAdapter(adapter);
    recyclerView.scrollToPosition(MusicPlayer.getQueuePosition() - 3);
}
Also used : SlidingQueueAdapter(com.naman14.timber.adapters.SlidingQueueAdapter) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 7 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Timber by naman14.

the class ArtistDetailFragment method setupToolbar.

private void setupToolbar() {
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayHomeAsUpEnabled(true);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ActionBar(androidx.appcompat.app.ActionBar)

Example 8 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity 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 9 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Timber by naman14.

the class NavigationUtils method navigateToArtist.

@TargetApi(21)
public static void navigateToArtist(Activity context, long artistID, Pair<View, String> transitionViews) {
    FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction();
    Fragment fragment;
    transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out);
    fragment = ArtistDetailFragment.newInstance(artistID, false, null);
    transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container));
    transaction.add(R.id.fragment_container, fragment);
    transaction.addToBackStack(null).commit();
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ArtistDetailFragment(com.naman14.timber.fragments.ArtistDetailFragment) Fragment(androidx.fragment.app.Fragment) AlbumDetailFragment(com.naman14.timber.fragments.AlbumDetailFragment) TargetApi(android.annotation.TargetApi)

Example 10 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project ETSMobile-Android2 by ApplETS.

the class BandwidthFragment method updateProgressBarColorItems.

private void updateProgressBarColorItems(double bandwidthQuota) {
    final int[] colorChoice = new int[] { R.color.red_bandwith, R.color.blue_bandwith, R.color.green_bandwith, R.color.purple_bandwith };
    int[] legendColors = new int[values.length];
    final AppCompatActivity activity = (AppCompatActivity) getActivity();
    progressBar.clearProgressItems();
    bandwidthQuota = bandwidthQuota / 1024;
    for (int i = 0, color = 0; i < values.length - 1; ++i) {
        ProgressItem progressItem = new ProgressItem(colorChoice[color], (values[i] / bandwidthQuota) * 100);
        progressBar.addProgressItem(progressItem);
        legendColors[i] = colorChoice[color];
        color++;
        if (color == colorChoice.length)
            color = 0;
    }
    if (values.length > 0) {
        int lastValue = values.length - 1;
        ProgressItem progressItem = new ProgressItem(R.color.grey_bandwith, (values[lastValue] / bandwidthQuota) * 100);
        legendColors[lastValue] = R.color.grey_bandwith;
        progressBar.addProgressItem(progressItem);
    }
/*if (activity != null) {
            final int[] colors = legendColors;

            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    grid.setAdapter(new LegendAdapter(activity, rooms, colors));
                }
            });
        }*/
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ProgressItem(ca.etsmtl.applets.etsmobile.views.ProgressItem)

Aggregations

AppCompatActivity (androidx.appcompat.app.AppCompatActivity)76 ActionBar (androidx.appcompat.app.ActionBar)23 View (android.view.View)20 Toolbar (androidx.appcompat.widget.Toolbar)19 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)10 TextView (android.widget.TextView)7 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 Intent (android.content.Intent)6 Fragment (androidx.fragment.app.Fragment)6 BindView (butterknife.BindView)6 Activity (android.app.Activity)5 LayoutInflater (android.view.LayoutInflater)5 Bundle (android.os.Bundle)4 ImageView (android.widget.ImageView)4 ScrollView (android.widget.ScrollView)4 List (java.util.List)4 Nullable (androidx.annotation.Nullable)3 SuppressLint (android.annotation.SuppressLint)2 TargetApi (android.annotation.TargetApi)2 Dialog (android.app.Dialog)2