重複チェックヘッダを付与しない設定。簡略表示でフォントサイズ変更すると内部でnull例外が出てた問題の修正。

This commit is contained in:
tateisu 2017-07-22 06:45:38 +09:00
parent 33220676b1
commit db6db7c47c
10 changed files with 49 additions and 17 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "jp.juggler.subwaytooter"
minSdkVersion 21
targetSdkVersion 25
versionCode 99
versionName "0.9.9"
versionCode 100
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@ -96,6 +96,7 @@ public class ActAppSetting extends AppCompatActivity
Switch swDontCropMediaThumb;
Switch swPriorChrome;
Switch swPostButtonBarTop;
Switch swDontDuplicationCheck ;
Spinner spBackButtonAction;
Spinner spUITheme;
@ -187,6 +188,9 @@ public class ActAppSetting extends AppCompatActivity
swPostButtonBarTop = (Switch) findViewById( R.id.swPostButtonBarTop );
swPostButtonBarTop.setOnCheckedChangeListener( this );
swDontDuplicationCheck = (Switch) findViewById( R.id.swDontDuplicationCheck );
swDontDuplicationCheck.setOnCheckedChangeListener( this );
cbNotificationSound = (CheckBox) findViewById( R.id.cbNotificationSound );
cbNotificationVibration = (CheckBox) findViewById( R.id.cbNotificationVibration );
cbNotificationLED = (CheckBox) findViewById( R.id.cbNotificationLED );
@ -322,6 +326,7 @@ public class ActAppSetting extends AppCompatActivity
swDisableTabletMode.setChecked( pref.getBoolean( Pref.KEY_DISABLE_TABLET_MODE, false ) );
swDontCropMediaThumb.setChecked( pref.getBoolean( Pref.KEY_DONT_CROP_MEDIA_THUMBNAIL, false ) );
swPostButtonBarTop.setChecked( pref.getBoolean( Pref.KEY_POST_BUTTON_BAR_AT_TOP, false ) );
swDontDuplicationCheck.setChecked( pref.getBoolean( Pref.KEY_DONT_DUPLICATION_CHECK, false ) );
// Switch with default true
swDisableFastScroller.setChecked( pref.getBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, true ) );
@ -381,6 +386,8 @@ public class ActAppSetting extends AppCompatActivity
.putBoolean( Pref.KEY_DONT_CROP_MEDIA_THUMBNAIL, swDontCropMediaThumb.isChecked() )
.putBoolean( Pref.KEY_PRIOR_CHROME, swPriorChrome.isChecked() )
.putBoolean( Pref.KEY_POST_BUTTON_BAR_AT_TOP, swPostButtonBarTop.isChecked() )
.putBoolean( Pref.KEY_DONT_DUPLICATION_CHECK, swDontDuplicationCheck.isChecked() )
.putBoolean( Pref.KEY_NOTIFICATION_SOUND, cbNotificationSound.isChecked() )
.putBoolean( Pref.KEY_NOTIFICATION_VIBRATION, cbNotificationVibration.isChecked() )

View File

