added cache size limit option

fixing build errors
This commit is contained in:
Mariotaku Lee 2015-08-28 18:39:44 +08:00
parent 939c78e5cb
commit ca477ade60
9 changed files with 28 additions and 14 deletions

View File

@ -305,4 +305,6 @@ public interface SharedPreferenceConstants {
String KEY_THUMBOR_SECURITY_KEY = "thumbor_security_key";
@Preference(type = BOOLEAN, hasDefault = true, defaultBoolean = false)
String KEY_HIDE_CARD_ACTIONS = "hide_card_actions";
@Preference(type = INT, hasDefault = true, defaultInt = 300)
String KEY_CACHE_SIZE_LIMIT = "cache_size_limit";
}

View File

@ -25,7 +25,7 @@ android {
defaultConfig {
applicationId "org.mariotaku.twidere.donate.nyanwp"
minSdkVersion 20
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}

View File

@ -25,7 +25,7 @@ android {
defaultConfig {
applicationId "org.mariotaku.twidere.donate.nyanwp"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 3
versionName "1.2"
}

View File

@ -19,12 +19,13 @@
apply plugin: 'com.android.application'
apply from: rootProject.file('global.gradle')
apply from: rootProject.file('signing.gradle')
android {
defaultConfig {
applicationId "org.mariotaku.twidere.extension.push.xiaomi"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 2
versionName "1.0"
}

View File

@ -19,15 +19,15 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply from: rootProject.file('global.gradle')
apply from: rootProject.file('signing.gradle')
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "org.mariotaku.twidere.extension.shortener.gist"
minSdkVersion 14
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
}

View File

@ -26,7 +26,7 @@ android {
defaultConfig {
applicationId "org.mariotaku.twidere"
minSdkVersion 20
targetSdkVersion 22
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true

View File

@ -57,6 +57,7 @@ import org.mariotaku.twidere.util.AsyncTaskManager;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.DebugModeUtils;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
import org.mariotaku.twidere.util.MathUtils;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.MultiSelectManager;
import org.mariotaku.twidere.util.ReadStateManager;
@ -340,9 +341,11 @@ public class TwidereApplication extends MultiDexApplication implements Constants
final File cacheDir = getBestCacheDir(this, dirName);
final File fallbackCacheDir = getInternalCacheDir(this, dirName);
final URLFileNameGenerator fileNameGenerator = new URLFileNameGenerator();
final SharedPreferences preferences = getSharedPreferences();
final int cacheSize = MathUtils.clamp(preferences.getInt(KEY_CACHE_SIZE_LIMIT, 300), 100, 500);
try {
return new LruDiskCache(cacheDir, fallbackCacheDir, fileNameGenerator,
384 * 1024 * 1024, 0);
cacheSize * 1024 * 1024, 0);
} catch (IOException e) {
return new ReadOnlyDiskLRUNameCache(cacheDir, fallbackCacheDir, fileNameGenerator);
}

View File

@ -773,4 +773,5 @@
<string name="send_at">Send at</string>
<string name="scheduled_statuses">Scheduled tweets</string>
<string name="report_usage_statistics_now">Report usage statistics now</string>
<string name="cache_size_limit">Cache size limit</string>
</resources>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:key="settings_storage"
android:title="@string/storage">
@ -16,21 +15,29 @@
android:title="@string/database_item_limit"
app:max="500"
app:min="50"
app:step="10"/>
app:step="10" />
<org.mariotaku.twidere.preference.SeekBarDialogPreference
android:defaultValue="300"
android:key="cache_size_limit"
android:title="@string/cache_size_limit"
app:max="500"
app:min="100"
app:step="50" />
<org.mariotaku.twidere.preference.ClearSearchHistoryPreference
android:key="clear_search_history"
android:title="@string/clear_search_history"/>
android:title="@string/clear_search_history" />
<org.mariotaku.twidere.preference.ClearCachePreference
android:key="clear_cache"
android:summary="@string/clear_cache_summary"
android:title="@string/clear_cache"/>
android:title="@string/clear_cache" />
<org.mariotaku.twidere.preference.ClearDatabasesPreference
android:key="clear_databases"
android:summary="@string/clear_databases_summary"
android:title="@string/clear_databases"/>
android:title="@string/clear_databases" />
</PreferenceCategory>