2.4.1のリリースでトレンドタグAPIが除去された

This commit is contained in:
tateisu 2018-06-11 09:33:01 +09:00
parent d186076304
commit b0719af5c6
9 changed files with 36 additions and 28 deletions

View File

@ -13,6 +13,7 @@
<w>bumptech</w>
<w>codepoint</w>
<w>coroutine</w>
<w>coroutines</w>
<w>doctype</w>
<w>dont</w>
<w>emoji</w>
@ -34,6 +35,7 @@
<w>idempotency</w>
<w>ihdr</w>
<w>kenglxn</w>
<w>kotlinx</w>
<w>mailto</w>
<w>mimumedon</w>
<w>navi</w>

View File

@ -29,7 +29,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -12,8 +12,8 @@ android {
minSdkVersion 21
targetSdkVersion 27
versionCode 256
versionName "2.5.6"
versionCode 257
versionName "2.5.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// https://stackoverflow.com/questions/47791227/java-lang-illegalstateexception-dex-archives-setting-dex-extension-only-for
@ -74,8 +74,9 @@ dependencies {
implementation "com.android.support:customtabs:$asl_version"
implementation "com.android.support:support-v13:$asl_version"
implementation "com.google.firebase:firebase-core:$firebase_version"
implementation "com.google.firebase:firebase-messaging:$firebase_version"
// https://firebase.google.com/support/release-notes/android
implementation "com.google.firebase:firebase-core:16.0.0"
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

View File

@ -12,16 +12,14 @@ import org.json.JSONException
import org.json.JSONObject
import java.lang.ref.WeakReference
import java.util.ArrayList
import java.util.HashSet
import java.util.LinkedList
import java.util.Locale
import java.util.concurrent.atomic.AtomicBoolean
import java.util.regex.Pattern
import jp.juggler.subwaytooter.api.entity.*
import jp.juggler.subwaytooter.table.*
import jp.juggler.subwaytooter.util.*
import java.text.SimpleDateFormat
import java.util.*
enum class StreamingIndicatorState {
NONE,
@ -254,6 +252,12 @@ class Column(
val COLUMN_REGEX_FILTER_DEFAULT = { _ : CharSequence? -> false }
private val time_format_hhmm = SimpleDateFormat("HH:mm", Locale.getDefault())
private fun getResetTimeString() :String{
time_format_hhmm.timeZone = TimeZone.getDefault()
return time_format_hhmm.format(Date(0L))
}
}
private var callback_ref : WeakReference<Callback>? = null
@ -1268,7 +1272,7 @@ class Column(
client : TootApiClient,
bForceReload : Boolean
) : TootApiResult? {
if(bForceReload || this.who_account == null) {
return if(bForceReload || this.who_account == null) {
val result = client.request(String.format(Locale.JAPAN, PATH_ACCOUNT, profile_id))
val parser = TootParser(context, access_info)
val a = TootAccountRef.mayNull(parser, parser.account(result?.jsonObject))
@ -1276,9 +1280,9 @@ class Column(
this.who_account = a
client.publishApiProgress("") // カラムヘッダの再表示
}
return result
result
} else {
return null
null
}
}
@ -1886,13 +1890,14 @@ class Column(
TYPE_TREND_TAG -> {
result = client.request("/api/v1/trends")
val src = parser.trendTagList(result?.jsonArray)
// Gargron によるとレスポンスは既にソートされているらしい
// src.sortWith(Comparator { a, b ->
// val i = b.history.first().uses.compareTo(a.history.first().uses)
// if(i != 0) i else a.name.compareTo(b.name)
// })
this.list_tmp = addAll(this.list_tmp, src)
this.list_tmp = addOne(this.list_tmp,TootMessageHolder(context.getString(R.string.trend_tag_desc),gravity = Gravity.END))
this.list_tmp = addOne(
this.list_tmp, TootMessageHolder(
context.getString(R.string.trend_tag_desc,getResetTimeString()),
gravity = Gravity.END
)
)
return result
}
@ -1912,7 +1917,7 @@ class Column(
}
}
if( instance != null && instance.versionGE(TootInstance.VERSION_2_4_0)) {
if(instance != null && instance.versionGE(TootInstance.VERSION_2_4_0)) {
// v2 api を試す
var path = String.format(
Locale.JAPAN,
@ -1933,7 +1938,7 @@ class Column(
return result
}
}
if( instance.versionGE(TootInstance.VERSION_2_4_1_rc1)){
if(instance.versionGE(TootInstance.VERSION_2_4_1_rc1)) {
// 2.4.1rc1以降はv2が確実に存在するはずなので、v1へのフォールバックを行わない
return result
}

View File

@ -57,10 +57,11 @@
android:icon="?attr/ic_search"
android:title="@string/search"/>
<item
android:id="@+id/nav_add_trend_tag"
android:icon="?attr/ic_hashtag"
android:title="@string/trend_tag"/>
<!--トレンドタグは2.4.1リリース時にAPIごと削除された-->
<!--<item-->
<!--android:id="@+id/nav_add_trend_tag"-->
<!--android:icon="?attr/ic_hashtag"-->
<!--android:title="@string/trend_tag"/>-->
<item
android:id="@+id/nav_add_favourites"

View File

@ -680,7 +680,7 @@
<string name="follow_follower_list_may_restrict">If remote user chooses to hide the social graph, only the followings/followers on this instance will be displayed.</string>
<string name="trend_tag">Trending tags</string>
<string name="people_talking">%1$d(%2$d) people talking</string>
<string name="trend_tag_desc">The numbers indicate \'daily(weekly)\'. Daily numbers are reset at 0:00 UTC.</string>
<string name="trend_tag_desc">The numbers indicate \'daily(weekly)\'. Daily numbers are reset at %1$s.</string>
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->

View File

@ -958,6 +958,6 @@
<string name="follow_follower_list_may_restrict">もしリモートのユーザがソーシャルグラフを隠す選択をした場合、表示されるのはこのタンスのユーザだけです。</string>
<string name="trend_tag">トレンドタグ</string>
<string name="people_talking">%1$d(%2$d)人がトゥート</string>
<string name="trend_tag_desc">数字は「日毎(週毎)」を示します。 日毎の数字は0:00(UTC)にリセットされます。</string>
<string name="trend_tag_desc">数字は「日毎(週毎)」を示します。 日毎の数字は%1$sにリセットされます。</string>
</resources>

View File

@ -665,5 +665,5 @@
<string name="follow_follower_list_may_restrict">If remote user chooses to hide the social graph, only the followings/followers on this instance will be displayed.</string>
<string name="trend_tag">Trending tags</string>
<string name="people_talking">%1$d(%2$d) people talking</string>
<string name="trend_tag_desc">The numbers indicate \'daily(weekly)\'. Daily numbers are reset at 0:00 UTC.</string>
<string name="trend_tag_desc">The numbers indicate \'daily(weekly)\'. Daily numbers are reset at %1$s.</string>
</resources>

View File

@ -4,7 +4,6 @@ buildscript {
ext.kotlin_coroutines_version = '0.21.2'
ext.anko_version='0.10.4'
ext.asl_version='27.1.1'
ext.firebase_version='15.0.2' // https://firebase.google.com/support/release-notes/android
repositories {
jcenter()