Search in sources :

Example 1 with AlbumAdapter

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

the class AlbumFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);
    albumAdapter = new AlbumAdapter();
    albumAdapter.setListener(this);
    prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
    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("albumWhitelist")) {
            refreshAdapterItems();
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
    if (requestManager == null) {
        requestManager = Glide.with(this);
    }
}
Also used : Context(android.content.Context) Intent(android.content.Intent) BroadcastReceiver(android.content.BroadcastReceiver) AlbumAdapter(com.simplecity.amp_library.ui.adapters.AlbumAdapter)

Aggregations

BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 AlbumAdapter (com.simplecity.amp_library.ui.adapters.AlbumAdapter)1