dagger migration
This commit is contained in:
parent
1ff43a360d
commit
674202dbea
|
@ -230,8 +230,8 @@ public class TwidereApplication extends MultiDexApplication implements Constants
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLowMemory() {
|
public void onLowMemory() {
|
||||||
final ApplicationModule module = getApplicationModule();
|
// final ApplicationModule module = getApplicationModule();
|
||||||
module.getMediaLoaderWrapper().clearMemoryCache();
|
// module.getMediaLoaderWrapper().clearMemoryCache();
|
||||||
super.onLowMemory();
|
super.onLowMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import android.database.Cursor;
|
||||||
import android.database.MatrixCursor;
|
import android.database.MatrixCursor;
|
||||||
import android.database.SQLException;
|
import android.database.SQLException;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteFullException;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
@ -83,7 +84,9 @@ import org.mariotaku.twidere.model.ParcelableStatus;
|
||||||
import org.mariotaku.twidere.model.StringLongPair;
|
import org.mariotaku.twidere.model.StringLongPair;
|
||||||
import org.mariotaku.twidere.model.UnreadItem;
|
import org.mariotaku.twidere.model.UnreadItem;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
||||||
|
import org.mariotaku.twidere.provider.TwidereDataStore.CachedHashtags;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.CachedRelationships;
|
import org.mariotaku.twidere.provider.TwidereDataStore.CachedRelationships;
|
||||||
|
import org.mariotaku.twidere.provider.TwidereDataStore.CachedStatuses;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers;
|
import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.DirectMessages;
|
import org.mariotaku.twidere.provider.TwidereDataStore.DirectMessages;
|
||||||
import org.mariotaku.twidere.provider.TwidereDataStore.Drafts;
|
import org.mariotaku.twidere.provider.TwidereDataStore.Drafts;
|
||||||
|
@ -139,29 +142,24 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
LazyLoadCallback {
|
LazyLoadCallback {
|
||||||
|
|
||||||
public static final String TAG_OLDEST_MESSAGES = "oldest_messages";
|
public static final String TAG_OLDEST_MESSAGES = "oldest_messages";
|
||||||
private ContentResolver mContentResolver;
|
|
||||||
private SQLiteDatabaseWrapper mDatabaseWrapper;
|
|
||||||
private PermissionsManager mPermissionsManager;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private NotificationManager mNotificationManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ReadStateManager mReadStateManager;
|
ReadStateManager mReadStateManager;
|
||||||
@Inject
|
@Inject
|
||||||
AsyncTwitterWrapper mTwitterWrapper;
|
AsyncTwitterWrapper mTwitterWrapper;
|
||||||
@Inject
|
@Inject
|
||||||
ImageLoader mMediaLoader;
|
ImageLoader mMediaLoader;
|
||||||
|
private ContentResolver mContentResolver;
|
||||||
|
private SQLiteDatabaseWrapper mDatabaseWrapper;
|
||||||
|
private PermissionsManager mPermissionsManager;
|
||||||
|
@Nullable
|
||||||
|
private NotificationManager mNotificationManager;
|
||||||
private SharedPreferencesWrapper mPreferences;
|
private SharedPreferencesWrapper mPreferences;
|
||||||
private ImagePreloader mImagePreloader;
|
private ImagePreloader mImagePreloader;
|
||||||
@Inject
|
@Inject
|
||||||
private Network mNetwork;
|
Network mNetwork;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
private boolean mHomeActivityInBackground;
|
private boolean mHomeActivityInBackground;
|
||||||
|
|
||||||
private boolean mNameFirst;
|
|
||||||
|
|
||||||
private final BroadcastReceiver mHomeActivityStateReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mHomeActivityStateReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, final Intent intent) {
|
public void onReceive(final Context context, final Intent intent) {
|
||||||
|
@ -174,10 +172,127 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
private boolean mNameFirst;
|
||||||
|
|
||||||
|
private static PendingIntent getDeleteIntent(Context context, String type, long accountId, long position) {
|
||||||
|
// Setup delete intent
|
||||||
|
final Intent recvIntent = new Intent(context, NotificationReceiver.class);
|
||||||
|
recvIntent.setAction(BROADCAST_NOTIFICATION_DELETED);
|
||||||
|
final Uri.Builder recvLinkBuilder = new Uri.Builder();
|
||||||
|
recvLinkBuilder.scheme(SCHEME_TWIDERE);
|
||||||
|
recvLinkBuilder.authority(AUTHORITY_NOTIFICATIONS);
|
||||||
|
recvLinkBuilder.appendPath(type);
|
||||||
|
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
|
||||||
|
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_READ_POSITION, String.valueOf(position));
|
||||||
|
recvIntent.setData(recvLinkBuilder.build());
|
||||||
|
return PendingIntent.getBroadcast(context, 0, recvIntent, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PendingIntent getDeleteIntent(Context context, String type, long accountId, StringLongPair[] positions) {
|
||||||
|
// Setup delete intent
|
||||||
|
final Intent recvIntent = new Intent(context, NotificationReceiver.class);
|
||||||
|
final Uri.Builder recvLinkBuilder = new Uri.Builder();
|
||||||
|
recvLinkBuilder.scheme(SCHEME_TWIDERE);
|
||||||
|
recvLinkBuilder.authority(AUTHORITY_NOTIFICATIONS);
|
||||||
|
recvLinkBuilder.appendPath(type);
|
||||||
|
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
|
||||||
|
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_READ_POSITIONS, StringLongPair.toString(positions));
|
||||||
|
recvIntent.setData(recvLinkBuilder.build());
|
||||||
|
return PendingIntent.getBroadcast(context, 0, recvIntent, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Cursor getPreferencesCursor(final SharedPreferencesWrapper preferences, final String key) {
|
||||||
|
final MatrixCursor c = new MatrixCursor(TwidereDataStore.Preferences.MATRIX_COLUMNS);
|
||||||
|
final Map<String, Object> map = new HashMap<>();
|
||||||
|
final Map<String, ?> all = preferences.getAll();
|
||||||
|
if (key == null) {
|
||||||
|
map.putAll(all);
|
||||||
|
} else {
|
||||||
|
map.put(key, all.get(key));
|
||||||
|
}
|
||||||
|
for (final Map.Entry<String, ?> item : map.entrySet()) {
|
||||||
|
final Object value = item.getValue();
|
||||||
|
final int type = getPreferenceType(value);
|
||||||
|
c.addRow(new Object[]{item.getKey(), ParseUtils.parseString(value), type});
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getPreferenceType(final Object object) {
|
||||||
|
if (object == null)
|
||||||
|
return Preferences.TYPE_NULL;
|
||||||
|
else if (object instanceof Boolean)
|
||||||
|
return Preferences.TYPE_BOOLEAN;
|
||||||
|
else if (object instanceof Integer)
|
||||||
|
return Preferences.TYPE_INTEGER;
|
||||||
|
else if (object instanceof Long)
|
||||||
|
return Preferences.TYPE_LONG;
|
||||||
|
else if (object instanceof Float)
|
||||||
|
return Preferences.TYPE_FLOAT;
|
||||||
|
else if (object instanceof String) return Preferences.TYPE_STRING;
|
||||||
|
return Preferences.TYPE_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getUnreadCount(final List<UnreadItem> set, final long... accountIds) {
|
||||||
|
if (set == null || set.isEmpty()) return 0;
|
||||||
|
int count = 0;
|
||||||
|
for (final UnreadItem item : set.toArray(new UnreadItem[set.size()])) {
|
||||||
|
if (item != null && ArrayUtils.contains(accountIds, item.account_id)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean shouldReplaceOnConflict(final int table_id) {
|
||||||
|
switch (table_id) {
|
||||||
|
case TABLE_ID_CACHED_HASHTAGS:
|
||||||
|
case TABLE_ID_CACHED_STATUSES:
|
||||||
|
case TABLE_ID_CACHED_USERS:
|
||||||
|
case TABLE_ID_CACHED_RELATIONSHIPS:
|
||||||
|
case TABLE_ID_SEARCH_HISTORY:
|
||||||
|
case TABLE_ID_FILTERED_USERS:
|
||||||
|
case TABLE_ID_FILTERED_KEYWORDS:
|
||||||
|
case TABLE_ID_FILTERED_SOURCES:
|
||||||
|
case TABLE_ID_FILTERED_LINKS:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bulkInsert(@NonNull final Uri uri, @NonNull final ContentValues[] valuesArray) {
|
public int bulkInsert(@NonNull final Uri uri, @NonNull final ContentValues[] valuesArray) {
|
||||||
try {
|
try {
|
||||||
|
return bulkInsertInternal(uri, valuesArray);
|
||||||
|
} catch (final SQLException e) {
|
||||||
|
if (handleSQLException(e)) {
|
||||||
|
try {
|
||||||
|
return bulkInsertInternal(uri, valuesArray);
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
throw new IllegalStateException(e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean handleSQLException(SQLException e) {
|
||||||
|
try {
|
||||||
|
if (e instanceof SQLiteFullException) {
|
||||||
|
// Drop cached databases
|
||||||
|
mDatabaseWrapper.delete(CachedUsers.TABLE_NAME, null, null);
|
||||||
|
mDatabaseWrapper.delete(CachedStatuses.TABLE_NAME, null, null);
|
||||||
|
mDatabaseWrapper.delete(CachedHashtags.TABLE_NAME, null, null);
|
||||||
|
mDatabaseWrapper.execSQL("VACUUM");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (SQLException ee) {
|
||||||
|
throw new IllegalStateException(ee);
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int bulkInsertInternal(@NonNull Uri uri, @NonNull ContentValues[] valuesArray) {
|
||||||
final int tableId = getTableId(uri);
|
final int tableId = getTableId(uri);
|
||||||
final String table = getTableNameById(tableId);
|
final String table = getTableNameById(tableId);
|
||||||
checkWritePermission(tableId, table);
|
checkWritePermission(tableId, table);
|
||||||
|
@ -227,15 +342,25 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
}
|
}
|
||||||
onNewItemsInserted(uri, tableId, valuesArray, newIds);
|
onNewItemsInserted(uri, tableId, valuesArray, newIds);
|
||||||
return result;
|
return result;
|
||||||
} catch (final SQLException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(@NonNull final Uri uri, final String selection, final String[] selectionArgs) {
|
public int delete(@NonNull final Uri uri, final String selection, final String[] selectionArgs) {
|
||||||
try {
|
try {
|
||||||
|
return deleteInternal(uri, selection, selectionArgs);
|
||||||
|
} catch (final SQLException e) {
|
||||||
|
if (handleSQLException(e)) {
|
||||||
|
try {
|
||||||
|
return deleteInternal(uri, selection, selectionArgs);
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
throw new IllegalStateException(e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int deleteInternal(@NonNull Uri uri, String selection, String[] selectionArgs) {
|
||||||
final int tableId = getTableId(uri);
|
final int tableId = getTableId(uri);
|
||||||
final String table = getTableNameById(tableId);
|
final String table = getTableNameById(tableId);
|
||||||
checkWritePermission(tableId, table);
|
checkWritePermission(tableId, table);
|
||||||
|
@ -268,9 +393,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
onDatabaseUpdated(tableId, uri);
|
onDatabaseUpdated(tableId, uri);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (final SQLException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -281,6 +403,20 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
@Override
|
@Override
|
||||||
public Uri insert(@NonNull final Uri uri, final ContentValues values) {
|
public Uri insert(@NonNull final Uri uri, final ContentValues values) {
|
||||||
try {
|
try {
|
||||||
|
return insertInternal(uri, values);
|
||||||
|
} catch (final SQLException e) {
|
||||||
|
if (handleSQLException(e)) {
|
||||||
|
try {
|
||||||
|
return insertInternal(uri, values);
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
throw new IllegalStateException(e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Uri insertInternal(@NonNull Uri uri, ContentValues values) {
|
||||||
final int tableId = getTableId(uri);
|
final int tableId = getTableId(uri);
|
||||||
final String table = getTableNameById(tableId);
|
final String table = getTableNameById(tableId);
|
||||||
checkWritePermission(tableId, table);
|
checkWritePermission(tableId, table);
|
||||||
|
@ -367,17 +503,16 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
onDatabaseUpdated(tableId, uri);
|
onDatabaseUpdated(tableId, uri);
|
||||||
onNewItemsInserted(uri, tableId, values, rowId);
|
onNewItemsInserted(uri, tableId, values, rowId);
|
||||||
return Uri.withAppendedPath(uri, String.valueOf(rowId));
|
return Uri.withAppendedPath(uri, String.valueOf(rowId));
|
||||||
} catch (final SQLException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private long showDraftNotification(Uri queryUri, ContentValues values) {
|
private long showDraftNotification(Uri queryUri, ContentValues values) {
|
||||||
if (values == null) return -1;
|
final Context context = getContext();
|
||||||
|
if (values == null || context == null) return -1;
|
||||||
final Long draftId = values.getAsLong(BaseColumns._ID);
|
final Long draftId = values.getAsLong(BaseColumns._ID);
|
||||||
if (draftId == null) return -1;
|
if (draftId == null) return -1;
|
||||||
final Expression where = Expression.equals(Drafts._ID, draftId);
|
final Expression where = Expression.equals(Drafts._ID, draftId);
|
||||||
final Cursor c = getContentResolver().query(Drafts.CONTENT_URI, Drafts.COLUMNS, where.getSQL(), null, null);
|
final Cursor c = getContentResolver().query(Drafts.CONTENT_URI, Drafts.COLUMNS, where.getSQL(), null, null);
|
||||||
|
if (c == null) return -1;
|
||||||
final DraftItem.CursorIndices i = new DraftItem.CursorIndices(c);
|
final DraftItem.CursorIndices i = new DraftItem.CursorIndices(c);
|
||||||
final DraftItem item;
|
final DraftItem item;
|
||||||
try {
|
try {
|
||||||
|
@ -386,7 +521,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
} finally {
|
} finally {
|
||||||
c.close();
|
c.close();
|
||||||
}
|
}
|
||||||
final Context context = getContext();
|
|
||||||
final String title = context.getString(R.string.status_not_updated);
|
final String title = context.getString(R.string.status_not_updated);
|
||||||
final String message = context.getString(R.string.status_not_updated_summary);
|
final String message = context.getString(R.string.status_not_updated_summary);
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
|
@ -601,6 +735,20 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
@Override
|
@Override
|
||||||
public int update(@NonNull final Uri uri, final ContentValues values, final String selection, final String[] selectionArgs) {
|
public int update(@NonNull final Uri uri, final ContentValues values, final String selection, final String[] selectionArgs) {
|
||||||
try {
|
try {
|
||||||
|
return updateInternal(uri, values, selection, selectionArgs);
|
||||||
|
} catch (final SQLException e) {
|
||||||
|
if (handleSQLException(e)) {
|
||||||
|
try {
|
||||||
|
return updateInternal(uri, values, selection, selectionArgs);
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
throw new IllegalStateException(e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int updateInternal(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||||
final int tableId = getTableId(uri);
|
final int tableId = getTableId(uri);
|
||||||
final String table = getTableNameById(tableId);
|
final String table = getTableNameById(tableId);
|
||||||
checkWritePermission(tableId, table);
|
checkWritePermission(tableId, table);
|
||||||
|
@ -619,9 +767,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
onDatabaseUpdated(tableId, uri);
|
onDatabaseUpdated(tableId, uri);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (final SQLException e) {
|
|
||||||
throw new IllegalStateException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPermission(final String... permissions) {
|
private boolean checkPermission(final String... permissions) {
|
||||||
|
@ -765,8 +910,8 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
|
|
||||||
private ParcelFileDescriptor getCacheFileFd(final String name) throws FileNotFoundException {
|
private ParcelFileDescriptor getCacheFileFd(final String name) throws FileNotFoundException {
|
||||||
if (name == null) return null;
|
if (name == null) return null;
|
||||||
final Context mContext = getContext();
|
final Context context = getContext();
|
||||||
final File cacheDir = mContext.getCacheDir();
|
final File cacheDir = context.getCacheDir();
|
||||||
final File file = new File(cacheDir, name);
|
final File file = new File(cacheDir, name);
|
||||||
if (!file.exists()) return null;
|
if (!file.exists()) return null;
|
||||||
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
|
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
|
||||||
|
@ -861,7 +1006,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void notifyUnreadCountChanged(final int position) {
|
private void notifyUnreadCountChanged(final int position) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final Bus bus = TwidereApplication.getInstance(context).getMessageBus();
|
final Bus bus = TwidereApplication.getInstance(context).getMessageBus();
|
||||||
|
@ -888,7 +1032,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
notifyContentObserver(getNotificationUri(tableId, uri));
|
notifyContentObserver(getNotificationUri(tableId, uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onNewItemsInserted(final Uri uri, final int tableId, final ContentValues values, final long newId) {
|
private void onNewItemsInserted(final Uri uri, final int tableId, final ContentValues values, final long newId) {
|
||||||
onNewItemsInserted(uri, tableId, new ContentValues[]{values}, new long[]{newId});
|
onNewItemsInserted(uri, tableId, new ContentValues[]{values}, new long[]{newId});
|
||||||
}
|
}
|
||||||
|
@ -1135,33 +1278,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
return PendingIntent.getActivity(context, 0, homeIntent, 0);
|
return PendingIntent.getActivity(context, 0, homeIntent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PendingIntent getDeleteIntent(Context context, String type, long accountId, long position) {
|
|
||||||
// Setup delete intent
|
|
||||||
final Intent recvIntent = new Intent(context, NotificationReceiver.class);
|
|
||||||
recvIntent.setAction(BROADCAST_NOTIFICATION_DELETED);
|
|
||||||
final Uri.Builder recvLinkBuilder = new Uri.Builder();
|
|
||||||
recvLinkBuilder.scheme(SCHEME_TWIDERE);
|
|
||||||
recvLinkBuilder.authority(AUTHORITY_NOTIFICATIONS);
|
|
||||||
recvLinkBuilder.appendPath(type);
|
|
||||||
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
|
|
||||||
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_READ_POSITION, String.valueOf(position));
|
|
||||||
recvIntent.setData(recvLinkBuilder.build());
|
|
||||||
return PendingIntent.getBroadcast(context, 0, recvIntent, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PendingIntent getDeleteIntent(Context context, String type, long accountId, StringLongPair[] positions) {
|
|
||||||
// Setup delete intent
|
|
||||||
final Intent recvIntent = new Intent(context, NotificationReceiver.class);
|
|
||||||
final Uri.Builder recvLinkBuilder = new Uri.Builder();
|
|
||||||
recvLinkBuilder.scheme(SCHEME_TWIDERE);
|
|
||||||
recvLinkBuilder.authority(AUTHORITY_NOTIFICATIONS);
|
|
||||||
recvLinkBuilder.appendPath(type);
|
|
||||||
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(accountId));
|
|
||||||
recvLinkBuilder.appendQueryParameter(QUERY_PARAM_READ_POSITIONS, StringLongPair.toString(positions));
|
|
||||||
recvIntent.setData(recvLinkBuilder.build());
|
|
||||||
return PendingIntent.getBroadcast(context, 0, recvIntent, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setNotificationPreferences(NotificationCompat.Builder builder, AccountPreferences pref, int defaultFlags) {
|
private void setNotificationPreferences(NotificationCompat.Builder builder, AccountPreferences pref, int defaultFlags) {
|
||||||
int notificationDefaults = 0;
|
int notificationDefaults = 0;
|
||||||
if (AccountPreferences.isNotificationHasLight(defaultFlags)) {
|
if (AccountPreferences.isNotificationHasLight(defaultFlags)) {
|
||||||
|
@ -1349,66 +1465,6 @@ public final class TwidereDataProvider extends ContentProvider implements Consta
|
||||||
mNameFirst = mPreferences.getBoolean(KEY_NAME_FIRST, false);
|
mNameFirst = mPreferences.getBoolean(KEY_NAME_FIRST, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Cursor getPreferencesCursor(final SharedPreferencesWrapper preferences, final String key) {
|
|
||||||
final MatrixCursor c = new MatrixCursor(TwidereDataStore.Preferences.MATRIX_COLUMNS);
|
|
||||||
final Map<String, Object> map = new HashMap<>();
|
|
||||||
final Map<String, ?> all = preferences.getAll();
|
|
||||||
if (key == null) {
|
|
||||||
map.putAll(all);
|
|
||||||
} else {
|
|
||||||
map.put(key, all.get(key));
|
|
||||||
}
|
|
||||||
for (final Map.Entry<String, ?> item : map.entrySet()) {
|
|
||||||
final Object value = item.getValue();
|
|
||||||
final int type = getPreferenceType(value);
|
|
||||||
c.addRow(new Object[]{item.getKey(), ParseUtils.parseString(value), type});
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getPreferenceType(final Object object) {
|
|
||||||
if (object == null)
|
|
||||||
return Preferences.TYPE_NULL;
|
|
||||||
else if (object instanceof Boolean)
|
|
||||||
return Preferences.TYPE_BOOLEAN;
|
|
||||||
else if (object instanceof Integer)
|
|
||||||
return Preferences.TYPE_INTEGER;
|
|
||||||
else if (object instanceof Long)
|
|
||||||
return Preferences.TYPE_LONG;
|
|
||||||
else if (object instanceof Float)
|
|
||||||
return Preferences.TYPE_FLOAT;
|
|
||||||
else if (object instanceof String) return Preferences.TYPE_STRING;
|
|
||||||
return Preferences.TYPE_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static int getUnreadCount(final List<UnreadItem> set, final long... accountIds) {
|
|
||||||
if (set == null || set.isEmpty()) return 0;
|
|
||||||
int count = 0;
|
|
||||||
for (final UnreadItem item : set.toArray(new UnreadItem[set.size()])) {
|
|
||||||
if (item != null && ArrayUtils.contains(accountIds, item.account_id)) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean shouldReplaceOnConflict(final int table_id) {
|
|
||||||
switch (table_id) {
|
|
||||||
case TABLE_ID_CACHED_HASHTAGS:
|
|
||||||
case TABLE_ID_CACHED_STATUSES:
|
|
||||||
case TABLE_ID_CACHED_USERS:
|
|
||||||
case TABLE_ID_CACHED_RELATIONSHIPS:
|
|
||||||
case TABLE_ID_SEARCH_HISTORY:
|
|
||||||
case TABLE_ID_FILTERED_USERS:
|
|
||||||
case TABLE_ID_FILTERED_KEYWORDS:
|
|
||||||
case TABLE_ID_FILTERED_SOURCES:
|
|
||||||
case TABLE_ID_FILTERED_LINKS:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private static class GetWritableDatabaseTask extends AsyncTask<Object, Object, SQLiteDatabase> {
|
private static class GetWritableDatabaseTask extends AsyncTask<Object, Object, SQLiteDatabase> {
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
|
@ -87,7 +87,6 @@ import org.mariotaku.twidere.task.CacheUsersStatusesTask;
|
||||||
import org.mariotaku.twidere.task.ManagedAsyncTask;
|
import org.mariotaku.twidere.task.ManagedAsyncTask;
|
||||||
import org.mariotaku.twidere.util.collection.LongSparseMap;
|
import org.mariotaku.twidere.util.collection.LongSparseMap;
|
||||||
import org.mariotaku.twidere.util.content.ContentResolverUtils;
|
import org.mariotaku.twidere.util.content.ContentResolverUtils;
|
||||||
import org.mariotaku.twidere.util.dagger.ApplicationModule;
|
|
||||||
import org.mariotaku.twidere.util.message.FavoriteCreatedEvent;
|
import org.mariotaku.twidere.util.message.FavoriteCreatedEvent;
|
||||||
import org.mariotaku.twidere.util.message.FavoriteDestroyedEvent;
|
import org.mariotaku.twidere.util.message.FavoriteDestroyedEvent;
|
||||||
import org.mariotaku.twidere.util.message.FriendshipUpdatedEvent;
|
import org.mariotaku.twidere.util.message.FriendshipUpdatedEvent;
|
||||||
|
@ -130,9 +129,9 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
||||||
|
|
||||||
private CopyOnWriteArraySet<Long> mSendingDraftIds = new CopyOnWriteArraySet<>();
|
private CopyOnWriteArraySet<Long> mSendingDraftIds = new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
public AsyncTwitterWrapper(final Context context) {
|
public AsyncTwitterWrapper(final Context context, final AsyncTaskManager manager) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mAsyncTaskManager = ApplicationModule.get(context).getAsyncTaskManager();
|
mAsyncTaskManager = manager;
|
||||||
mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME,
|
mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME,
|
||||||
Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
||||||
mResolver = context.getContentResolver();
|
mResolver = context.getContentResolver();
|
||||||
|
|
|
@ -11,9 +11,9 @@ import android.text.TextUtils;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.webkit.URLUtil;
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
|
||||||
import com.squareup.okhttp.OkHttpClient;
|
import com.squareup.okhttp.OkHttpClient;
|
||||||
import com.squareup.okhttp.internal.Internal;
|
import com.squareup.okhttp.internal.Internal;
|
||||||
|
import com.squareup.okhttp.internal.Network;
|
||||||
|
|
||||||
import org.mariotaku.restfu.ExceptionFactory;
|
import org.mariotaku.restfu.ExceptionFactory;
|
||||||
import org.mariotaku.restfu.HttpRequestFactory;
|
import org.mariotaku.restfu.HttpRequestFactory;
|
||||||
|
@ -43,7 +43,6 @@ import org.mariotaku.twidere.api.twitter.auth.OAuthAuthorization;
|
||||||
import org.mariotaku.twidere.api.twitter.auth.OAuthEndpoint;
|
import org.mariotaku.twidere.api.twitter.auth.OAuthEndpoint;
|
||||||
import org.mariotaku.twidere.api.twitter.auth.OAuthToken;
|
import org.mariotaku.twidere.api.twitter.auth.OAuthToken;
|
||||||
import org.mariotaku.twidere.api.twitter.util.TwitterConverter;
|
import org.mariotaku.twidere.api.twitter.util.TwitterConverter;
|
||||||
import org.mariotaku.twidere.app.TwidereApplication;
|
|
||||||
import org.mariotaku.twidere.model.ConsumerKeyType;
|
import org.mariotaku.twidere.model.ConsumerKeyType;
|
||||||
import org.mariotaku.twidere.model.ParcelableCredentials;
|
import org.mariotaku.twidere.model.ParcelableCredentials;
|
||||||
import org.mariotaku.twidere.model.RequestType;
|
import org.mariotaku.twidere.model.RequestType;
|
||||||
|
@ -104,12 +103,16 @@ public class TwitterAPIFactory implements TwidereConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestHttpClient getDefaultHttpClient(final Context context) {
|
public static RestHttpClient getDefaultHttpClient(final Context context) {
|
||||||
if (context == null) return null;
|
return getDefaultHttpClient(context, ApplicationModule.get(context).getNetwork());
|
||||||
final SharedPreferencesWrapper prefs = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
||||||
return createHttpClient(context, prefs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestHttpClient createHttpClient(final Context context, final SharedPreferences prefs) {
|
public static RestHttpClient getDefaultHttpClient(final Context context, final Network network) {
|
||||||
|
if (context == null || network == null) return null;
|
||||||
|
final SharedPreferencesWrapper prefs = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||||
|
return createHttpClient(context, network, prefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RestHttpClient createHttpClient(final Context context, final Network network, final SharedPreferences prefs) {
|
||||||
final int connectionTimeout = prefs.getInt(KEY_CONNECTION_TIMEOUT, 10);
|
final int connectionTimeout = prefs.getInt(KEY_CONNECTION_TIMEOUT, 10);
|
||||||
final boolean ignoreSslError = prefs.getBoolean(KEY_IGNORE_SSL_ERROR, false);
|
final boolean ignoreSslError = prefs.getBoolean(KEY_IGNORE_SSL_ERROR, false);
|
||||||
final boolean enableProxy = prefs.getBoolean(KEY_ENABLE_PROXY, false);
|
final boolean enableProxy = prefs.getBoolean(KEY_ENABLE_PROXY, false);
|
||||||
|
@ -128,7 +131,7 @@ public class TwitterAPIFactory implements TwidereConstants {
|
||||||
if (enableProxy) {
|
if (enableProxy) {
|
||||||
client.setProxy(getProxy(prefs));
|
client.setProxy(getProxy(prefs));
|
||||||
}
|
}
|
||||||
Internal.instance.setNetwork(client, ApplicationModule.get(context).getNetwork());
|
Internal.instance.setNetwork(client, network);
|
||||||
return new OkHttpRestClient(context, client);
|
return new OkHttpRestClient(context, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ import com.squareup.otto.Bus;
|
||||||
import org.mariotaku.twidere.app.TwidereApplication;
|
import org.mariotaku.twidere.app.TwidereApplication;
|
||||||
import org.mariotaku.twidere.model.SingleResponse;
|
import org.mariotaku.twidere.model.SingleResponse;
|
||||||
import org.mariotaku.twidere.task.ManagedAsyncTask;
|
import org.mariotaku.twidere.task.ManagedAsyncTask;
|
||||||
import org.mariotaku.twidere.util.dagger.ApplicationModule;
|
|
||||||
import org.mariotaku.twidere.util.imageloader.TwidereImageDownloader;
|
|
||||||
import org.mariotaku.twidere.util.message.VideoLoadFinishedEvent;
|
import org.mariotaku.twidere.util.message.VideoLoadFinishedEvent;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -50,12 +48,12 @@ public class VideoLoader {
|
||||||
private final AsyncTaskManager mTaskManager;
|
private final AsyncTaskManager mTaskManager;
|
||||||
private final Bus mBus;
|
private final Bus mBus;
|
||||||
|
|
||||||
public VideoLoader(Context context) {
|
public VideoLoader(Context context, ImageDownloader downloader, AsyncTaskManager manager) {
|
||||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDiskCache = app.getDiskCache();
|
mDiskCache = app.getDiskCache();
|
||||||
mImageDownloader = new TwidereImageDownloader(context, false);
|
mImageDownloader = downloader;
|
||||||
mTaskManager = ApplicationModule.get(context).getAsyncTaskManager();
|
mTaskManager = manager;
|
||||||
mBus = app.getMessageBus();
|
mBus = app.getMessageBus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
|
||||||
import com.nostra13.universalimageloader.utils.L;
|
import com.nostra13.universalimageloader.utils.L;
|
||||||
import com.squareup.okhttp.internal.Network;
|
import com.squareup.okhttp.internal.Network;
|
||||||
|
|
||||||
|
import org.mariotaku.restfu.http.RestHttpClient;
|
||||||
import org.mariotaku.twidere.BuildConfig;
|
import org.mariotaku.twidere.BuildConfig;
|
||||||
import org.mariotaku.twidere.app.TwidereApplication;
|
import org.mariotaku.twidere.app.TwidereApplication;
|
||||||
import org.mariotaku.twidere.util.ActivityTracker;
|
import org.mariotaku.twidere.util.ActivityTracker;
|
||||||
|
@ -34,6 +35,7 @@ import org.mariotaku.twidere.util.AsyncTaskManager;
|
||||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||||
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||||
import org.mariotaku.twidere.util.ReadStateManager;
|
import org.mariotaku.twidere.util.ReadStateManager;
|
||||||
|
import org.mariotaku.twidere.util.TwitterAPIFactory;
|
||||||
import org.mariotaku.twidere.util.VideoLoader;
|
import org.mariotaku.twidere.util.VideoLoader;
|
||||||
import org.mariotaku.twidere.util.imageloader.TwidereImageDownloader;
|
import org.mariotaku.twidere.util.imageloader.TwidereImageDownloader;
|
||||||
import org.mariotaku.twidere.util.net.TwidereNetwork;
|
import org.mariotaku.twidere.util.net.TwidereNetwork;
|
||||||
|
@ -56,23 +58,44 @@ public class ApplicationModule {
|
||||||
private final TwidereImageDownloader imageDownloader;
|
private final TwidereImageDownloader imageDownloader;
|
||||||
private final AsyncTaskManager asyncTaskManager;
|
private final AsyncTaskManager asyncTaskManager;
|
||||||
private final Network network;
|
private final Network network;
|
||||||
|
private final RestHttpClient restHttpClient;
|
||||||
|
|
||||||
public ApplicationModule(TwidereApplication application) {
|
public ApplicationModule(TwidereApplication application) {
|
||||||
activityTracker = new ActivityTracker();
|
activityTracker = new ActivityTracker();
|
||||||
asyncTwitterWrapper = new AsyncTwitterWrapper(application);
|
|
||||||
readStateManager = new ReadStateManager(application);
|
|
||||||
imageDownloader = new TwidereImageDownloader(application, true);
|
|
||||||
imageLoader = createImageLoader(application, imageDownloader);
|
|
||||||
videoLoader = new VideoLoader(application);
|
|
||||||
mediaLoaderWrapper = new MediaLoaderWrapper(imageLoader, videoLoader);
|
|
||||||
asyncTaskManager = AsyncTaskManager.getInstance();
|
asyncTaskManager = AsyncTaskManager.getInstance();
|
||||||
|
asyncTwitterWrapper = new AsyncTwitterWrapper(application, asyncTaskManager);
|
||||||
|
readStateManager = new ReadStateManager(application);
|
||||||
network = new TwidereNetwork(application);
|
network = new TwidereNetwork(application);
|
||||||
|
restHttpClient = TwitterAPIFactory.getDefaultHttpClient(application, network);
|
||||||
|
imageDownloader = new TwidereImageDownloader(application, network, true);
|
||||||
|
imageLoader = createImageLoader(application, imageDownloader);
|
||||||
|
videoLoader = new VideoLoader(application, imageDownloader, asyncTaskManager);
|
||||||
|
mediaLoaderWrapper = new MediaLoaderWrapper(imageLoader, videoLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApplicationModule get(Context context) {
|
public static ApplicationModule get(Context context) {
|
||||||
return TwidereApplication.getInstance(context).getApplicationModule();
|
return TwidereApplication.getInstance(context).getApplicationModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ImageLoader createImageLoader(TwidereApplication application, TwidereImageDownloader imageDownloader) {
|
||||||
|
final ImageLoader loader = ImageLoader.getInstance();
|
||||||
|
final ImageLoaderConfiguration.Builder cb = new ImageLoaderConfiguration.Builder(application);
|
||||||
|
cb.threadPriority(Thread.NORM_PRIORITY - 2);
|
||||||
|
cb.denyCacheImageMultipleSizesInMemory();
|
||||||
|
cb.tasksProcessingOrder(QueueProcessingType.LIFO);
|
||||||
|
// cb.memoryCache(new ImageMemoryCache(40));
|
||||||
|
cb.diskCache(application.getDiskCache());
|
||||||
|
cb.imageDownloader(imageDownloader);
|
||||||
|
L.writeDebugLogs(BuildConfig.DEBUG);
|
||||||
|
loader.init(cb.build());
|
||||||
|
return loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
public RestHttpClient getRestHttpClient() {
|
||||||
|
return restHttpClient;
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
public AsyncTaskManager getAsyncTaskManager() {
|
public AsyncTaskManager getAsyncTaskManager() {
|
||||||
return asyncTaskManager;
|
return asyncTaskManager;
|
||||||
|
@ -113,20 +136,6 @@ public class ApplicationModule {
|
||||||
return mediaLoaderWrapper;
|
return mediaLoaderWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ImageLoader createImageLoader(TwidereApplication application, TwidereImageDownloader imageDownloader) {
|
|
||||||
final ImageLoader loader = ImageLoader.getInstance();
|
|
||||||
final ImageLoaderConfiguration.Builder cb = new ImageLoaderConfiguration.Builder(application);
|
|
||||||
cb.threadPriority(Thread.NORM_PRIORITY - 2);
|
|
||||||
cb.denyCacheImageMultipleSizesInMemory();
|
|
||||||
cb.tasksProcessingOrder(QueueProcessingType.LIFO);
|
|
||||||
// cb.memoryCache(new ImageMemoryCache(40));
|
|
||||||
cb.diskCache(application.getDiskCache());
|
|
||||||
cb.imageDownloader(imageDownloader);
|
|
||||||
L.writeDebugLogs(BuildConfig.DEBUG);
|
|
||||||
loader.init(cb.build());
|
|
||||||
return loader;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
public Network getNetwork() {
|
public Network getNetwork() {
|
||||||
return network;
|
return network;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import android.webkit.URLUtil;
|
||||||
|
|
||||||
import com.nostra13.universalimageloader.core.assist.ContentLengthInputStream;
|
import com.nostra13.universalimageloader.core.assist.ContentLengthInputStream;
|
||||||
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
|
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
|
||||||
|
import com.squareup.okhttp.internal.Network;
|
||||||
import com.squareup.pollexor.Thumbor;
|
import com.squareup.pollexor.Thumbor;
|
||||||
import com.squareup.pollexor.ThumborUrlBuilder;
|
import com.squareup.pollexor.ThumborUrlBuilder;
|
||||||
|
|
||||||
|
@ -69,24 +70,25 @@ public class TwidereImageDownloader extends BaseImageDownloader implements Const
|
||||||
private final SharedPreferencesWrapper mPreferences;
|
private final SharedPreferencesWrapper mPreferences;
|
||||||
private final boolean mUseThumbor;
|
private final boolean mUseThumbor;
|
||||||
private final String mUserAgent;
|
private final String mUserAgent;
|
||||||
|
private final Network mNetwork;
|
||||||
private Thumbor mThumbor;
|
private Thumbor mThumbor;
|
||||||
private RestHttpClient mClient;
|
private RestHttpClient mClient;
|
||||||
private final String mTwitterProfileImageSize;
|
private final String mTwitterProfileImageSize;
|
||||||
|
|
||||||
public TwidereImageDownloader(final Context context, final boolean useThumbor) {
|
public TwidereImageDownloader(final Context context, final Network network, final boolean useThumbor) {
|
||||||
super(context);
|
super(context);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mNetwork = network;
|
||||||
mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME,
|
mPreferences = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME,
|
||||||
Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
Context.MODE_PRIVATE, SharedPreferenceConstants.class);
|
||||||
mTwitterProfileImageSize = context.getString(R.string.profile_image_size);
|
mTwitterProfileImageSize = context.getString(R.string.profile_image_size);
|
||||||
mUseThumbor = useThumbor;
|
mUseThumbor = useThumbor;
|
||||||
mUserAgent = UserAgentUtils.getDefaultUserAgentString(context);
|
mUserAgent = UserAgentUtils.getDefaultUserAgentString(context);
|
||||||
reloadConnectivitySettings();
|
reloadConnectivitySettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadConnectivitySettings() {
|
public void reloadConnectivitySettings() {
|
||||||
mClient = TwitterAPIFactory.getDefaultHttpClient(mContext);
|
mClient = TwitterAPIFactory.getDefaultHttpClient(mContext, mNetwork);
|
||||||
if (mUseThumbor && mPreferences.getBoolean(KEY_THUMBOR_ENABLED)) {
|
if (mUseThumbor && mPreferences.getBoolean(KEY_THUMBOR_ENABLED)) {
|
||||||
final String address = mPreferences.getString(KEY_THUMBOR_ADDRESS, null);
|
final String address = mPreferences.getString(KEY_THUMBOR_ADDRESS, null);
|
||||||
final String securityKey = mPreferences.getString(KEY_THUMBOR_SECURITY_KEY, null);
|
final String securityKey = mPreferences.getString(KEY_THUMBOR_SECURITY_KEY, null);
|
||||||
|
|
|
@ -48,7 +48,7 @@ import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
|
||||||
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
|
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDE gives me warning if I don't change default comment, so I write this XD
|
* IDE gives me warning if I don't change default comment, so I wrote this XD
|
||||||
* <p/>
|
* <p/>
|
||||||
* Created by mariotaku on 14/11/19.
|
* Created by mariotaku on 14/11/19.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue