Skip to content

Instantly share code, notes, and snippets.

@moko256
Last active October 26, 2019 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moko256/58143b0159f37c1ca7a9aaed834b5407 to your computer and use it in GitHub Desktop.
Save moko256/58143b0159f37c1ca7a9aaed834b5407 to your computer and use it in GitHub Desktop.
ぼくのかんがえたさいきょうのtwitlatte最小化Patch
Index: build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- build.gradle (date 1572095169000)
+++ build.gradle (date 1572095639197)
@@ -22,7 +22,7 @@
exoplayerVersion = '2.10.4'
glideVersion = '4.10.0'
rxJavaVersion = '2.2.6'
- okhttpVersion = '3.12.5'
+ okhttpVersion = '3.14.4'
gsonVersion = '2.8.5'
}
Index: app/src/main/res/values-fr/strings.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/values-fr/strings.xml (date 1572095169000)
+++ app/src/main/res/values-fr/strings.xml (date 1572095893879)
@@ -74,7 +74,6 @@
<string name="tweet_per_last_24_hours">%d tweets / dernières 24 heures</string>
<string name="do_see_source_code">Voir le code source de cette application</string>
<string name="description_see_source_code">Hébergé sur GitHub</string>
- <string name="please_re_login">twitlatte met à jour quelques clés API\nVeuillez vous reconnecter avec ce compte</string>
<string name="add_poll">Ajouter un sondage</string>
<string name="vote_opening_status">%1$d voix - %2$s</string>
<string name="vote_closed_status">%d voix - fermé</string>
Index: app/src/main/java/com/github/moko256/twitlatte/database/TokenSQLiteOpenHelper.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/TokenSQLiteOpenHelper.java (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/TokenSQLiteOpenHelper.java (date 1572095599744)
@@ -68,29 +68,7 @@
}
@Override
- public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {
- if (oldVersion < 2) {
- sqLiteDatabase.execSQL("update " + TABLE_NAME + " set token='',tokenSecret='' where type=0");
- }
- if (oldVersion < 3) {
- TableDBUtilKt.addColumn(sqLiteDatabase, TABLE_NAME, "consumerKey", null);
- TableDBUtilKt.addColumn(sqLiteDatabase, TABLE_NAME, "consumerSecret", null);
- }
- if (oldVersion < 4) {
- AccessToken[] accessTokens;
- try {
- accessTokens = getAccessTokenInternal(sqLiteDatabase);
- } catch (Throwable throwable) {
- accessTokens = new AccessToken[0];
- }
- sqLiteDatabase.execSQL("drop table if exists " + TABLE_NAME);
- sqLiteDatabase.execSQL("drop index if exists idindex");
- onCreate(sqLiteDatabase);
- for (AccessToken accessToken : accessTokens) {
- addAccessTokenInternal(sqLiteDatabase, accessToken);
- }
- }
- }
+ public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {}
public AccessToken[] getAccessTokens() {
return getAccessTokenInternal(getReadableDatabase());
Index: app/src/main/res/values-ja/strings.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/values-ja/strings.xml (date 1572095169000)
+++ app/src/main/res/values-ja/strings.xml (date 1572095625222)
@@ -110,7 +110,6 @@
<string name="tweet_per_last_24_hours">直近24時間以内で%dツイート</string>
<string name="do_see_source_code">このアプリのソースコードを見る</string>
<string name="description_see_source_code">GitHubで公開されています</string>
- <string name="please_re_login">twitlatteはいくつかのAPIキーをアップデートしました\nこのアカウントで再度ログインしてください</string>
<string name="add_poll">投票を追加</string>
<string name="vote_opening_status">%1$d票 - %2$s</string>
<string name="vote_closed_status">%d票 - 終了しました</string>
Index: app/src/main/java/com/github/moko256/twitlatte/database/CachedStatusesSQLiteOpenHelper.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/CachedStatusesSQLiteOpenHelper.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/CachedStatusesSQLiteOpenHelper.kt (date 1572095564520)
@@ -108,34 +108,7 @@
db.createTableWithUniqueIntKey(COUNTS_TABLE_NAME, arrayOf("id", "count integer default 0"), 0)
}
- override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
- if (oldVersion < 4) {
- db.execSQL("drop table $TABLE_NAME")
- onCreate(db)
- }
- if (oldVersion < 5) {
- db.addColumn(TABLE_NAME, "card_title")
- db.addColumn(TABLE_NAME, "card_url")
- }
- if (oldVersion < 6) {
- db.addColumn(TABLE_NAME, "card_description", "\"\"")
- db.addColumn(TABLE_NAME, "card_image_url")
- }
- if (oldVersion < 7) {
- arrayOf(
- "poll_expiresAt",
- "poll_expired",
- "poll_multiple",
- "poll_votesCount",
- "poll_optionTitles",
- "poll_optionCounts",
- "poll_voted"
- ).forEach {
- db.addColumn(TABLE_NAME, it)
- }
- db.addColumn(TABLE_NAME, "poll_id", "-1")
- }
- }
+ override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {}
fun getCachedStatus(id: Long): StatusObject? {
return selectSingleOrNull(
Index: app/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/build.gradle (date 1572095169000)
+++ app/build.gradle (date 1572095323317)
@@ -22,7 +22,7 @@
buildToolsVersion '28.0.3'
defaultConfig {
- minSdkVersion 19
+ minSdkVersion 28
targetSdkVersion 28
applicationId 'com.github.moko256.twitlatte'
Index: app/src/main/java/com/github/moko256/twitlatte/database/CachedUsersSQLiteOpenHelper.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/CachedUsersSQLiteOpenHelper.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/CachedUsersSQLiteOpenHelper.kt (date 1572095588753)
@@ -67,13 +67,7 @@
db.createTableWithUniqueIntKey(TABLE_NAME, TABLE_COLUMNS, 0 /*TABLE_COLUMNS.indexOf("id")*/)
}
- override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
- if (oldVersion < 3) {
- db.execSQL("drop table CachedStatuses")
-
- onCreate(db)
- }
- }
+ override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {}
fun getCachedUser(id: Long): User? {
return selectSingleOrNull(
Index: app/src/main/java/com/github/moko256/twitlatte/database/CachedTrendsSQLiteOpenHelper.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/CachedTrendsSQLiteOpenHelper.java (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/CachedTrendsSQLiteOpenHelper.java (date 1572095588729)
@@ -51,11 +51,7 @@
}
@Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- if (oldVersion == 1) {
- TableDBUtilKt.addColumn(db, TABLE_NAME, "volume", "-1");
- }
- }
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {}
public List<Trend> getTrends() {
List<Trend> trends;
Index: app/src/main/java/com/github/moko256/twitlatte/database/CachedListEntriesSQLiteOpenHelper.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/CachedListEntriesSQLiteOpenHelper.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/CachedListEntriesSQLiteOpenHelper.kt (date 1572095505349)
@@ -56,8 +56,7 @@
db.execSQL("create table $TABLE_NAME(${TABLE_COLUMNS.joinToString(",")})")
}
- override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
- }
+ override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {}
fun getListEntries(): List<ListEntry> {
try {
Index: app/src/main/java/com/github/moko256/twitlatte/GlobalApplication.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/GlobalApplication.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/GlobalApplication.kt (date 1572095323325)
@@ -51,16 +51,16 @@
private const val INTENT_CLIENT_KEY = "intent_client_key"
const val LIMIT_OF_SIZE_OF_STATUSES_LIST = 1000
-const val LIMIT_OF_SIZE_OF_OBJECT_CACHE = 250
+const val LIMIT_OF_SIZE_OF_OBJECT_CACHE = 100
lateinit var preferenceRepository: PreferenceRepository
class GlobalApplication : Application() {
- private val apiClientCache = LruCache<Int, ApiClient>(4)
+ private val apiClientCache = LruCache<Int, ApiClient>(1)
private val userCache = UserCacheMap()
private val statusCache = StatusCacheMap()
- private val friendshipCache = LruCache<Long, Friendship>(20)
+ private val friendshipCache = LruCache<Long, Friendship>(2)
internal var currentClient: Client? = null
internal lateinit var accountsModel: AccountsModel
@@ -142,7 +142,7 @@
generateMediaUrlConverter(it.clientType),
StatusCacheMap(),
UserCacheMap(),
- LruCache(20)
+ LruCache(2)
).apply {
val context = application.applicationContext
userCache.prepare(context, it)
Index: app/src/main/java/com/github/moko256/twitlatte/database/utils/TableDBUtil.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/utils/TableDBUtil.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/utils/TableDBUtil.kt (date 1572095728522)
@@ -16,7 +16,6 @@
package com.github.moko256.twitlatte.database.utils
-import android.database.SQLException
import android.database.sqlite.SQLiteDatabase
/**
@@ -64,15 +63,8 @@
builder.append(",primary key(")
keys.joinTo(builder, ",")
- builder.append("))")
- try {
- builder.append(" without rowId")
- execSQL(builder.toString())
- } catch (ignore: SQLException) {
- builder.delete(builder.length - 14, builder.length)
- execSQL(builder.toString())
- execSQL("create unique index ${tableName}_index on $tableName(${keys.joinToString(",")})")
- }
+ builder.append(")) without rowId")
+ execSQL(builder.toString())
}
fun SQLiteDatabase.addColumn(tableName: String, columnName: String, defaultValue: String? = null) {
Index: app/src/main/java/com/github/moko256/twitlatte/MainActivity.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/MainActivity.java (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/MainActivity.java (date 1572095999943)
@@ -20,7 +20,6 @@
import android.os.Build;
import android.os.Bundle;
import android.util.Pair;
-import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -28,7 +27,6 @@
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -280,12 +278,7 @@
if (savedInstanceState == null) {
prepareFragment();
}
-
- if (client.getAccessToken().getToken().isEmpty()) {
- Toast.makeText(this, R.string.please_re_login, Toast.LENGTH_LONG).show();
- }
}
-
}
@Override
@@ -379,26 +372,6 @@
}
}
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_N) {
- startActivity(new Intent(this, PostActivity.class));
- } else if (event.isShiftPressed() && keyCode == KeyEvent.KEYCODE_SLASH) {
- new AlertDialog.Builder(this)
- .setTitle("KeyBoard Shortcuts")
- .setMessage("? : This Dialog\nn : New Post\nCtrl + Tab : Open Drawer\nCtrl + Enter : Post")
- .show();
- } else if (drawer != null && event.isCtrlPressed() && keyCode == KeyEvent.KEYCODE_TAB) {
- if (drawer.isDrawerOpen(GravityCompat.START)) {
- drawer.closeDrawer(GravityCompat.START);
- } else {
- drawer.openDrawer(GravityCompat.START);
- }
- return true;
- }
- return super.onKeyDown(keyCode, event);
- }
-
@Override
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
}
Index: app/src/main/java/com/github/moko256/twitlatte/LicensesActivity.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/LicensesActivity.kt (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/LicensesActivity.kt (date 1572095625172)
@@ -42,13 +42,7 @@
intent?.also { intent ->
intent.getStringExtra("title")?.let {
actionBar.title = it
- }
-
- intent.getStringExtra("library_name")?.let {
- licenseTextView.text = assets
- .open("licenses/$it.txt")
- .reader()
- .readText()
+ licenseTextView.text = it
}
}
}
Index: app/src/main/java/com/github/moko256/twitlatte/database/CachedIdListSQLiteOpenHelper.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/java/com/github/moko256/twitlatte/database/CachedIdListSQLiteOpenHelper.java (date 1572095169000)
+++ app/src/main/java/com/github/moko256/twitlatte/database/CachedIdListSQLiteOpenHelper.java (date 1572095505338)
@@ -57,14 +57,7 @@
}
@Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- if (oldVersion < 2) {
- db.execSQL("drop table IdList");
- db.execSQL("drop table ListViewPosition");
- onCreate(db);
- }
- // else (oldVersion < 3) ...
- }
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {}
public List<Long> getIds() {
final long[] ids;
Index: app/src/main/res/values/strings.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/values/strings.xml (date 1572095169000)
+++ app/src/main/res/values/strings.xml (date 1572095625213)
@@ -115,7 +115,6 @@
<string name="tweet_per_last_24_hours">%d tweets / last 24 hours</string>
<string name="do_see_source_code">See source codes of this app</string>
<string name="description_see_source_code">Hosted on GitHub</string>
- <string name="please_re_login">twitlatte updated some API keys\nPlease login with this account again</string>
<string name="add_poll">Add poll</string>
<string name="vote_opening_status">%1$d votes - %2$s</string>
<string name="vote_closed_status">%d votes - closed</string>
Index: app/proguard-rules-release.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/proguard-rules-release.txt (date 1572095169000)
+++ app/proguard-rules-release.txt (date 1572095625232)
@@ -2,18 +2,16 @@
# see https://www.guardsquare.com/en/products/proguard/manual/usage/optimizations
--keepattributes SourceFile,LineNumberTable
-
-dontwarn org.ccil.cowan.tagsoup.Parser
-dontwarn com.fasterxml.jackson.databind.**
-assumevalues class android.os.Build$VERSION {
- int SDK_INT return 19..2147483647;
+ int SDK_INT return 28;
}
-assumevalues class com.google.android.exoplayer2.util.Util {
- int SDK_INT return 19..2147483647;
+ int SDK_INT return 28;
}
-assumenosideeffects public class android.util.Log {
//Before
2.12 MB (2,231,596 バイト)
//After
//26
1.96 MB (2,058,535 バイト) //Rev 1
1.80 MB (1,896,903 バイト) //Rev 2
1.80 MB (1,892,905 バイト) //Rev 3
//28
1.79 MB (1,884,679 バイト) //Rev 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment