Android 7.0 のバグでHTTPS接続できない場合に免責情報を表示する

This commit is contained in:
tateisu 2017-05-16 03:47:18 +09:00
parent 20ad454595
commit 5a8579637d
5 changed files with 33 additions and 16 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "jp.juggler.subwaytooter"
minSdkVersion 21
targetSdkVersion 25
versionCode 56
versionName "0.5.6"
versionCode 57
versionName "0.5.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
@ -331,7 +332,7 @@ public class ActMain extends AppCompatActivity
}
}
}
}else if( requestCode == REQUEST_CODE_ACCOUNT_SETTING ){
updateColumnStrip();
@ -339,7 +340,7 @@ public class ActMain extends AppCompatActivity
for( Column column : app_state.column_list ){
column.fireShowColumnHeader();
}
if( data != null ){
startAccessTokenUpdate( data );
return;
@ -356,17 +357,17 @@ public class ActMain extends AppCompatActivity
}else if( requestCode == REQUEST_CODE_NICKNAME ){
updateColumnStrip();
for( Column column : app_state.column_list ){
column.fireShowColumnHeader();
}
}else if( requestCode == REQUEST_CODE_POST ){
if( data != null ){
posted_acct = data.getStringExtra( ActPost.EXTRA_POSTED_ACCT );
posted_status_id = data.getLongExtra( ActPost.EXTRA_POSTED_STATUS_ID, 0L );
}
}else if( requestCode == REQUEST_COLUMN_COLOR ){
if( data != null ){
app_state.saveColumnList();
@ -711,7 +712,7 @@ public class ActMain extends AppCompatActivity
///////tablet_pager.setHasFixedSize( true );
// tablet_pager.addItemDecoration( new TabletColumnDivider( this ) );
tablet_snap_helper =new GravitySnapHelper( Gravity.START );
tablet_snap_helper = new GravitySnapHelper( Gravity.START );
tablet_snap_helper.attachToRecyclerView( tablet_pager );
}
@ -851,9 +852,21 @@ public class ActMain extends AppCompatActivity
return;
}
log.e( result.error );
if( sv.contains( "SSLHandshakeException" )
&& ( Build.VERSION.RELEASE.startsWith( "7.0" )
|| ( Build.VERSION.RELEASE.startsWith( "7.1" ) && ! Build.VERSION.RELEASE.startsWith( "7.1." ) ) )
){
new AlertDialog.Builder( ActMain.this )
.setMessage( sv + "\n\n" + getString( R.string.ssl_bug_7_0 ) )
.setNeutralButton( R.string.close, null )
.show();
return;
}
// 他のエラー
Utils.showToast( ActMain.this, true, sv );
log.e( result.error );
}else{
SavedAccount a = addPseudoAccount( instance );
if( a != null ){
@ -974,7 +987,7 @@ public class ActMain extends AppCompatActivity
m = reUserPage.matcher( uri.toString() );
if( m.find() ){
// ユーザページをアプリ内で開く
// https://mastodon.juggler.jp/@SubwayTooter
final String host = m.group( 1 );
final String user = Uri.decode( m.group( 2 ) );
@ -1051,7 +1064,7 @@ public class ActMain extends AppCompatActivity
}
// OAuth2 認証コールバック
final ProgressDialog progress = new ProgressDialog( ActMain.this );
final AsyncTask< Void, Void, TootApiResult > task = new AsyncTask< Void, Void, TootApiResult >() {
@ -3021,7 +3034,7 @@ public class ActMain extends AppCompatActivity
}else{
for( int i = 0, ie = tablet_layout_manager.getChildCount() ; i < ie ; ++ i ){
View v = tablet_layout_manager.getChildAt( i );
TabletColumnViewHolder holder = (TabletColumnViewHolder) tablet_pager.getChildViewHolder(v);
TabletColumnViewHolder holder = (TabletColumnViewHolder) tablet_pager.getChildViewHolder( v );
if( holder != null && holder.vh.isColumnSettingShown() ){
holder.vh.closeColumnSetting();
return true;
@ -3141,13 +3154,13 @@ public class ActMain extends AppCompatActivity
// 最小幅で2つ表示できないのなら1カラム表示
tablet_pager_adapter.setColumnWidth( sw );
}else{
// カラム最小幅から計算した表示カラム数
nScreenColumn = sw / column_w_min;
if( nScreenColumn <= 0 ){
nScreenColumn = 1;
}
// データのカラム数より大きくならないようにする
// (でも最小は1)
int column_count = app_state.column_list.size();
@ -3156,7 +3169,7 @@ public class ActMain extends AppCompatActivity
nScreenColumn = column_count;
}
}
// 表示カラム数から計算したカラム幅
int column_w = sw / nScreenColumn;

View File

@ -315,6 +315,7 @@
<string name="word_was_muted">Ce mot a été interdit.</string>
<string name="your_statuses">Vos statuts</string>
<string name="launcher_icon_by">Icon de l\'application créée par フタバ</string>
<string name="ssl_bug_7_0">Android 7.0 has a bug that can use only one elliptic curve \"prime256v1\".\nBut the instance you will connect seems does not support it.\nIf you can update OS, this bug is fixed at Android 7.1.1.\nOr you can send request to instance owner to support elliptic curve \"prime256v1\".\nsee also https://code.google.com/p/android/issues/detail?id=224438</string>
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->

View File

@ -602,4 +602,6 @@
<string name="account_picker_reply">どのアカウントで返信しますか?</string>
<string name="reply_from_another_account">別アカウントで返信</string>
<string name="launcher_icon_by">ランチャーアイコンはフタバさんがデザインしました</string>
</resources>
<string name="ssl_bug_7_0">Android 7.0 には利用できる elliptic curve が \"prime256v1\" だけというバグがあります。\nしかし対象のインスタンスはこの elliptic curve に対応していないようです。\n可能ならOSバージョン 7.1.1以降にアップデートするとバグは修正されます。\nもしくは elliptic curve \"prime256v1\" に対応してもらうよう、あなたからインスタンスのオーナーに要望を出すことができます。\n関連情報 https://code.google.com/p/android/issues/detail?id=224438</string>
</resources>

View File

@ -312,4 +312,5 @@
<string name="account_picker_reply">Which account do you reply from?</string>
<string name="reply_from_another_account">Reply from another account</string>
<string name="launcher_icon_by">Launcher icon is designed by フタバ</string>
<string name="ssl_bug_7_0">Android 7.0 has a bug that can use only one elliptic curve \"prime256v1\".\nBut the instance you will connect seems does not support it.\nIf you can update OS, this bug is fixed at Android 7.1.1.\nOr you can send request to instance owner to support elliptic curve \"prime256v1\".\nsee also https://code.google.com/p/android/issues/detail?id=224438</string>
</resources>