Search in sources :

Example 1 with DetailAdapter

use of com.simplecity.amp_library.ui.adapters.DetailAdapter in project Shuttle by timusus.

the class DetailFragment method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setHasOptionsMenu(true);
    setEnterSharedElementCallback(enterSharedElementCallback);
    prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
    Serializable object = getArguments().getSerializable(ARG_MODEL);
    if (object instanceof AlbumArtist) {
        albumArtist = (AlbumArtist) object;
    } else if (object instanceof Album) {
        album = (Album) object;
    } else if (object instanceof Genre) {
        genre = (Genre) object;
    } else if (object instanceof Playlist) {
        playlist = (Playlist) object;
    }
    if (adapter == null) {
        adapter = new DetailAdapter();
        adapter.setListener(this);
    }
    receiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction() != null && intent.getAction().equals("restartLoader")) {
                refreshAdapterItems();
            }
        }
    };
    sharedPreferenceChangeListener = (sharedPreferences, key) -> {
        if (key.equals("pref_theme_highlight_color") || key.equals("pref_theme_accent_color") || key.equals("pref_theme_white_accent")) {
            themeUIComponents();
        } else if (key.equals("songWhitelist")) {
            refreshAdapterItems();
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
    if (requestManager == null) {
        requestManager = Glide.with(this);
    }
    if (headerItem == null) {
        headerItem = new HeaderView();
    }
    if (horizontalRecyclerView == null) {
        horizontalRecyclerView = new HorizontalRecyclerView();
        horizontalRecyclerView.setListener(this);
    }
}
Also used : DetailAdapter(com.simplecity.amp_library.ui.adapters.DetailAdapter) Context(android.content.Context) Serializable(java.io.Serializable) Playlist(com.simplecity.amp_library.model.Playlist) Album(com.simplecity.amp_library.model.Album) Intent(android.content.Intent) Genre(com.simplecity.amp_library.model.Genre) BroadcastReceiver(android.content.BroadcastReceiver) AlbumArtist(com.simplecity.amp_library.model.AlbumArtist) HorizontalRecyclerView(com.simplecity.amp_library.ui.modelviews.HorizontalRecyclerView)

Aggregations

BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Album (com.simplecity.amp_library.model.Album)1 AlbumArtist (com.simplecity.amp_library.model.AlbumArtist)1 Genre (com.simplecity.amp_library.model.Genre)1 Playlist (com.simplecity.amp_library.model.Playlist)1 DetailAdapter (com.simplecity.amp_library.ui.adapters.DetailAdapter)1 HorizontalRecyclerView (com.simplecity.amp_library.ui.modelviews.HorizontalRecyclerView)1 Serializable (java.io.Serializable)1