Android Open Source - kluster-android Abstract Content Storage Adapter






From Project

Back to project page kluster-android.

License

The source code is released under:

Apache License

If you think the Android project kluster-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cs446.kluster.data;
/* www  . j  av a2 s .c o  m*/
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

/**
 * Created by Marlin Gingerich on 2014-03-10.
 */
abstract class AbstractContentStorageAdapter<T> implements StorageAdapter<T> {

    ContentResolver mContentResolver;

    AbstractContentStorageAdapter(ContentResolver contentResolver) {
        this.mContentResolver = contentResolver;
    }

    @Override
    public Uri insert(T item) {
        ContentValues values = this.getContentValues(item);
        return this.mContentResolver.insert(this.getContentUri(), values);
    }

    @Override
    public Uri upsert(T item) {
        ContentValues values = this.getContentValues(item);
        //values.put(StorageConstants.INSERT_OR_UPDATE, true);
        return this.mContentResolver.insert(this.getContentUri(), values);
    }

    @Override
    public int update(T item, String where, String[] selectionArgs) {
        ContentValues values = this.getContentValues(item);
        return this.mContentResolver.update(this.getContentUri(), values, where, selectionArgs);
    }

    @Override
    public int delete(String where, String[] selectionArgs) {
        return this.mContentResolver.delete(this.getContentUri(), where, selectionArgs);
    }

    @Override
    public Cursor query(String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        return this.mContentResolver.query(this.getContentUri(), projection, selection, selectionArgs, sortOrder);
    }

    public abstract Uri getContentUri();

    public abstract ContentValues getContentValues(T item);

}




Java Source Code List

android.app.GridFragment.java
android.app.NonSwipeableViewPager.java
android.app.ScaleImageView.java
com.cs446.kluster.ConfigManager.java
com.cs446.kluster.KlusterApplication.java
com.cs446.kluster.cache.CacheUtils.java
com.cs446.kluster.cache.DiskLruCache.java
com.cs446.kluster.cache.DiskLruImageCache.java
com.cs446.kluster.cache.KlusterCache.java
com.cs446.kluster.data.AbstractContentStorageAdapter.java
com.cs446.kluster.data.EventProvider.java
com.cs446.kluster.data.EventStorageAdapter.java
com.cs446.kluster.data.PhotoProvider.java
com.cs446.kluster.data.PhotoStorageAdapter.java
com.cs446.kluster.data.SearchProvider.java
com.cs446.kluster.data.SearchStorageAdapter.java
com.cs446.kluster.data.StorageAdapter.java
com.cs446.kluster.data.StorageConstants.java
com.cs446.kluster.data.serialize.AuthUserAdapter.java
com.cs446.kluster.data.serialize.EventAdapter.java
com.cs446.kluster.data.serialize.PhotoAdapter.java
com.cs446.kluster.data.serialize.SerializerUtils.java
com.cs446.kluster.data.serialize.UserAdapter.java
com.cs446.kluster.map.MapUtils.java
com.cs446.kluster.models.AuthUser.java
com.cs446.kluster.models.Event.java
com.cs446.kluster.models.Photo.java
com.cs446.kluster.models.User.java
com.cs446.kluster.net.AuthInterceptor.java
com.cs446.kluster.net.AuthKlusterRestAdapter.java
com.cs446.kluster.net.EventsCallback.java
com.cs446.kluster.net.KlusterRestAdapter.java
com.cs446.kluster.net.KlusterService.java
com.cs446.kluster.net.NetworkUtils.java
com.cs446.kluster.net.PhotosCallback.java
com.cs446.kluster.net.UploadService.java
com.cs446.kluster.views.activities.LoginActivity.java
com.cs446.kluster.views.activities.MainActivity.java
com.cs446.kluster.views.activities.PhotoFactory.java
com.cs446.kluster.views.activities.PhotoGridActivity.java
com.cs446.kluster.views.fragments.DiscoverFragment.java
com.cs446.kluster.views.fragments.EventDialogFragment.java
com.cs446.kluster.views.fragments.EventGridAdapter.java
com.cs446.kluster.views.fragments.EventGridFragment.java
com.cs446.kluster.views.fragments.EventMapFragment.java
com.cs446.kluster.views.fragments.FilterDialogFragment.java
com.cs446.kluster.views.fragments.PhotoGridAdapter.java
com.cs446.kluster.views.fragments.PhotoGridFragment.java
com.cs446.kluster.views.fragments.PhotoViewerFragment.java
com.cs446.kluster.views.fragments.SearchFragment.java
com.cs446.kluster.views.fragments.SearchGridFragment.java
com.cs446.kluster.views.fragments.SearchMapFragment.java
com.cs446.kluster.views.fragments.SignupFragment.java
com.cs446.kluster.views.fragments.UserProfileFragment.java
com.cs446.kluster.views.map.PhotoInfoWindowAdapter.java