他アプリから共有で投稿した後に画面を回転すると再度投稿画面を開いてしまう問題の修正。アプリ設定にクライアント名を追加。
This commit is contained in:
parent
7b5da59761
commit
e5626c5539
|
@ -400,7 +400,7 @@ public class ActAccountSetting extends AppCompatActivity
|
|||
} );
|
||||
|
||||
api_client.setAccount( account );
|
||||
return api_client.authorize1();
|
||||
return api_client.authorize1( Pref.pref(ActAccountSetting.this).getString(Pref.KEY_CLIENT_NAME,""));
|
||||
}
|
||||
|
||||
@Override protected void onPostExecute( TootApiResult result ){
|
||||
|
|
|
@ -125,6 +125,8 @@ public class ActAppSetting extends AppCompatActivity
|
|||
|
||||
EditText etColumnWidth;
|
||||
EditText etMediaThumbHeight;
|
||||
EditText etClientName;
|
||||
|
||||
|
||||
TextView tvTimelineFontUrl;
|
||||
String timeline_font;
|
||||
|
@ -274,12 +276,16 @@ public class ActAppSetting extends AppCompatActivity
|
|||
vIndicator = findViewById( R.id.vIndicator );
|
||||
|
||||
etColumnWidth = (EditText) findViewById( R.id.etColumnWidth );
|
||||
etColumnWidth.addTextChangedListener( this );
|
||||
|
||||
etMediaThumbHeight = (EditText) findViewById( R.id.etMediaThumbHeight );
|
||||
etMediaThumbHeight.addTextChangedListener( this );
|
||||
|
||||
etClientName = (EditText) findViewById( R.id.etClientName );
|
||||
etClientName.addTextChangedListener( this );
|
||||
|
||||
tvTimelineFontUrl = (TextView) findViewById( R.id.tvTimelineFontUrl );
|
||||
|
||||
etColumnWidth.addTextChangedListener( this );
|
||||
etMediaThumbHeight.addTextChangedListener( this );
|
||||
}
|
||||
|
||||
boolean load_busy;
|
||||
|
@ -325,7 +331,7 @@ public class ActAppSetting extends AppCompatActivity
|
|||
|
||||
etColumnWidth.setText( pref.getString( Pref.KEY_COLUMN_WIDTH, "" ) );
|
||||
etMediaThumbHeight.setText( pref.getString( Pref.KEY_MEDIA_THUMB_HEIGHT, "" ) );
|
||||
|
||||
etClientName.setText( pref.getString( Pref.KEY_CLIENT_NAME, "" ) );
|
||||
timeline_font = pref.getString( Pref.KEY_TIMELINE_FONT, "" );
|
||||
|
||||
load_busy = false;
|
||||
|
@ -373,6 +379,7 @@ public class ActAppSetting extends AppCompatActivity
|
|||
.putString( Pref.KEY_TIMELINE_FONT, timeline_font )
|
||||
.putString( Pref.KEY_COLUMN_WIDTH, etColumnWidth.getText().toString().trim() )
|
||||
.putString( Pref.KEY_MEDIA_THUMB_HEIGHT, etMediaThumbHeight.getText().toString().trim() )
|
||||
.putString( Pref.KEY_CLIENT_NAME, etClientName.getText().toString().trim() )
|
||||
|
||||
.apply();
|
||||
|
||||
|
|
|
@ -252,6 +252,7 @@ public class ActMain extends AppCompatActivity
|
|||
, getString( R.string.account_picker_toot )
|
||||
, new AccountPicker.AccountPickerCallback() {
|
||||
@Override public void onAccountPicked( @NonNull SavedAccount ai ){
|
||||
sent_intent2 = null;
|
||||
ActPost.open( ActMain.this, REQUEST_CODE_POST, ai.db_id, intent );
|
||||
}
|
||||
}
|
||||
|
@ -923,7 +924,7 @@ public class ActMain extends AppCompatActivity
|
|||
if( bPseudoAccount ){
|
||||
return api_client.checkInstance();
|
||||
}else{
|
||||
return api_client.authorize1();
|
||||
return api_client.authorize1( Pref.pref(ActMain.this).getString(Pref.KEY_CLIENT_NAME,""));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ public class AppDataExporter {
|
|||
case Pref.KEY_STREAM_LISTENER_CONFIG_URL:
|
||||
case Pref.KEY_STREAM_LISTENER_SECRET:
|
||||
case Pref.KEY_STREAM_LISTENER_CONFIG_DATA:
|
||||
case Pref.KEY_CLIENT_NAME:
|
||||
String sv = reader.nextString();
|
||||
e.putString( k, sv );
|
||||
break;
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.preference.PreferenceManager;
|
|||
|
||||
public class Pref {
|
||||
|
||||
|
||||
static SharedPreferences pref( Context context ){
|
||||
return PreferenceManager.getDefaultSharedPreferences( context );
|
||||
}
|
||||
|
@ -59,5 +58,8 @@ public class Pref {
|
|||
|
||||
static final String KEY_POST_BUTTON_BAR_AT_TOP = "post_button_bar_at_top";
|
||||
|
||||
static final String KEY_CLIENT_NAME = "client_name";
|
||||
|
||||
|
||||
// 項目を追加したらAppDataExporter#importPref のswitch文も更新すること
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ public class TootApiClient {
|
|||
}
|
||||
}
|
||||
|
||||
public @Nullable TootApiResult authorize1(){
|
||||
public @Nullable TootApiResult authorize1(String client_name){
|
||||
|
||||
JSONObject client_info;
|
||||
|
||||
|
@ -248,7 +248,9 @@ public class TootApiClient {
|
|||
|
||||
Response response;
|
||||
try{
|
||||
String client_name = "SubwayTooter"; // + UUID.randomUUID().toString();
|
||||
if( TextUtils.isEmpty( client_name )){
|
||||
client_name = "SubwayTooter";
|
||||
}
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url( "https://" + instance + "/api/v1/apps" )
|
||||
|
|
|
@ -73,7 +73,7 @@ public class AccountPicker {
|
|||
, String message
|
||||
, @NonNull final ArrayList< SavedAccount > account_list
|
||||
, @NonNull final AccountPickerCallback callback
|
||||
, @Nullable final DialogInterface.OnDismissListener dissmiss_callback
|
||||
, @Nullable final DialogInterface.OnDismissListener dismiss_callback
|
||||
){
|
||||
if( account_list.isEmpty() ){
|
||||
Utils.showToast( activity, false, R.string.account_empty );
|
||||
|
@ -110,8 +110,8 @@ public class AccountPicker {
|
|||
final Dialog dialog = new Dialog( activity );
|
||||
final AtomicBoolean isDialogClosed = new AtomicBoolean( false );
|
||||
|
||||
if( dissmiss_callback != null ){
|
||||
dialog.setOnDismissListener( dissmiss_callback );
|
||||
if( dismiss_callback != null ){
|
||||
dialog.setOnDismissListener( dismiss_callback );
|
||||
}
|
||||
|
||||
dialog.setContentView( viewRoot );
|
||||
|
@ -168,8 +168,8 @@ public class AccountPicker {
|
|||
b.setOnClickListener( new View.OnClickListener() {
|
||||
@Override public void onClick( View v ){
|
||||
isDialogClosed.set(true);
|
||||
dialog.dismiss();
|
||||
callback.onAccountPicked( _a );
|
||||
dialog.dismiss();
|
||||
}
|
||||
} );
|
||||
llAccounts.addView( b );
|
||||
|
|
|
@ -207,6 +207,23 @@
|
|||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/client_name"
|
||||
android:labelFor="@+id/etClientName"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etClientName"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:inputType="text"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<!-- =============================================== -->
|
||||
|
||||
|
|
|
@ -365,6 +365,7 @@
|
|||
<string name="text_to_speech_initialize_failed">TextToSpeech initializing failed. status=%1$s</string>
|
||||
<string name="text_to_speech_shutdown">TextToSpeech shutdown…</string>
|
||||
<string name="show_post_button_bar_top">Show buttons bar at the top of posting screen</string>
|
||||
<string name="client_name">Client name (access token update required)</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>-->
|
||||
|
|
|
@ -652,5 +652,6 @@
|
|||
<string name="text_to_speech_initialize_failed">TextToSpeechの初期化に失敗。status=%1$s</string>
|
||||
<string name="text_to_speech_shutdown">TextToSpeechの後処理…</string>
|
||||
<string name="show_post_button_bar_top">投稿画面のボタンバーを上端に表示</string>
|
||||
<string name="client_name">クライアント名(アクセストークンの更新が必要)</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -360,4 +360,5 @@
|
|||
<string name="text_to_speech_initialize_failed">TextToSpeech initializing failed. status=%1$s</string>
|
||||
<string name="text_to_speech_shutdown">TextToSpeech shutdown…</string>
|
||||
<string name="show_post_button_bar_top">Show buttons bar at the top of posting screen</string>
|
||||
<string name="client_name">Client name (access token update required)</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue