Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implement Timeline db and provider

  • Loading branch information...
commit a95a94e4996363b7f7a4cfbeb2745762113f23e2 1 parent a707279
@bradarmstrong bradarmstrong authored
View
10 AndroidManifest.xml
@@ -14,7 +14,7 @@
android:label="@string/app_name"
android:theme="@style/RESTfulAndroidTheme" >
<activity
- android:name="com.jeremyhaberman.restfulandroid.activity.LoginActivity"
+ android:name=".activity.LoginActivity"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -33,14 +33,18 @@
</data>
</intent-filter>
</activity>
- <activity android:name="com.jeremyhaberman.restfulandroid.activity.TimelineActivity" />
+ <activity android:name=".activity.TimelineActivity" />
<activity android:name=".activity.AboutActivity" />
<service android:name=".service.TwitterService" />
<provider
android:name=".provider.ProfileProvider"
- android:authorities="com.jeremyhaberman.restfulandroid.profiles" />
+ android:authorities="mn.aug.restfulandroid.profiles" />
+
+ <provider
+ android:name=".provider.TimelineProvider"
+ android:authorities="mn.aug.restfulandroid.timelineprovider" />
</application>
</manifest>
View
2  src/mn/aug/restfulandroid/provider/ProfileConstants.java
@@ -8,7 +8,7 @@
public static final String TIMELINE_TABLE_NAME = "timeline";
- public static final String AUTHORITY = "com.jeremyhaberman.restfulandroid.profiles";
+ public static final String AUTHORITY = "mn.aug.restfulandroid.profiles";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE_NAME);
View
37 src/mn/aug/restfulandroid/provider/ProfileData.java
@@ -1,37 +0,0 @@
-package mn.aug.restfulandroid.provider;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-import static android.provider.BaseColumns._ID;
-import static mn.aug.restfulandroid.provider.ProfileConstants.NAME;
-import static mn.aug.restfulandroid.provider.ProfileConstants.TABLE_NAME;
-
-class ProfileData extends SQLiteOpenHelper {
- private static final String DATABASE_NAME = "profiles.db";
- private static final int DATABASE_VERSION = 1;
-
- /**
- * Create a helper object for the Profile database
- */
- ProfileData(Context ctx) {
- super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
- }
-
- @Override
- public void onCreate(SQLiteDatabase db) {
- db.execSQL("CREATE TABLE " + TABLE_NAME + " ("
- + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
- + NAME + " TEXT);");
- }
-
- @Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion,
- int newVersion) {
- db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
- onCreate(db);
- }
-
-}
-
View
10 src/mn/aug/restfulandroid/provider/ProfileProvider.java
@@ -33,7 +33,7 @@
*/
private static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.example.profile";
- private ProfileData profiles;
+ private ProviderDbHelper dbHelper;
private UriMatcher uriMatcher;
@Override
@@ -41,7 +41,7 @@ public boolean onCreate() {
uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
uriMatcher.addURI(AUTHORITY, "profiles", PROFILES);
uriMatcher.addURI(AUTHORITY, "profiles/#", PROFILE_ID);
- profiles = new ProfileData(getContext());
+ this.dbHelper = new ProviderDbHelper(this.getContext());
return true;
}
@@ -54,7 +54,7 @@ public Cursor query(Uri uri, String[] projection, String selection,
}
// Get the database and run the query
- SQLiteDatabase db = profiles.getReadableDatabase();
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, projection, selection,
selectionArgs, null, null, orderBy);
@@ -78,7 +78,7 @@ public String getType(Uri uri) {
@Override
public Uri insert(Uri uri, ContentValues values) {
- SQLiteDatabase db = profiles.getWritableDatabase();
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
// Validate the requested uri
if (uriMatcher.match(uri) != PROFILES) {
@@ -107,7 +107,7 @@ public int delete(Uri uri, String selection, String[] selectionArgs) {
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
- SQLiteDatabase db = profiles.getWritableDatabase();
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
// Validate the requested uri
if (uriMatcher.match(uri) != PROFILE_ID) {
View
63 src/mn/aug/restfulandroid/provider/ProviderDbHelper.java
@@ -0,0 +1,63 @@
+package mn.aug.restfulandroid.provider;
+
+import static android.provider.BaseColumns._ID;
+import static mn.aug.restfulandroid.provider.ProfileConstants.NAME;
+import static mn.aug.restfulandroid.provider.ProfileConstants.TABLE_NAME;
+import mn.aug.restfulandroid.provider.TimelineProviderContract.TimelineTable;
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * This creates, updates, and opens the database. Opening is handled by the superclass, we handle
+ * the create & upgrade steps
+ */
+public class ProviderDbHelper extends SQLiteOpenHelper {
+
+ public final String TAG = getClass().getSimpleName();
+
+ //Name of the database file
+ private static final String DATABASE_NAME = "restdroid.db";
+ private static final int DATABASE_VERSION = 1;
+
+ public ProviderDbHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+
+ // CREATE TIMELINE TABLE
+ StringBuilder sqlBuilder = new StringBuilder();
+ sqlBuilder.append("CREATE TABLE " + TimelineTable.TABLE_NAME + " (");
+ sqlBuilder.append(TimelineTable._ID + " INTEGER, ");
+ sqlBuilder.append(TimelineTable._STATUS + " TEXT, ");
+ sqlBuilder.append(TimelineTable._RESULT + " INTEGER, ");
+ sqlBuilder.append(TimelineTable.AUTHOR + " TEXT, ");
+ sqlBuilder.append(TimelineTable.TWEET_TEXT + " TEXT, ");
+ sqlBuilder.append(TimelineTable.CREATED + " INTEGER, ");
+ sqlBuilder.append(");");
+ String sql = sqlBuilder.toString();
+ Log.i(TAG, "Creating DB table with string: '" + sql + "'");
+ db.execSQL(sql);
+
+ // CREATE PROFILE TABLE
+ sqlBuilder = new StringBuilder();
+ sqlBuilder.append("CREATE TABLE " + ProfileConstants.TABLE_NAME + " (");
+ sqlBuilder.append(ResourceTable._ID + " INTEGER, ");
+ sqlBuilder.append(ResourceTable._STATUS + " TEXT, ");
+ sqlBuilder.append(ResourceTable._RESULT + " INTEGER, ");
+ sqlBuilder.append(ProfileConstants.NAME + " TEXT, ");
+
+ sql = sqlBuilder.toString();
+ Log.i(TAG, "Creating DB table with string: '" + sql + "'");
+ db.execSQL(sql);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ //Gets called when the database is upgraded, i.e. the version number changes
+ }
+
+}
View
17 src/mn/aug/restfulandroid/provider/ResourceTable.java
@@ -0,0 +1,17 @@
+package mn.aug.restfulandroid.provider;
+
+import android.provider.BaseColumns;
+
+public interface ResourceTable extends BaseColumns {
+
+ /* The current transaction status. May be null if no current transaction for this resource
+ * <P>Type: STRING</P>
+ */
+ public static final String _STATUS = "_status";
+
+ /* The transaction result code, typically an http status.
+ * <P>Type: INTEGER </P>
+ */
+ public static final String _RESULT = "_result";
+
+}
View
296 src/mn/aug/restfulandroid/provider/TimelineProvider.java
@@ -0,0 +1,296 @@
+package mn.aug.restfulandroid.provider;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+
+import mn.aug.restfulandroid.provider.TimelineProviderContract.TimelineTable;
+import android.content.ContentProvider;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteQueryBuilder;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
+
+public class TimelineProvider extends ContentProvider {
+
+ public static final String TAG = "TimelineProvider";
+
+ // "projection" map of all the timeline table columns
+ private static HashMap<String, String> TimelineProjectionMap;
+ // URI matcher ID for the main timeline URI pattern
+ private static final int MATCHER_TIMELINE = 1;
+ // URI matcher ID for the single tweet ID pattern
+ private static final int MATCHER_TWEET = 2;
+ // URI matcher for validating URIs
+ private static final UriMatcher uriMatcher;
+ // Handle to our ProviderDbHelper.
+ private ProviderDbHelper dbHelper;
+
+ /**
+ * The MIME type of a timeline
+ */
+ private static final String TIMELINE_CONTENT_TYPE = "vnd.android.cursor.dir/vnd.restfulandroid.timeline";
+
+ /**
+ * The MIME type of a single tweet from the timeline
+ */
+ private static final String TIMELINE_CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.restfulandroid.timeline";
+
+ // static 'setup' block
+ static {
+ // Build up URI matcher
+ uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
+ // Add a pattern to route URIs terminated with just "rageComics"
+ uriMatcher.addURI(TimelineProviderContract.AUTHORITY, TimelineTable.TABLE_NAME, MATCHER_TIMELINE);
+ // Add a pattern to route URIs terminated with comic IDs
+ uriMatcher.addURI(TimelineProviderContract.AUTHORITY, TimelineTable.TABLE_NAME + "/#", MATCHER_TWEET);
+
+ // Create and initialize a projection map that returns all columns,
+ // This map returns a column name for a given string. The two are usually equal, but we need this structure
+ // later, down in .query()
+ TimelineProjectionMap = new HashMap<String, String>();
+ for (String column : TimelineTable.ALL_COLUMNS) {
+ TimelineProjectionMap.put(column, column);
+ }
+ }
+
+ @Override
+ public boolean onCreate() {
+ this.dbHelper = new ProviderDbHelper(this.getContext());
+ return true; // if there are any issues, they'll be reported as exceptions
+ }
+
+ @Override
+ public int delete(Uri uri, String whereClause, String[] whereValues) {
+ SQLiteDatabase db = this.dbHelper.getWritableDatabase();
+ String finalWhere;
+ int deletedRowsCount;
+
+ // Perform the delete based on URI pattern
+ db.beginTransaction();
+ try {
+ switch (uriMatcher.match(uri)) {
+ case MATCHER_TIMELINE:
+ // Delete all the rage comics matching the where column/value pairs
+ deletedRowsCount = db.delete(TimelineTable.TABLE_NAME, whereClause, whereValues);
+ break;
+
+ case MATCHER_TWEET:
+ //Delete the comic with the given ID
+ String tweetId = uri.getPathSegments().get(TimelineTable.TWEET_ID_PATH_POSITION);
+ finalWhere = TimelineTable._ID + " = " + tweetId;
+ if (whereClause != null) {
+ finalWhere = finalWhere + " AND " + whereClause;
+ }
+
+ // Perform the delete.
+ deletedRowsCount = db.delete(TimelineTable.TABLE_NAME, finalWhere, whereValues);
+ break;
+
+ // If the incoming URI is invalid, throws an exception.
+ default:
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+ } finally {
+ db.endTransaction();
+ }
+
+ // Notify observers of the the change
+ getContext().getContentResolver().notifyChange(uri, null);
+
+ // Returns the number of rows deleted.
+ return deletedRowsCount;
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues initialValues) {
+ // Validate the incoming URI.
+ if (uriMatcher.match(uri) != MATCHER_TIMELINE) {
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+
+ ContentValues values;
+ if (initialValues != null) {
+ values = new ContentValues(initialValues);
+ } else {
+ throw new SQLException("ContentValues arg for .insert() is null, cannot insert row.");
+ }
+
+ long newRowId = this.dbHelper.getWritableDatabase().insert(TimelineTable.TABLE_NAME, null, values);
+
+ if (newRowId > 0) { // if rowID is -1, it means the insert failed
+ // Build a new Timeline URI with the new tweet's ID appended to it.
+ Uri tweetUri = ContentUris.withAppendedId(TimelineTable.CONTENT_ID_URI_BASE, newRowId);
+ // Notify observers that our data changed.
+ getContext().getContentResolver().notifyChange(tweetUri, null);
+ return tweetUri;
+ }
+
+ throw new SQLException("Failed to insert row into " + uri); // Insert failed: halt and catch fire.
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] selectedColumns, String whereClause, String[] whereValues, String sortOrder) {
+ SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
+ qb.setTables(TimelineTable.TABLE_NAME);
+
+ // Choose the projection and adjust the "where" clause based on URI pattern-matching.
+ switch (uriMatcher.match(uri)) {
+ case MATCHER_TIMELINE:
+ qb.setProjectionMap(TimelineProjectionMap);
+ break;
+
+ // asking for a single comic - use the rage comics projection, but add a where clause to only return the one
+ // comic
+ case MATCHER_TWEET:
+ qb.setProjectionMap(TimelineProjectionMap);
+ // Find the comic ID itself in the incoming URI
+ String id = uri.getPathSegments().get(TimelineTable.TWEET_ID_PATH_POSITION);
+ qb.appendWhere(TimelineTable._ID + "=" + id);
+ break;
+
+ default:
+ // If the URI doesn't match any of the known patterns, throw an exception.
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+
+ SQLiteDatabase db = this.dbHelper.getReadableDatabase();
+ // the two nulls here are 'grouping' and 'filtering by group'
+ Cursor cursor = qb.query(db, selectedColumns, whereClause, whereValues, null, null, sortOrder);
+
+ // Tell the Cursor about the URI to watch, so it knows when its source data changes
+ cursor.setNotificationUri(getContext().getContentResolver(), uri);
+ return cursor;
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues updateValues, String whereClause, String[] whereValues) {
+ SQLiteDatabase db = this.dbHelper.getWritableDatabase();
+ int updatedRowsCount;
+ String finalWhere;
+
+ db.beginTransaction();
+ // Perform the update based on the incoming URI's pattern
+ try {
+ switch (uriMatcher.match(uri)) {
+
+ case MATCHER_TIMELINE:
+ // Perform the update and return the number of rows updated.
+ updatedRowsCount = db.update(TimelineTable.TABLE_NAME, updateValues, whereClause, whereValues);
+ break;
+
+ case MATCHER_TWEET:
+ String id = uri.getPathSegments().get(TimelineTable.TWEET_ID_PATH_POSITION);
+ finalWhere = TimelineTable._ID + " = " + id;
+
+ // if we were passed a 'where' arg, add that to our 'finalWhere'
+ if (whereClause != null) {
+ finalWhere = finalWhere + " AND " + whereClause;
+ }
+ updatedRowsCount = db.update(TimelineTable.TABLE_NAME, updateValues, finalWhere, whereValues);
+ break;
+
+ default:
+ // Incoming URI pattern is invalid: halt & catch fire.
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+ } finally {
+ db.endTransaction();
+ }
+
+ /*
+ * Gets a handle to the content resolver object for the current context,
+ * and notifies it that the incoming URI changed. The object passes this
+ * along to the resolver framework, and observers that have registered
+ * themselves for the provider are notified.
+ */
+ if (updatedRowsCount > 0) {
+ getContext().getContentResolver().notifyChange(uri, null);
+ }
+
+ // Returns the number of rows updated.
+ return updatedRowsCount;
+ }
+
+ //Default bulkInsert is terrible. Make it better!
+ @Override
+ public int bulkInsert(Uri uri, ContentValues[] values) {
+ this.validateOrThrow(uri);
+ SQLiteDatabase db = this.dbHelper.getWritableDatabase();
+ db.beginTransaction();
+ int insertedCount = 0;
+ long newRowId = -1;
+ try {
+ for (ContentValues cv : values) {
+ newRowId = this.insert(uri, cv, db);
+ insertedCount++;
+ }
+ db.setTransactionSuccessful();
+ // Build a new Node URI appended with the row ID of the last node to get inserted in the batch
+ Uri nodeUri = ContentUris.withAppendedId(TimelineTable.CONTENT_ID_URI_BASE, newRowId);
+ // Notify observers that our data changed.
+ getContext().getContentResolver().notifyChange(nodeUri, null);
+ return insertedCount;
+
+ } finally {
+ db.endTransaction();
+ }
+ }
+
+ //Used by our implementation of builkInsert
+ private long insert(Uri uri, ContentValues initialValues, SQLiteDatabase writableDb) {
+ // NOTE: this method does not initiate a transaction - this is up to the caller!
+ ContentValues values;
+ if (initialValues != null) {
+ values = new ContentValues(initialValues);
+ } else {
+ throw new SQLException("ContentValues arg for .insert() is null, cannot insert row.");
+ }
+
+ long newRowId = writableDb.insert(TimelineTable.TABLE_NAME, null, values);
+ if (newRowId == -1) { // if rowID is -1, it means the insert failed
+ throw new SQLException("Failed to insert row into " + uri); // Insert failed: halt and catch fire.
+ }
+ return newRowId;
+ }
+
+ private void validateOrThrow(Uri uri) {
+ // Validate the incoming URI.
+ if (uriMatcher.match(uri) != MATCHER_TIMELINE) {
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ switch (uriMatcher.match(uri)) {
+ case MATCHER_TIMELINE:
+ return TIMELINE_CONTENT_TYPE;
+ case MATCHER_TWEET:
+ return TIMELINE_CONTENT_ITEM_TYPE;
+ default:
+ throw new IllegalArgumentException("Unknown URI " + uri);
+ }
+ }
+
+ @Override
+ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
+ File file = new File(this.getContext().getFilesDir(), uri.getPath());
+ ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
+ return parcel;
+ }
+
+// public AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts) {
+// try {
+// return super.openTypedAssetFile(uri, mimeTypeFilter, opts);
+// } catch (FileNotFoundException e) {
+// Log.e(TAG, "OH NOES! Can't find file: " + uri);
+// }
+// return null;
+// }
+}
View
87 src/mn/aug/restfulandroid/provider/TimelineProviderContract.java
@@ -0,0 +1,87 @@
+package mn.aug.restfulandroid.provider;
+
+
+import android.net.Uri;
+
+public final class TimelineProviderContract {
+
+
+
+ public static final String AUTHORITY = "mn.aug.restfulandroid.timelineprovider";
+
+ // TIMELINE TABLE CONTRACT
+ public static final class TimelineTable implements ResourceTable {
+
+ public static final String TABLE_NAME = "timeline";
+
+ // URI DEFS
+ static final String SCHEME = "content://";
+ public static final String URI_PREFIX = SCHEME + AUTHORITY;
+ private static final String URI_PATH_TIMELINE = "/" + TABLE_NAME;
+ // Note the slash on the end of this one, as opposed to the URI_PATH_TIMELINE, which has no slash.
+ private static final String URI_PATH_TWEET = "/" + TABLE_NAME + "/";
+ public static final int TWEET_ID_PATH_POSITION = 1;
+
+ // content://mn.aug.restfulandroid.timelineprovider/timeline
+ public static final Uri CONTENT_URI = Uri.parse(URI_PREFIX + URI_PATH_TIMELINE);
+ // content://mn.aug.restfulandroid.timelineprovider/timeline/ -- used for content provider insert() call
+ public static final Uri CONTENT_ID_URI_BASE = Uri.parse(SCHEME + AUTHORITY + URI_PATH_TWEET);
+ // content://mn.aug.restfulandroid.timelineprovider/timeline/#
+ public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(SCHEME + AUTHORITY + URI_PATH_TWEET + "#");
+
+ public static final String[] ALL_COLUMNS;
+ public static final String[] DISPLAY_COLUMNS;
+
+ static {
+ ALL_COLUMNS = new String[] {
+ TimelineTable._ID,
+ TimelineTable._STATUS,
+ TimelineTable._RESULT,
+ TimelineTable.AUTHOR,
+ TimelineTable.TWEET_TEXT,
+ TimelineTable.CREATED
+ };
+
+ DISPLAY_COLUMNS = new String[] {
+ TimelineTable._ID,
+ TimelineTable.AUTHOR,
+ TimelineTable.TWEET_TEXT,
+ };
+ }
+
+
+ /**
+ * Column name for the tweet author
+ * <P>
+ * Type: TEXT
+ * </P>
+ */
+ public static final String AUTHOR = "author";
+
+ /**
+ * Column name for tweet content
+ * <P>
+ * Type: TEXT
+ * </P>
+ */
+ public static final String TWEET_TEXT = "tweet_text";
+
+ /**
+ * Column name for the creation date
+ * <P>
+ * Type: LONG (UNIX timestamp)
+ * </P>
+ */
+ public static final String CREATED = "timestamp";
+
+
+ // Prevent instantiation of this class
+ private TimelineTable() {
+ }
+ }
+
+ private TimelineProviderContract() {
+ // disallow instantiation
+ }
+
+}
View
16 src/mn/aug/restfulandroid/service/TwitterServiceHelper.java
@@ -30,7 +30,7 @@
private static TwitterServiceHelper instance;
//TODO: refactor the key
- private Map<String,Long> requests = new HashMap<String,Long>();
+ private Map<String,Long> pendingRequests = new HashMap<String,Long>();
private Context ctx;
private TwitterServiceHelper(Context ctx){
@@ -50,7 +50,7 @@ public static TwitterServiceHelper getInstance(Context ctx){
public long getTimeline() {
long requestId = generateRequestID();
- requests.put(timelineHashkey, requestId);
+ pendingRequests.put(timelineHashkey, requestId);
ResultReceiver serviceCallback = new ResultReceiver(null){
@Override
@@ -72,12 +72,12 @@ protected void onReceiveResult(int resultCode, Bundle resultData) {
public long getProfile(){
- if(requests.containsKey(profileHashkey)){
- return requests.get(profileHashkey);
+ if(pendingRequests.containsKey(profileHashkey)){
+ return pendingRequests.get(profileHashkey);
}
long requestId = generateRequestID();
- requests.put(profileHashkey, requestId);
+ pendingRequests.put(profileHashkey, requestId);
ResultReceiver serviceCallback = new ResultReceiver(null){
@@ -105,7 +105,7 @@ private long generateRequestID() {
}
public boolean isRequestPending(long requestId){
- return this.requests.containsValue(requestId);
+ return this.pendingRequests.containsValue(requestId);
}
private void handleGetProfileResponse(int resultCode, Bundle resultData){
@@ -116,7 +116,7 @@ private void handleGetProfileResponse(int resultCode, Bundle resultData){
if(origIntent != null){
long requestId = origIntent.getLongExtra(REQUEST_ID, 0);
- requests.remove(profileHashkey);
+ pendingRequests.remove(profileHashkey);
Intent resultBroadcast = new Intent(ACTION_REQUEST_RESULT);
resultBroadcast.putExtra(EXTRA_REQUEST_ID, requestId);
@@ -134,7 +134,7 @@ private void handleGetTimelineResponse(int resultCode, Bundle resultData){
if(origIntent != null){
long requestId = origIntent.getLongExtra(REQUEST_ID, 0);
- requests.remove(timelineHashkey);
+ pendingRequests.remove(timelineHashkey);
Intent resultBroadcast = new Intent(ACTION_REQUEST_RESULT);
resultBroadcast.putExtra(EXTRA_REQUEST_ID, requestId);

0 comments on commit a95a94e

Please sign in to comment.
Something went wrong with that request. Please try again.