v1.4.5
- onResume,onPauseではなくonStart,onStopのタイミングで再取得とストリーミング開始を行うようにした - ブースト/ブースト解除のメッセージが入れ替わっていた - アカウント設定でアカウントを削除した時にトゥート検索カラムが消えることがあった
This commit is contained in:
parent
e853d1ad4f
commit
4e4a73042e
|
@ -9,8 +9,8 @@ android {
|
|||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 144
|
||||
versionName "1.4.4"
|
||||
versionCode 145
|
||||
versionName "1.4.5-beta"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="jp.juggler.subwaytooter">
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="jp.juggler.subwaytooter"
|
||||
>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
|
@ -11,12 +13,12 @@
|
|||
<application
|
||||
android:name=".App1"
|
||||
android:allowBackup="true"
|
||||
android:fullBackupContent="@xml/backup_spec"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.Light"
|
||||
android:largeHeap="true"
|
||||
android:fullBackupContent="@xml/backup_spec"
|
||||
>
|
||||
|
||||
<receiver android:name=".EventReceiver">
|
||||
|
@ -67,7 +69,8 @@
|
|||
|
||||
<data
|
||||
android:host="oauth"
|
||||
android:scheme="subwaytooter"/>
|
||||
android:scheme="subwaytooter"
|
||||
/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
|
@ -79,7 +82,8 @@
|
|||
<data
|
||||
android:host="*"
|
||||
android:pathPrefix="/@"
|
||||
android:scheme="https"/>
|
||||
android:scheme="https"
|
||||
/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- https://mstdn.kemono-friends.info/users/tocchi/updates/695489 -->
|
||||
|
@ -178,24 +182,27 @@
|
|||
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"
|
||||
/>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".ActText"
|
||||
android:label="@string/select_and_copy"
|
||||
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"
|
||||
/>
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="100.0"/>
|
||||
android:value="100.0"
|
||||
/>
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="jp.juggler.subwaytooter.FileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
>
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_provider_path" />
|
||||
android:resource="@xml/file_provider_path"
|
||||
/>
|
||||
</provider>
|
||||
|
||||
<!-- okhttp3クライアントを指定する必要があるため、マニフェスト経由での組み込みは行わない -->
|
||||
|
@ -221,13 +228,15 @@
|
|||
See README(https://goo.gl/l4GJaQ) for more. -->
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@drawable/ic_notification" />
|
||||
android:resource="@drawable/ic_notification"
|
||||
/>
|
||||
|
||||
<!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
|
||||
notification message. See README(https://goo.gl/6BKBk7) for more. -->
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/Light_colorAccent" />
|
||||
android:resource="@color/Light_colorAccent"
|
||||
/>
|
||||
|
||||
</application>
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -58,8 +57,6 @@ import java.io.InputStreamReader;
|
|||
import java.io.Reader;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -184,6 +181,7 @@ public class ActMain extends AppCompatActivity
|
|||
static final String STATE_CURRENT_PAGE = "current_page";
|
||||
|
||||
@Override protected void onSaveInstanceState( Bundle outState ){
|
||||
log.d("onSaveInstanceState");
|
||||
super.onSaveInstanceState( outState );
|
||||
|
||||
if( pager_adapter != null ){
|
||||
|
@ -197,6 +195,7 @@ public class ActMain extends AppCompatActivity
|
|||
}
|
||||
|
||||
@Override protected void onRestoreInstanceState( Bundle savedInstanceState ){
|
||||
log.d("onRestoreInstanceState");
|
||||
super.onRestoreInstanceState( savedInstanceState );
|
||||
int pos = savedInstanceState.getInt( STATE_CURRENT_PAGE );
|
||||
if( pos > 0 && pos < app_state.column_list.size() ){
|
||||
|
@ -208,16 +207,90 @@ public class ActMain extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
|
||||
boolean bResume;
|
||||
boolean bStart;
|
||||
|
||||
@Override public boolean isActivityStart(){
|
||||
return bStart;
|
||||
}
|
||||
|
||||
@Override protected void onStart(){
|
||||
super.onStart();
|
||||
|
||||
bStart = true;
|
||||
log.d( "onStart" );
|
||||
|
||||
// アカウント設定から戻ってきたら、カラムを消す必要があるかもしれない
|
||||
{
|
||||
ArrayList< Integer > new_order = new ArrayList<>();
|
||||
for( int i = 0, ie = app_state.column_list.size() ; i < ie ; ++ i ){
|
||||
Column column = app_state.column_list.get( i );
|
||||
|
||||
if( ! column.access_info.isNA() ){
|
||||
SavedAccount sa = SavedAccount.loadAccount( ActMain.this, log, column.access_info.db_id );
|
||||
if( sa == null ) continue;
|
||||
}
|
||||
|
||||
new_order.add( i );
|
||||
}
|
||||
|
||||
if( new_order.size() != app_state.column_list.size() ){
|
||||
setOrder( new_order );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 各カラムのアカウント設定を読み直す
|
||||
reloadAccountSetting();
|
||||
|
||||
// 投稿直後ならカラムの再取得を行う
|
||||
refreshAfterPost();
|
||||
|
||||
// 外部から受け取ったUriの処理
|
||||
Uri uri = ActCallback.last_uri.getAndSet( null );
|
||||
if( uri != null ){
|
||||
handleIntentUri( uri );
|
||||
}
|
||||
|
||||
// 外部から受け取ったUriの処理
|
||||
Intent intent = ActCallback.sent_intent.getAndSet( null );
|
||||
if( intent != null ){
|
||||
handleSentIntent( intent );
|
||||
}
|
||||
|
||||
// 画面復帰時に再取得やストリーミング開始を行う
|
||||
for( Column column : app_state.column_list ){
|
||||
column.onStart( this );
|
||||
}
|
||||
|
||||
// カラムの表示範囲インジケータを更新
|
||||
updateColumnStripSelection( - 1, - 1f );
|
||||
|
||||
// 相対時刻表示
|
||||
proc_updateRelativeTime.run();
|
||||
|
||||
}
|
||||
|
||||
@Override protected void onStop(){
|
||||
|
||||
log.d( "onStop" );
|
||||
|
||||
bStart = false;
|
||||
|
||||
handler.removeCallbacks( proc_updateRelativeTime );
|
||||
|
||||
post_helper.closeAcctPopup();
|
||||
|
||||
closeListItemPopup();
|
||||
|
||||
app_state.stream_reader.stopAll();
|
||||
|
||||
super.onStop();
|
||||
|
||||
@Override public boolean isActivityResume(){
|
||||
return bResume;
|
||||
}
|
||||
|
||||
@Override protected void onResume(){
|
||||
bResume = true;
|
||||
log.d( "onResume" );
|
||||
super.onResume();
|
||||
log.d( "onResume" );
|
||||
|
||||
MyClickableSpan.link_callback = new WeakReference<>( link_click_listener );
|
||||
|
||||
|
@ -226,53 +299,22 @@ public class ActMain extends AppCompatActivity
|
|||
}else{
|
||||
getWindow().clearFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON );
|
||||
}
|
||||
}
|
||||
|
||||
// アカウント設定から戻ってきたら、カラムを消す必要があるかもしれない
|
||||
{
|
||||
@Override protected void onPause(){
|
||||
log.d( "onPause" );
|
||||
|
||||
ArrayList< Integer > new_order = new ArrayList<>();
|
||||
boolean bRemoved = false;
|
||||
for( int i = 0, ie = app_state.column_list.size() ; i < ie ; ++ i ){
|
||||
Column column = app_state.column_list.get( i );
|
||||
|
||||
if( column.access_info.isNA() ){
|
||||
// 検索カラムはアカウント削除とか無関係
|
||||
// 最後に表示していたカラムの位置
|
||||
int column_pos;
|
||||
if( pager_adapter != null ){
|
||||
column_pos = pager.getCurrentItem();
|
||||
}else{
|
||||
SavedAccount sa = SavedAccount.loadAccount( ActMain.this, log, column.access_info.db_id );
|
||||
if( sa == null ){
|
||||
bRemoved = true;
|
||||
}else{
|
||||
new_order.add( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( bRemoved ){
|
||||
setOrder( new_order );
|
||||
}
|
||||
column_pos = tablet_layout_manager.findFirstVisibleItemPosition();
|
||||
}
|
||||
pref.edit().putInt( Pref.KEY_LAST_COLUMN_POS, column_pos ).apply();
|
||||
|
||||
// 各カラムのアカウント設定を読み直す
|
||||
reloadAccountSetting();
|
||||
|
||||
refreshAfterPost();
|
||||
|
||||
Uri uri = ActCallback.last_uri.getAndSet( null );
|
||||
if( uri != null ){
|
||||
handleIntentUri( uri );
|
||||
}
|
||||
|
||||
Intent intent = ActCallback.sent_intent.getAndSet( null );
|
||||
if( intent != null ){
|
||||
handleSentIntent( intent );
|
||||
}
|
||||
|
||||
for( Column column : app_state.column_list ){
|
||||
column.onResume( this );
|
||||
}
|
||||
|
||||
updateColumnStripSelection( - 1, - 1f );
|
||||
|
||||
proc_updateRelativeTime.run();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
void refreshAfterPost(){
|
||||
|
@ -326,28 +368,7 @@ public class ActMain extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
|
||||
@Override protected void onPause(){
|
||||
bResume = false;
|
||||
|
||||
handler.removeCallbacks( proc_updateRelativeTime );
|
||||
|
||||
post_helper.closeAcctPopup();
|
||||
|
||||
// 最後に表示していたカラムの位置
|
||||
int column_pos;
|
||||
if( pager_adapter != null ){
|
||||
column_pos = pager.getCurrentItem();
|
||||
}else{
|
||||
column_pos = tablet_layout_manager.findFirstVisibleItemPosition();
|
||||
}
|
||||
pref.edit().putInt( Pref.KEY_LAST_COLUMN_POS, column_pos ).apply();
|
||||
|
||||
closeListItemPopup();
|
||||
|
||||
app_state.stream_reader.onPause();
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override public void onClick( View v ){
|
||||
switch( v.getId() ){
|
||||
|
@ -812,8 +833,8 @@ public class ActMain extends AppCompatActivity
|
|||
{
|
||||
float icon_size_dp = 48f;
|
||||
try{
|
||||
sv = pref.getString( Pref.KEY_AVATAR_ICON_SIZE, "48" );
|
||||
float fv = Float.parseFloat( sv );
|
||||
sv = pref.getString( Pref.KEY_AVATAR_ICON_SIZE, null );
|
||||
float fv = TextUtils.isEmpty( sv ) ? Float.NaN : Float.parseFloat( sv );
|
||||
if( Float.isNaN( fv ) || Float.isInfinite( fv ) || fv < 1f ){
|
||||
// error or bad range
|
||||
}else{
|
||||
|
@ -4641,7 +4662,7 @@ public class ActMain extends AppCompatActivity
|
|||
private final Runnable proc_updateRelativeTime = new Runnable() {
|
||||
@Override public void run(){
|
||||
handler.removeCallbacks( proc_updateRelativeTime );
|
||||
if( ! bResume ) return;
|
||||
if( ! bStart ) return;
|
||||
for( Column c : app_state.column_list ){
|
||||
c.fireShowContent();
|
||||
}
|
||||
|
|
|
@ -59,22 +59,22 @@ class Column implements StreamReader.Callback {
|
|||
private static final LogCategory log = new LogCategory( "Column" );
|
||||
|
||||
interface Callback {
|
||||
boolean isActivityResume();
|
||||
boolean isActivityStart();
|
||||
}
|
||||
|
||||
private WeakReference< Callback > callback_ref;
|
||||
|
||||
private boolean isResume(){
|
||||
private boolean isActivityStart(){
|
||||
if( callback_ref == null ){
|
||||
log.d( "isResume: callback_ref is not set" );
|
||||
log.d( "isActivityStart: callback_ref is not set" );
|
||||
return false;
|
||||
}
|
||||
Callback cb = callback_ref.get();
|
||||
if( cb == null ){
|
||||
log.d( "isResume: callback was lost." );
|
||||
log.d( "isActivityStart: callback was lost." );
|
||||
return false;
|
||||
}
|
||||
return cb.isActivityResume();
|
||||
return cb.isActivityStart();
|
||||
}
|
||||
|
||||
private static Object getParamAt( Object[] params, int idx ){
|
||||
|
@ -3218,7 +3218,7 @@ class Column implements StreamReader.Callback {
|
|||
}
|
||||
}
|
||||
|
||||
void onResume( Callback callback ){
|
||||
void onStart( Callback callback ){
|
||||
this.callback_ref = new WeakReference<>( callback );
|
||||
|
||||
// 破棄されたカラムなら何もしない
|
||||
|
@ -3320,8 +3320,8 @@ class Column implements StreamReader.Callback {
|
|||
return;
|
||||
}
|
||||
|
||||
if( ! isResume() ){
|
||||
log.d( "resumeStreaming: not resumed." );
|
||||
if( ! isActivityStart() ){
|
||||
log.d( "resumeStreaming: isActivityStart is false." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ class ColumnViewHolder
|
|||
if( isChecked ){
|
||||
column.stopStreaming();
|
||||
}else{
|
||||
column.onResume( activity );
|
||||
column.onStart( activity );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class StatusButtons implements View.OnClickListener, View.OnLongClickListener {
|
|||
, ActMain.NOT_CROSS_ACCOUNT
|
||||
, ! status.reblogged
|
||||
, false
|
||||
, !bSimpleList ? null : status.reblogged ? activity.boost_complete_callback : activity.unboost_complete_callback
|
||||
, !bSimpleList ? null : status.reblogged ? activity.unboost_complete_callback : activity.boost_complete_callback
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -238,7 +238,7 @@ class StreamReader {
|
|||
}
|
||||
|
||||
// onPauseのタイミングで全てのStreaming接続を破棄する
|
||||
void onPause(){
|
||||
void stopAll(){
|
||||
synchronized( reader_list ){
|
||||
for( Reader reader : reader_list ){
|
||||
reader.dispose();
|
||||
|
|
Loading…
Reference in New Issue