Java Code Examples for android.support.v7.app.AppCompatActivity#getApplicationContext()

The following examples show how to use android.support.v7.app.AppCompatActivity#getApplicationContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SectionedOmniAdapter.java    From Pasta-Music with Apache License 2.0 6 votes vote down vote up
public SectionedOmniAdapter(AppCompatActivity activity, ArrayList list) {
    tracks = new ArrayList<>();
    albums = new ArrayList<>();
    playlists = new ArrayList<>();
    artists = new ArrayList<>();

    this.activity = activity;
    pasta = (Pasta) activity.getApplicationContext();

    thumbnails = PreferenceUtils.isThumbnails(activity);
    cards = PreferenceUtils.isCards(activity);
    palette = PreferenceUtils.isPalette(activity);
    dark = PreferenceUtils.isDarkTheme(activity);

    if (list == null) {
        this.list = new ArrayList();
        return;
    }
    this.list = list;
    for (Object o : list) {
        if (o instanceof TrackListData) tracks.add((TrackListData) o);
        else if (o instanceof AlbumListData) albums.add((AlbumListData) o);
        else if (o instanceof PlaylistListData) playlists.add((PlaylistListData) o);
        else if (o instanceof ArtistListData) artists.add((ArtistListData) o);
    }
}
 
Example 2
Source File: OmniAdapter.java    From Pasta-Music with Apache License 2.0 6 votes vote down vote up
public OmniAdapter(AppCompatActivity activity, List list, boolean isFavoriteBehavior) {
    original = list;
    if (list != null) {
        this.list = new ArrayList();
        try {
            this.list.addAll(original);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    this.activity = activity;
    pasta = (Pasta) activity.getApplicationContext();

    thumbnails = PreferenceUtils.isThumbnails(activity);
    cards = PreferenceUtils.isCards(activity);
    trackList = PreferenceUtils.isListTracks(activity);
    palette = PreferenceUtils.isPalette(activity);
    dark = PreferenceUtils.isDarkTheme(activity);

    this.isFavoriteBehavior = isFavoriteBehavior;
}
 
Example 3
Source File: TrackAdapter.java    From Pasta-Music with Apache License 2.0 6 votes vote down vote up
public TrackAdapter(AppCompatActivity activity, List<TrackListData> list) {
    original = list;
    if (list != null) {
        this.list = new ArrayList<>();
        try {
            this.list.addAll(original);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    this.activity = activity;
    pasta = (Pasta) activity.getApplicationContext();

    thumbnails = PreferenceUtils.isThumbnails(activity);
    cards = PreferenceUtils.isCards(activity);
    trackList = PreferenceUtils.isListTracks(activity);
    palette = PreferenceUtils.isPalette(activity);
    dark = PreferenceUtils.isDarkTheme(activity);
}
 
Example 4
Source File: SectionedOmniAdapter.java    From Pasta-for-Spotify with Apache License 2.0 6 votes vote down vote up
public SectionedOmniAdapter(AppCompatActivity activity, ArrayList list) {
    tracks = new ArrayList<>();
    albums = new ArrayList<>();
    playlists = new ArrayList<>();
    artists = new ArrayList<>();

    this.activity = activity;
    pasta = (Pasta) activity.getApplicationContext();

    isThumbnails = PreferenceUtils.isThumbnails(activity);


    if (list == null) {
        this.list = new ArrayList();
        return;
    }
    this.list = list;
    for (Object o : list) {
        if (o instanceof TrackListData) tracks.add((TrackListData) o);
        else if (o instanceof AlbumListData) albums.add((AlbumListData) o);
        else if (o instanceof PlaylistListData) playlists.add((PlaylistListData) o);
        else if (o instanceof ArtistListData) artists.add((ArtistListData) o);
    }
}
 
Example 5
Source File: EntityHeaderController.java    From MiPushFramework with GNU General Public License v3.0 4 votes vote down vote up
private EntityHeaderController(AppCompatActivity activity, Fragment fragment, View header) {
    mAppContext = activity.getApplicationContext();
    mFragment = fragment;
    if (header != null) {
        mHeader = header;
    } else {
        mHeader = LayoutInflater.from(fragment.getContext())
                .inflate(R.layout.settings_entity_header, null /* root */);
    }
}