- クラッシュ対応。 dialog.dismiss()がたまにIllegalArgumentExceptionを出すことがある
- カラム設定でAcctと本文の文字色を変更可能に
This commit is contained in:
parent
4ee8175168
commit
83b65b8eae
|
@ -9,8 +9,8 @@ android {
|
|||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 25
|
||||
versionCode 113
|
||||
versionName "1.1.3"
|
||||
versionCode 114
|
||||
versionName "1.1.4"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ public class ActAccountSetting extends AppCompatActivity
|
|||
private void showAcctColor(){
|
||||
AcctColor ac = AcctColor.load( full_acct );
|
||||
tvUserCustom.setText( ac != null && ! TextUtils.isEmpty( ac.nickname ) ? ac.nickname : full_acct );
|
||||
tvUserCustom.setTextColor( ac != null && ac.color_fg != 0 ? ac.color_fg : Styler.getAttributeColor( this, R.attr.colorAcctSmall ) );
|
||||
tvUserCustom.setTextColor( ac != null && ac.color_fg != 0 ? ac.color_fg : Styler.getAttributeColor( this, R.attr.colorTimeSmall ) );
|
||||
tvUserCustom.setBackgroundColor( ac != null && ac.color_bg != 0 ? ac.color_bg : 0 );
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
static final int COLOR_DIALOG_ID_HEADER_BACKGROUND = 1;
|
||||
static final int COLOR_DIALOG_ID_HEADER_FOREGROUND = 2;
|
||||
static final int COLOR_DIALOG_ID_COLUMN_BACKGROUND = 3;
|
||||
static final int COLOR_DIALOG_ID_ACCT_TEXT = 4;
|
||||
static final int COLOR_DIALOG_ID_CONTENT_TEXT = 5;
|
||||
|
||||
@Override public void onClick( View v ){
|
||||
ColorPickerDialog.Builder builder;
|
||||
|
@ -130,6 +132,38 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
show();
|
||||
break;
|
||||
|
||||
case R.id.btnAcctColor:
|
||||
builder = ColorPickerDialog.newBuilder()
|
||||
.setDialogType( ColorPickerDialog.TYPE_CUSTOM )
|
||||
.setAllowPresets( true )
|
||||
.setShowAlphaSlider( true )
|
||||
.setDialogId( COLOR_DIALOG_ID_ACCT_TEXT )
|
||||
;
|
||||
if( column.acct_color != 0 ) builder.setColor( column.acct_color );
|
||||
builder.show( this );
|
||||
break;
|
||||
|
||||
case R.id.btnAcctColorReset:
|
||||
column.acct_color = 0;
|
||||
show();
|
||||
break;
|
||||
|
||||
case R.id.btnContentColor:
|
||||
builder = ColorPickerDialog.newBuilder()
|
||||
.setDialogType( ColorPickerDialog.TYPE_CUSTOM )
|
||||
.setAllowPresets( true )
|
||||
.setShowAlphaSlider( true )
|
||||
.setDialogId( COLOR_DIALOG_ID_CONTENT_TEXT )
|
||||
;
|
||||
if( column.content_color != 0 ) builder.setColor( column.content_color );
|
||||
builder.show( this );
|
||||
break;
|
||||
|
||||
case R.id.btnContentColorReset:
|
||||
column.content_color = 0;
|
||||
show();
|
||||
break;
|
||||
|
||||
case R.id.btnColumnBackgroundImage:
|
||||
Intent intent = new Intent( Intent.ACTION_OPEN_DOCUMENT );
|
||||
intent.addCategory( Intent.CATEGORY_OPENABLE );
|
||||
|
@ -155,6 +189,14 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
case COLOR_DIALOG_ID_COLUMN_BACKGROUND:
|
||||
column.column_bg_color = 0xff000000 | color;
|
||||
break;
|
||||
case COLOR_DIALOG_ID_ACCT_TEXT:
|
||||
if( color == 0 ) color = 1;
|
||||
column.acct_color = color;
|
||||
break;
|
||||
case COLOR_DIALOG_ID_CONTENT_TEXT:
|
||||
if( color == 0 ) color = 1;
|
||||
column.content_color = color;
|
||||
break;
|
||||
}
|
||||
show();
|
||||
}
|
||||
|
@ -184,9 +226,13 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
ImageView ivColumnHeader;
|
||||
TextView tvColumnName;
|
||||
EditText etAlpha;
|
||||
TextView tvSampleAcct;
|
||||
TextView tvSampleContent;
|
||||
|
||||
static final int PROGRESS_MAX = 65536;
|
||||
|
||||
int content_color_default;
|
||||
|
||||
private void initUI(){
|
||||
setContentView( R.layout.act_column_customize );
|
||||
|
||||
|
@ -200,6 +246,10 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
findViewById( R.id.btnColumnBackgroundColorReset ).setOnClickListener( this );
|
||||
findViewById( R.id.btnColumnBackgroundImage ).setOnClickListener( this );
|
||||
findViewById( R.id.btnColumnBackgroundImageReset ).setOnClickListener( this );
|
||||
findViewById( R.id.btnAcctColor ).setOnClickListener( this );
|
||||
findViewById( R.id.btnAcctColorReset ).setOnClickListener( this );
|
||||
findViewById( R.id.btnContentColor ).setOnClickListener( this );
|
||||
findViewById( R.id.btnContentColorReset ).setOnClickListener( this );
|
||||
|
||||
llColumnHeader = findViewById( R.id.llColumnHeader );
|
||||
ivColumnHeader = (ImageView) findViewById( R.id.ivColumnHeader );
|
||||
|
@ -207,6 +257,10 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
|
||||
flColumnBackground = findViewById( R.id.flColumnBackground );
|
||||
ivColumnBackground = (ImageView) findViewById( R.id.ivColumnBackground );
|
||||
tvSampleAcct = (TextView) findViewById( R.id.tvSampleAcct );
|
||||
tvSampleContent = (TextView) findViewById( R.id.tvSampleContent );
|
||||
|
||||
content_color_default = tvSampleContent.getTextColors().getDefaultColor();
|
||||
|
||||
sbColumnBackgroundAlpha = (SeekBar) findViewById( R.id.sbColumnBackgroundAlpha );
|
||||
sbColumnBackgroundAlpha.setMax( PROGRESS_MAX );
|
||||
|
@ -225,7 +279,7 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
if( ! fromUser ) return;
|
||||
column.column_bg_image_alpha = progress / (float) PROGRESS_MAX;
|
||||
ivColumnBackground.setAlpha( column.column_bg_image_alpha );
|
||||
etAlpha.setText( String.format( Locale.getDefault() , "%.4f", column.column_bg_image_alpha ) );
|
||||
etAlpha.setText( String.format( Locale.getDefault(), "%.4f", column.column_bg_image_alpha ) );
|
||||
}
|
||||
|
||||
} );
|
||||
|
@ -304,6 +358,14 @@ public class ActColumnCustomize extends AppCompatActivity
|
|||
etAlpha.setText( String.format( Locale.getDefault(), "%.4f", column.column_bg_image_alpha ) );
|
||||
|
||||
loadImage( ivColumnBackground, column.column_bg_image );
|
||||
|
||||
c = column.acct_color != 0 ? column.acct_color : Styler.getAttributeColor( this, R.attr.colorTimeSmall );
|
||||
tvSampleAcct.setTextColor( c );
|
||||
|
||||
c = column.content_color != 0 ?column.content_color : content_color_default;
|
||||
tvSampleContent.setTextColor( c );
|
||||
|
||||
|
||||
}finally{
|
||||
loading_busy = false;
|
||||
}
|
||||
|
|
|
@ -489,13 +489,13 @@ public class ActMain extends AppCompatActivity
|
|||
app_state.saveColumnList();
|
||||
int idx = data.getIntExtra( ActColumnCustomize.EXTRA_COLUMN_INDEX, 0 );
|
||||
if( idx >= 0 && idx < app_state.column_list.size() ){
|
||||
app_state.column_list.get( idx ).fireColumnColor();
|
||||
app_state.column_list.get( idx ).fireShowContent();
|
||||
}
|
||||
updateColumnStrip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( requestCode == REQUEST_CODE_ACCOUNT_SETTING ){
|
||||
updateColumnStrip();
|
||||
|
||||
|
@ -505,8 +505,8 @@ public class ActMain extends AppCompatActivity
|
|||
|
||||
if( resultCode == RESULT_OK && data != null ){
|
||||
startAccessTokenUpdate( data );
|
||||
}else if( resultCode == ActAccountSetting.RESULT_INPUT_ACCESS_TOKEN && data != null){
|
||||
long db_id = data.getLongExtra( ActAccountSetting.EXTRA_DB_ID,-1L );
|
||||
}else if( resultCode == ActAccountSetting.RESULT_INPUT_ACCESS_TOKEN && data != null ){
|
||||
long db_id = data.getLongExtra( ActAccountSetting.EXTRA_DB_ID, - 1L );
|
||||
checkAccessToken2( db_id );
|
||||
}
|
||||
}else if( requestCode == REQUEST_CODE_APP_SETTING ){
|
||||
|
@ -1097,8 +1097,9 @@ public class ActMain extends AppCompatActivity
|
|||
if( bInputAccessToken ){
|
||||
// アクセストークンの手動入力
|
||||
DlgAccessToken.show( ActMain.this, new DlgAccessToken.Callback() {
|
||||
@Override public void startCheck( Dialog dialog_token, String access_token ){
|
||||
checkAccessToken( dialog,dialog_token,instance,access_token ,null);
|
||||
@Override
|
||||
public void startCheck( Dialog dialog_token, String access_token ){
|
||||
checkAccessToken( dialog, dialog_token, instance, access_token, null );
|
||||
}
|
||||
} );
|
||||
}else{
|
||||
|
@ -1106,7 +1107,11 @@ public class ActMain extends AppCompatActivity
|
|||
Intent data = new Intent();
|
||||
data.setData( Uri.parse( sv ) );
|
||||
startAccessTokenUpdate( data );
|
||||
dialog.dismiss();
|
||||
try{
|
||||
dialog.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1133,7 +1138,11 @@ public class ActMain extends AppCompatActivity
|
|||
Utils.showToast( ActMain.this, false, R.string.server_confirmed );
|
||||
int pos = app_state.column_list.size();
|
||||
addColumn( pos, a, Column.TYPE_LOCAL );
|
||||
dialog.dismiss();
|
||||
try{
|
||||
dialog.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1382,7 +1391,7 @@ public class ActMain extends AppCompatActivity
|
|||
// at android.app.Dialog.dismiss(Dialog.java:529)
|
||||
}
|
||||
|
||||
afterAccountVerify( result,ta,sa,host );
|
||||
afterAccountVerify( result, ta, sa, host );
|
||||
}
|
||||
};
|
||||
progress.setIndeterminate( true );
|
||||
|
@ -1397,7 +1406,7 @@ public class ActMain extends AppCompatActivity
|
|||
task.executeOnExecutor( App1.task_executor );
|
||||
}
|
||||
|
||||
boolean afterAccountVerify( @Nullable TootApiResult result, @Nullable TootAccount ta, @Nullable SavedAccount sa, @Nullable String host){
|
||||
boolean afterAccountVerify( @Nullable TootApiResult result, @Nullable TootAccount ta, @Nullable SavedAccount sa, @Nullable String host ){
|
||||
//noinspection StatementWithEmptyBody
|
||||
if( result == null ){
|
||||
// cancelled.
|
||||
|
@ -1476,14 +1485,14 @@ public class ActMain extends AppCompatActivity
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// アクセストークンを手動で入力した場合
|
||||
void checkAccessToken(
|
||||
@Nullable final Dialog dialog_host
|
||||
, @Nullable final Dialog dialog_token
|
||||
, @NonNull final String host
|
||||
, @NonNull final String access_token
|
||||
, @Nullable final SavedAccount sa
|
||||
, @Nullable final SavedAccount sa
|
||||
){
|
||||
|
||||
final ProgressDialog progress = new ProgressDialog( ActMain.this );
|
||||
|
@ -1538,12 +1547,19 @@ public class ActMain extends AppCompatActivity
|
|||
// at android.app.Dialog.dismiss(Dialog.java:529)
|
||||
}
|
||||
|
||||
if( afterAccountVerify( result,ta,sa,host ) ){
|
||||
if(dialog_host!=null ) dialog_host.dismiss();
|
||||
if(dialog_token!=null ) dialog_token.dismiss();
|
||||
if( afterAccountVerify( result, ta, sa, host ) ){
|
||||
try{
|
||||
if( dialog_host != null ) dialog_host.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
try{
|
||||
if( dialog_token != null ) dialog_token.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
progress.setIndeterminate( true );
|
||||
|
@ -1559,16 +1575,16 @@ public class ActMain extends AppCompatActivity
|
|||
}
|
||||
|
||||
// アクセストークンの手動入力(更新)
|
||||
void checkAccessToken2(long db_id){
|
||||
|
||||
final SavedAccount sa = SavedAccount.loadAccount( this,log,db_id );
|
||||
void checkAccessToken2( long db_id ){
|
||||
|
||||
final SavedAccount sa = SavedAccount.loadAccount( this, log, db_id );
|
||||
if( sa == null ) return;
|
||||
|
||||
DlgAccessToken.show( this, new DlgAccessToken.Callback() {
|
||||
@Override public void startCheck( Dialog dialog_token, String access_token ){
|
||||
checkAccessToken( null, dialog_token, sa.host, access_token ,sa);
|
||||
checkAccessToken( null, dialog_token, sa.host, access_token, sa );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
void reloadAccountSetting(){
|
||||
|
@ -3607,7 +3623,11 @@ public class ActMain extends AppCompatActivity
|
|||
@Override public void onReportComplete( TootApiResult result ){
|
||||
|
||||
// 成功したらダイアログを閉じる
|
||||
dialog.dismiss();
|
||||
try{
|
||||
dialog.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
Utils.showToast( ActMain.this, false, R.string.report_completed );
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -156,7 +156,7 @@ public class ActNickname extends AppCompatActivity implements View.OnClickListen
|
|||
int c;
|
||||
|
||||
c = color_fg;
|
||||
if( c == 0 ) c = Styler.getAttributeColor( this, R.attr.colorAcctSmall );
|
||||
if( c == 0 ) c = Styler.getAttributeColor( this, R.attr.colorTimeSmall );
|
||||
tvPreview.setTextColor( c );
|
||||
|
||||
c = color_bg;
|
||||
|
|
|
@ -133,6 +133,8 @@ class Column implements StreamReader.Callback {
|
|||
private static final String KEY_HEADER_BACKGROUND_COLOR = "header_background_color";
|
||||
private static final String KEY_HEADER_TEXT_COLOR = "header_text_color";
|
||||
private static final String KEY_COLUMN_BACKGROUND_COLOR = "column_background_color";
|
||||
private static final String KEY_COLUMN_ACCT_TEXT_COLOR = "column_acct_text_color";
|
||||
private static final String KEY_COLUMN_CONTENT_TEXT_COLOR = "column_content_text_color";
|
||||
private static final String KEY_COLUMN_BACKGROUND_IMAGE = "column_background_image";
|
||||
private static final String KEY_COLUMN_BACKGROUND_IMAGE_ALPHA = "column_background_image_alpha";
|
||||
|
||||
|
@ -190,6 +192,8 @@ class Column implements StreamReader.Callback {
|
|||
int header_bg_color;
|
||||
int header_fg_color;
|
||||
int column_bg_color;
|
||||
int acct_color;
|
||||
int content_color;
|
||||
String column_bg_image;
|
||||
float column_bg_image_alpha = 1f;
|
||||
|
||||
|
@ -262,6 +266,8 @@ class Column implements StreamReader.Callback {
|
|||
item.put( KEY_HEADER_BACKGROUND_COLOR, header_bg_color );
|
||||
item.put( KEY_HEADER_TEXT_COLOR, header_fg_color );
|
||||
item.put( KEY_COLUMN_BACKGROUND_COLOR, column_bg_color );
|
||||
item.put( KEY_COLUMN_ACCT_TEXT_COLOR, acct_color );
|
||||
item.put( KEY_COLUMN_CONTENT_TEXT_COLOR, content_color );
|
||||
item.put( KEY_COLUMN_BACKGROUND_IMAGE, column_bg_image );
|
||||
item.put( KEY_COLUMN_BACKGROUND_IMAGE_ALPHA, (double) column_bg_image_alpha );
|
||||
|
||||
|
@ -326,6 +332,8 @@ class Column implements StreamReader.Callback {
|
|||
this.header_bg_color = src.optInt( KEY_HEADER_BACKGROUND_COLOR );
|
||||
this.header_fg_color = src.optInt( KEY_HEADER_TEXT_COLOR );
|
||||
this.column_bg_color = src.optInt( KEY_COLUMN_BACKGROUND_COLOR );
|
||||
this.acct_color = src.optInt( KEY_COLUMN_ACCT_TEXT_COLOR );
|
||||
this.content_color = src.optInt( KEY_COLUMN_CONTENT_TEXT_COLOR );
|
||||
this.column_bg_image = Utils.optStringX( src, KEY_COLUMN_BACKGROUND_IMAGE );
|
||||
this.column_bg_image_alpha = (float) src.optDouble( KEY_COLUMN_BACKGROUND_IMAGE_ALPHA, 1.0f );
|
||||
|
||||
|
|
|
@ -755,7 +755,7 @@ class ColumnViewHolder
|
|||
tvColumnContext.setText( ac != null && ! TextUtils.isEmpty( ac.nickname ) ? ac.nickname : acct );
|
||||
|
||||
c = ( ac != null ? ac.color_fg : 0 );
|
||||
tvColumnContext.setTextColor( c != 0 ? c : Styler.getAttributeColor( activity, R.attr.colorAcctSmall ) );
|
||||
tvColumnContext.setTextColor( c != 0 ? c : Styler.getAttributeColor( activity, R.attr.colorTimeSmall ) );
|
||||
|
||||
c = ( ac != null ? ac.color_bg : 0 );
|
||||
if( c == 0 ){
|
||||
|
|
|
@ -277,7 +277,11 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
|
|||
|
||||
@Override public void onClick( View v ){
|
||||
|
||||
dialog.dismiss();
|
||||
try{
|
||||
dialog.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
|
||||
int pos = activity.nextPosition( column );
|
||||
|
||||
|
@ -557,7 +561,11 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
|
|||
|
||||
switch( v.getId() ){
|
||||
case R.id.btnFollow:
|
||||
dialog.dismiss();
|
||||
try{
|
||||
dialog.dismiss();
|
||||
}catch( Throwable ignored ){
|
||||
// IllegalArgumentException がたまに出る
|
||||
}
|
||||
activity.openFollowFromAnotherAccount( access_info, who );
|
||||
return true;
|
||||
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package jp.juggler.subwaytooter;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import jp.juggler.subwaytooter.api.entity.TootAccount;
|
||||
import jp.juggler.subwaytooter.api.entity.TootAttachment;
|
||||
import jp.juggler.subwaytooter.api.entity.TootDomainBlock;
|
||||
import jp.juggler.subwaytooter.api.entity.TootGap;
|
||||
import jp.juggler.subwaytooter.api.entity.TootNotification;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatusLike;
|
||||
import jp.juggler.subwaytooter.api_msp.entity.MSPToot;
|
||||
import jp.juggler.subwaytooter.table.AcctColor;
|
||||
import jp.juggler.subwaytooter.table.ContentWarning;
|
||||
import jp.juggler.subwaytooter.table.MediaShown;
|
||||
import jp.juggler.subwaytooter.table.SavedAccount;
|
||||
import jp.juggler.subwaytooter.table.UserRelation;
|
||||
import jp.juggler.subwaytooter.view.MyLinkMovementMethod;
|
||||
import jp.juggler.subwaytooter.view.MyListView;
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView;
|
||||
import jp.juggler.subwaytooter.view.MyTextView;
|
||||
import jp.juggler.subwaytooter.util.Utils;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import jp.juggler.subwaytooter.api.entity.TootAccount;
|
||||
import jp.juggler.subwaytooter.api.entity.TootAttachment;
|
||||
import jp.juggler.subwaytooter.api.entity.TootDomainBlock;
|
||||
import jp.juggler.subwaytooter.api.entity.TootGap;
|
||||
import jp.juggler.subwaytooter.api.entity.TootNotification;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus;
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatusLike;
|
||||
import jp.juggler.subwaytooter.api_msp.entity.MSPToot;
|
||||
import jp.juggler.subwaytooter.table.AcctColor;
|
||||
import jp.juggler.subwaytooter.table.ContentWarning;
|
||||
import jp.juggler.subwaytooter.table.MediaShown;
|
||||
import jp.juggler.subwaytooter.table.SavedAccount;
|
||||
import jp.juggler.subwaytooter.table.UserRelation;
|
||||
import jp.juggler.subwaytooter.view.MyLinkMovementMethod;
|
||||
import jp.juggler.subwaytooter.view.MyListView;
|
||||
import jp.juggler.subwaytooter.view.MyNetworkImageView;
|
||||
import jp.juggler.subwaytooter.view.MyTextView;
|
||||
import jp.juggler.subwaytooter.util.Utils;
|
||||
|
||||
class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
|
||||
|
@ -93,6 +93,9 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
|
||||
private final boolean bSimpleList;
|
||||
|
||||
private final int content_color_default;
|
||||
private int acct_color;
|
||||
|
||||
ItemViewHolder( ActMain arg_activity, Column column, ItemListAdapter list_adapter, View view, boolean bSimpleList ){
|
||||
this.activity = arg_activity;
|
||||
this.column = column;
|
||||
|
@ -196,6 +199,8 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
ViewGroup.LayoutParams lp = flMedia.getLayoutParams();
|
||||
lp.height = activity.app_state.media_thumb_height;
|
||||
|
||||
this.content_color_default = tvContent.getTextColors().getDefaultColor();
|
||||
|
||||
if( ! Float.isNaN( activity.timeline_font_size_sp ) ){
|
||||
tvBoosted.setTextSize( activity.timeline_font_size_sp );
|
||||
tvFollowerName.setTextSize( activity.timeline_font_size_sp );
|
||||
|
@ -236,6 +241,29 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
|
||||
if( item == null ) return;
|
||||
|
||||
{
|
||||
int c = column.content_color != 0 ? column.content_color : content_color_default;
|
||||
tvBoosted.setTextColor( c );
|
||||
tvFollowerName.setTextColor( c );
|
||||
tvName.setTextColor( c );
|
||||
tvMentions.setTextColor( c );
|
||||
tvContentWarning.setTextColor( c );
|
||||
tvContent.setTextColor( c );
|
||||
btnShowMedia.setTextColor( c );
|
||||
if( tvApplication != null ){
|
||||
tvApplication.setTextColor( c );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int c = this.acct_color = column.acct_color != 0 ? column.acct_color : Styler.getAttributeColor( activity, R.attr.colorTimeSmall );
|
||||
tvBoostedTime.setTextColor( c );
|
||||
tvTime.setTextColor( c );
|
||||
// tvBoostedAcct.setTextColor( c );
|
||||
// tvFollowerAcct.setTextColor( c );
|
||||
// tvAcct.setTextColor( c );
|
||||
}
|
||||
|
||||
if( item instanceof MSPToot ){
|
||||
showStatus( activity, (MSPToot) item );
|
||||
}else if( item instanceof String ){
|
||||
|
@ -329,7 +357,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
ivBoosted.setImageResource( Styler.getAttributeResourceId( activity, icon_attr_id ) );
|
||||
tvBoostedTime.setText( TootStatus.formatTime( time ) );
|
||||
tvBoosted.setText( text );
|
||||
setAcct( tvBoostedAcct, access_info.getFullAcct( who ), R.attr.colorAcctSmall );
|
||||
setAcct( tvBoostedAcct, access_info.getFullAcct( who ) );
|
||||
}
|
||||
|
||||
private void showFollow( @NonNull TootAccount who ){
|
||||
|
@ -338,7 +366,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
ivFollow.setCornerRadius( activity.pref, 16f );
|
||||
ivFollow.setImageUrl( access_info.supplyBaseUrl( who.avatar_static ) );
|
||||
tvFollowerName.setText( who.decoded_display_name );
|
||||
setAcct( tvFollowerAcct, access_info.getFullAcct( who ), R.attr.colorAcctSmall );
|
||||
setAcct( tvFollowerAcct, access_info.getFullAcct( who ) );
|
||||
|
||||
UserRelation relation = UserRelation.load( access_info.db_id, who.id );
|
||||
Styler.setFollowIcon( activity, btnFollow, ivFollowedBy, relation );
|
||||
|
@ -353,7 +381,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
ivThumbnail.setCornerRadius( activity.pref, 16f );
|
||||
|
||||
account_thumbnail = status.account;
|
||||
setAcct( tvAcct, access_info.getFullAcct( status.account ), R.attr.colorAcctSmall );
|
||||
setAcct( tvAcct, access_info.getFullAcct( status.account ) );
|
||||
|
||||
if( status.account == null ){
|
||||
tvName.setText( "?" );
|
||||
|
@ -465,10 +493,10 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
private void setAcct( TextView tv, String acct, int color_attr_id ){
|
||||
private void setAcct( TextView tv, String acct ){
|
||||
AcctColor ac = AcctColor.load( acct );
|
||||
tv.setText( AcctColor.hasNickname( ac ) ? ac.nickname : acct );
|
||||
tv.setTextColor( AcctColor.hasColorForeground( ac ) ? ac.color_fg : Styler.getAttributeColor( activity, color_attr_id ) );
|
||||
tv.setTextColor( AcctColor.hasColorForeground( ac ) ? ac.color_fg : this.acct_color );
|
||||
|
||||
if( AcctColor.hasColorBackground( ac ) ){
|
||||
tv.setBackgroundColor( ac.color_bg );
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package jp.juggler.subwaytooter.util;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.TextPaint;
|
||||
import android.text.style.MetricAffectingSpan;
|
||||
|
||||
|
||||
public class EmojiSpan extends MetricAffectingSpan {
|
||||
|
||||
private final Typeface typeface;
|
||||
|
||||
public EmojiSpan(final Typeface typeface) {
|
||||
if (typeface == null) {
|
||||
throw new IllegalArgumentException("typeface is null");
|
||||
}
|
||||
|
||||
this.typeface = typeface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(final TextPaint drawState) {
|
||||
apply(drawState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMeasureState(final TextPaint paint) {
|
||||
apply(paint);
|
||||
}
|
||||
|
||||
private void apply(final Paint paint) {
|
||||
final Typeface oldTypeface = paint.getTypeface();
|
||||
final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
|
||||
final int fakeStyle = oldStyle & ~typeface.getStyle();
|
||||
|
||||
if ((fakeStyle & Typeface.BOLD) != 0) {
|
||||
paint.setFakeBoldText(true);
|
||||
}
|
||||
|
||||
if ((fakeStyle & Typeface.ITALIC) != 0) {
|
||||
paint.setTextSkewX(-0.25f);
|
||||
}
|
||||
|
||||
paint.setTypeface(typeface);
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ public abstract class Emojione
|
|||
void closeSpan(){
|
||||
if( last_span_start >= 0 ){
|
||||
if( last_span_end > last_span_start ){
|
||||
CalligraphyTypefaceSpan typefaceSpan = new CalligraphyTypefaceSpan( App1.typeface_emoji );
|
||||
EmojiSpan typefaceSpan = new EmojiSpan( App1.typeface_emoji );
|
||||
sb.setSpan( typefaceSpan, last_span_start, last_span_end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE );
|
||||
}
|
||||
last_span_start = -1;
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/column_background"
|
||||
android:text="@string/column"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
@ -129,7 +129,7 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/flColumnBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
|
@ -139,6 +139,35 @@
|
|||
android:importantForAccessibility="no"
|
||||
android:scaleType="centerCrop"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
android:text="username@instance"
|
||||
android:id="@+id/tvSampleAcct"
|
||||
/>
|
||||
|
||||
<jp.juggler.subwaytooter.view.MyTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:gravity="center"
|
||||
android:text="@string/content"
|
||||
android:id="@+id/tvSampleContent"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -147,7 +176,7 @@
|
|||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/color"
|
||||
android:text="@string/background_color"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -176,7 +205,7 @@
|
|||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/image"
|
||||
android:text="@string/background_image"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -205,7 +234,7 @@
|
|||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:labelFor="@+id/etAlpha"
|
||||
android:text="@string/image_alpha"
|
||||
android:text="@string/background_image_alpha"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -242,6 +271,65 @@
|
|||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/acct_color"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAcctColor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/edit"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAcctColorReset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reset"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/content_color"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnContentColor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/edit"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnContentColorReset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reset"
|
||||
android:textAllCaps="false"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="who@hoge"
|
||||
/>
|
||||
|
@ -119,7 +119,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingStart="4dp"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="aaaaaaaaaaaaaaaa"
|
||||
/>
|
||||
|
@ -177,7 +177,7 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="who@hoge"
|
||||
/>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="who@hoge"
|
||||
/>
|
||||
|
@ -116,7 +116,7 @@
|
|||
android:id="@+id/tvFollowerAcct"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="aaaaaaaaaaaaaaaa"
|
||||
/>
|
||||
|
@ -176,7 +176,7 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/colorAcctSmall"
|
||||
android:textColor="?attr/colorTimeSmall"
|
||||
android:textSize="12sp"
|
||||
tools:text="who@hoge"
|
||||
/>
|
||||
|
|
|
@ -406,8 +406,13 @@
|
|||
<string name="format_of_quote_name">Format of \'Quote name\' (set text that contains %1$s)</string>
|
||||
<string name="dont_show_favourite">Masquer les favourite</string>
|
||||
<string name="dont_show_follow">Masquer les follow</string>
|
||||
<string name="background_image">Background image</string>
|
||||
<string name="background_image_alpha">Background image alpha</string>
|
||||
<string name="acct_color">Acct text color</string>
|
||||
<string name="content_color">Content text color</string>
|
||||
<string name="content">Content</string>
|
||||
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</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>-->
|
||||
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
|
||||
<!--<string name="abc_action_bar_up_description">Revenir en haut de la page</string>-->
|
||||
|
|
|
@ -693,5 +693,9 @@
|
|||
<string name="format_of_quote_name">\'名前を引用\'のフォーマット ( %1$s を含むテキストを指定する)</string>
|
||||
<string name="dont_show_favourite">お気に入りを表示しない</string>
|
||||
<string name="dont_show_follow">フォローを表示しない</string>
|
||||
<string name="acct_color">Acctの文字色</string>
|
||||
<string name="background_image">背景画像</string>
|
||||
<string name="background_image_alpha">背景画像のアルファ値</string>
|
||||
<string name="content_color">本文の文字色</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
<!-- プロフ背景を薄くするマスク #C0FFFFFF -->
|
||||
<attr name="colorProfileBackgroundMask" format="color"/>
|
||||
|
||||
<!-- Acct の小さな表記 #888888 -->
|
||||
<attr name="colorAcctSmall" format="color"/>
|
||||
|
||||
<!-- NSFWを隠す表示の背景色 #000 -->
|
||||
<attr name="colorShowMediaBackground" format="color"/>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
<color name="Light_colorColumnListItemText">#80000000</color>
|
||||
<color name="Light_colorTimeSmall">#80000000</color>
|
||||
<color name="Light_colorAcctSmall">#80000000</color>
|
||||
<color name="Light_colorColumnHeaderAcct">#80000000</color>
|
||||
<color name="Light_colorColumnHeaderPageNumber">#80000000</color>
|
||||
<color name="Light_colorSettingDivider">#80000000</color>
|
||||
|
@ -50,7 +49,6 @@
|
|||
|
||||
<color name="Dark_colorColumnListItemText">#66FFFFFF</color>
|
||||
<color name="Dark_colorTimeSmall">#66FFFFFF</color>
|
||||
<color name="Dark_colorAcctSmall">#66FFFFFF</color>
|
||||
<color name="Dark_colorColumnHeaderAcct">#66FFFFFF</color>
|
||||
<color name="Dark_colorColumnHeaderPageNumber">#66FFFFFF</color>
|
||||
<color name="Dark_colorSettingDivider">#66FFFFFF</color><!-- ダイアログ背景が#424242なので、それより明るくないといけない -->
|
||||
|
|
|
@ -401,5 +401,10 @@
|
|||
<string name="format_of_quote_name">Format of \'Quote name\' (set text that contains %1$s)</string>
|
||||
<string name="dont_show_favourite">Don\'t show favourite</string>
|
||||
<string name="dont_show_follow">Don\'t show follow</string>
|
||||
<string name="background_image">Background image</string>
|
||||
<string name="background_image_alpha">Background image alpha</string>
|
||||
<string name="acct_color">Acct text color</string>
|
||||
<string name="content_color">Content text color</string>
|
||||
<string name="content">Content</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
<item name="colorColumnListItemText">@color/Light_colorColumnListItemText</item>
|
||||
<item name="colorTimeSmall">@color/Light_colorTimeSmall</item>
|
||||
<item name="colorProfileBackgroundMask">@color/Light_colorProfileBackgroundMask</item>
|
||||
<item name="colorAcctSmall">@color/Light_colorAcctSmall</item>
|
||||
<item name="colorShowMediaBackground">@color/Light_colorShowMediaBackground</item>
|
||||
<item name="colorShowMediaText">@color/Light_colorShowMediaText</item>
|
||||
<item name="colorColumnHeaderAcct">@color/Light_colorColumnHeaderAcct</item>
|
||||
|
@ -122,7 +121,6 @@
|
|||
<item name="colorColumnListItemText">@color/Dark_colorColumnListItemText</item>
|
||||
<item name="colorTimeSmall">@color/Dark_colorTimeSmall</item>
|
||||
<item name="colorProfileBackgroundMask">@color/Dark_colorProfileBackgroundMask</item>
|
||||
<item name="colorAcctSmall">@color/Dark_colorAcctSmall</item>
|
||||
<item name="colorShowMediaBackground">@color/Dark_colorShowMediaBackground</item>
|
||||
<item name="colorShowMediaText">@color/Dark_colorShowMediaText</item>
|
||||
<item name="colorColumnHeaderAcct">@color/Dark_colorColumnHeaderAcct</item>
|
||||
|
|
Loading…
Reference in New Issue