@ -395,7 +395,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
sv = intent.getStringExtra( KEY_REPLY_STATUS );
if( sv != null ){
try{
TootStatus reply_status = TootStatus.parse( log, account, account.host,new JSONObject( sv ) );
TootStatus reply_status = TootStatus.parse( log, account, account.host, new JSONObject( sv ) );
// CW をリプライ元に合わせる
if( ! TextUtils.isEmpty( reply_status.spoiler_text ) ){
@ -495,7 +495,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
handler.removeCallbacks( proc_text_changed );
closeAcctPopup();
super.onDestroy();
}
@Override
@ -896,7 +896,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
TootApiResult result = client.request( path );
if( result != null && result.object != null ){
TootResults tmp = TootResults.parse( log, access_info, access_info.host,result.object );
TootResults tmp = TootResults.parse( log, access_info, access_info.host, result.object );
if( tmp != null && tmp.statuses != null && ! tmp.statuses.isEmpty() ){
target_status = tmp.statuses.get( 0 );
}
@ -1600,12 +1600,15 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
.post( RequestBody.create(
TootApiClient.MEDIA_TYPE_FORM_URL_ENCODED
, post_content
) )
.header( "Idempotency-Key", digest );
) );
if( ! pref.getBoolean( Pref.KEY_DONT_DUPLICATION_CHECK, false ) ){
request_builder.header( "Idempotency-Key", digest );
}
TootApiResult result = client.request( "/api/v1/statuses", request_builder );
if( result != null && result.object != null ){
status = TootStatus.parse( log, account, account.host,result.object );
status = TootStatus.parse( log, account, account.host, result.object );
Spannable s = status.decoded_content;
MyClickableSpan[] span_list = s.getSpans( 0, s.length(), MyClickableSpan.class );
@ -2026,8 +2029,6 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
}
}
private void showRecommendedPlugin( String title ){
String language_code = getString( R.string.language_code );
int res_id;
@ -2038,7 +2039,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
}else{
res_id = R.raw.recommended_plugin_en;
}
byte[] data = Utils.loadRawResource(this,res_id);
byte[] data = Utils.loadRawResource( this, res_id );
if( data != null ){
String text = Utils.decodeUTF8( data );
@SuppressLint("InflateParams")

View File

@ -297,6 +297,7 @@ public class AppDataExporter {
case Pref.KEY_DONT_CROP_MEDIA_THUMBNAIL:
case Pref.KEY_PRIOR_CHROME:
case Pref.KEY_POST_BUTTON_BAR_AT_TOP:
case Pref.KEY_DONT_DUPLICATION_CHECK:
boolean bv = reader.nextBoolean();
e.putBoolean( k, bv );
break;

View File

@ -200,7 +200,9 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
tvContentWarning.setTextSize( activity.timeline_font_size_sp );
tvContent.setTextSize( activity.timeline_font_size_sp );
btnShowMedia.setTextSize( activity.timeline_font_size_sp );
tvApplication.setTextSize( activity.timeline_font_size_sp );
if(tvApplication != null){
tvApplication.setTextSize( activity.timeline_font_size_sp );
}
}

View File

@ -6,7 +6,6 @@ import android.preference.PreferenceManager;
public class Pref {
public static SharedPreferences pref( Context context ){
return PreferenceManager.getDefaultSharedPreferences( context );
}
@ -48,8 +47,7 @@ public class Pref {
static final String KEY_MEDIA_THUMB_HEIGHT = "MediaThumbHeight";
static final String KEY_TIMELINE_FONT = "timeline_font";
static final String KEY_DONT_CROP_MEDIA_THUMBNAIL = "DontCropMediaThumb";
static final String KEY_STREAM_LISTENER_SECRET = "stream_listener_secret";
static final String KEY_STREAM_LISTENER_CONFIG_URL = "stream_listener_config_url";
static final String KEY_STREAM_LISTENER_CONFIG_DATA = "stream_listener_config_data";
@ -58,7 +56,7 @@ public class Pref {
static final String KEY_PRIOR_CHROME = "prior_chrome";
static final String KEY_POST_BUTTON_BAR_AT_TOP = "post_button_bar_at_top";
static final String KEY_CLIENT_NAME = "client_name";
public static final String KEY_MASTODON_SEARCH_PORTAL_USER_TOKEN = "mastodon_search_portal_user_token";
@ -67,6 +65,8 @@ public class Pref {
public static final String KEY_TIMELINE_FONT_SIZE = "timeline_font_size";
public static final String KEY_ACCT_FONT_SIZE = "acct_font_size";
public static final String KEY_DONT_DUPLICATION_CHECK = "dont_duplication_check";
// 項目を追加したらAppDataExporter#importPref のswitch文も更新すること
}

View File

@ -287,6 +287,24 @@
</LinearLayout>
<View style="@style/setting_divider"/>
<TextView
style="@style/setting_row_label"
android:text="@string/dont_add_duplication_check_header"
/>
<LinearLayout style="@style/setting_row_form">
<Switch
android:id="@+id/swDontDuplicationCheck"
style="@style/setting_horizontal_stretch"
android:gravity="center"
/>
</LinearLayout>
<View style="@style/setting_divider"/>

View File

@ -387,6 +387,7 @@
<string name="notification_sound">Notification Sound</string>
<string name="timeline_font_size">Timeline font size (unit:sp. leave empty to default. app restart required)</string>
<string name="acct_font_size">Acct font size (unit:sp. leave empty to default. app restart required)</string>
<string name="dont_add_duplication_check_header">Don\'t add duplication check header</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

@ -674,5 +674,6 @@
<string name="notification_sound">通知音</string>
<string name="timeline_font_size">タイムラインのフォントサイズ(単位:sp。空欄でデフォルト。アプリ再起動が必要)</string>
<string name="acct_font_size">Acctのフォントサイズ(単位:sp。空欄でデフォルト。アプリ再起動が必要)</string>
<string name="dont_add_duplication_check_header">重複チェックヘッダを付与しない</string>
</resources>

View File

@ -382,5 +382,6 @@
<string name="notification_sound">Notification Sound</string>
<string name="timeline_font_size">Timeline font size (unit:sp. leave empty to default. app restart required)</string>
<string name="acct_font_size">Acct font size (unit:sp. leave empty to default. app restart required)</string>
<string name="dont_add_duplication_check_header">Don\'t add duplication check header</string>
</resources>