Search in sources :

Example 56 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity 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 = 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 = rootView.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(null);
    recyclerView.setEmptyView(getActivity(), rootView.findViewById(R.id.list_empty), "No songs in queue");
    new loadQueueSongs().execute("");
    ((BaseActivity) getActivity()).setMusicStateListenerListener(this);
    return rootView;
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) BaseActivity(com.naman14.timber.activities.BaseActivity) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) BaseRecyclerView(com.naman14.timber.widgets.BaseRecyclerView) ActionBar(androidx.appcompat.app.ActionBar) Toolbar(androidx.appcompat.widget.Toolbar)

Example 57 with AppCompatActivity

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

the class AlbumDetailFragment method setupToolbar.

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

Example 58 with AppCompatActivity

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

the class NavigationUtils method navigateToAlbum.

@TargetApi(21)
public static void navigateToAlbum(Activity context, long albumID, 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 = AlbumDetailFragment.newInstance(albumID, 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 59 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project OneSignal-Android-SDK by OneSignal.

the class OSSystemConditionController method isDialogFragmentShowing.

boolean isDialogFragmentShowing(Context context) throws NoClassDefFoundError {
    // Detect if user has a dialog fragment showing
    if (context instanceof AppCompatActivity) {
        final FragmentManager manager = ((AppCompatActivity) context).getSupportFragmentManager();
        manager.registerFragmentLifecycleCallbacks(new FragmentManager.FragmentLifecycleCallbacks() {

            @Override
            public void onFragmentDetached(@NonNull FragmentManager fm, @NonNull Fragment fragmentDetached) {
                super.onFragmentDetached(fm, fragmentDetached);
                if (fragmentDetached instanceof DialogFragment) {
                    manager.unregisterFragmentLifecycleCallbacks(this);
                    systemConditionObserver.systemConditionChanged();
                }
            }
        }, true);
        List<Fragment> fragments = manager.getFragments();
        int size = fragments.size();
        if (size > 0) {
            // We only care of the last fragment available
            Fragment fragment = fragments.get(size - 1);
            return fragment.isVisible() && fragment instanceof DialogFragment;
        }
    }
    // We cannot detect AlertDialogs because they are added to the decor view as linear layout without an identification
    return false;
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) DialogFragment(androidx.fragment.app.DialogFragment) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 60 with AppCompatActivity

use of androidx.appcompat.app.AppCompatActivity in project Signal-Android by signalapp.

the class MediaOverviewPageFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    voiceNoteMediaController = new VoiceNoteMediaController((AppCompatActivity) requireActivity());
}
Also used : VoiceNoteMediaController(org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController) AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Aggregations

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