テーマ選択。黒テーマ。
|
@ -13,6 +13,7 @@
|
|||
<w>reblog</w>
|
||||
<w>reblogged</w>
|
||||
<w>reblogs</w>
|
||||
<w>styler</w>
|
||||
<w>subwaytooter</w>
|
||||
<w>swipy</w>
|
||||
<w>tateisu</w>
|
||||
|
|
|
@ -9,8 +9,8 @@ android {
|
|||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 25
|
||||
versionCode 15
|
||||
versionName "0.1.5"
|
||||
versionCode 16
|
||||
versionName "0.1.6"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:theme="@style/AppTheme.Light"
|
||||
>
|
||||
<receiver android:name=".AlarmReceiver">
|
||||
<intent-filter>
|
||||
|
@ -27,7 +27,7 @@
|
|||
android:name=".ActMain"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
|
||||
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
|
||||
>
|
||||
<intent-filter>
|
||||
|
@ -39,44 +39,44 @@
|
|||
<activity
|
||||
android:name=".ActPost"
|
||||
android:label="@string/act_post"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
/>
|
||||
|
||||
<activity
|
||||
android:name=".ActAccountSetting"
|
||||
android:label="@string/account_setting"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
/>
|
||||
|
||||
<activity
|
||||
android:name=".ActAppSetting"
|
||||
android:label="@string/app_setting"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
/>
|
||||
|
||||
<activity
|
||||
android:name=".ActColumnList"
|
||||
android:label="@string/column_list"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
/>
|
||||
<activity
|
||||
android:name=".ActAbout"
|
||||
android:label="@string/app_about"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
/>
|
||||
<activity
|
||||
android:name=".ActOSSLicense"
|
||||
android:label="@string/oss_license"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
/>
|
||||
<activity
|
||||
android:name=".ActOAuthCallback"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ActAbout extends AppCompatActivity {
|
|||
|
||||
@Override protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
App1.setActivityTheme(this,false);
|
||||
setContentView( R.layout.act_about );
|
||||
|
||||
try{
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ActAccountSetting extends AppCompatActivity implements View.OnClick
|
|||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
App1.setActivityTheme(this,false);
|
||||
initUI();
|
||||
account = SavedAccount.loadAccount( log, getIntent().getLongExtra( KEY_ACCOUNT_DB_ID, - 1L ) );
|
||||
if( account == null ) finish();
|
||||
|
|
|
@ -24,6 +24,7 @@ public class ActAppSetting extends AppCompatActivity implements CompoundButton.O
|
|||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
App1.setActivityTheme(this,false);
|
||||
initUI();
|
||||
pref = Pref.pref( this );
|
||||
|
||||
|
@ -36,6 +37,7 @@ public class ActAppSetting extends AppCompatActivity implements CompoundButton.O
|
|||
Switch swDisableFastScroller;
|
||||
|
||||
Spinner spBackButtonAction;
|
||||
Spinner spUITheme;
|
||||
|
||||
static final int BACK_ASK_ALWAYS =0;
|
||||
static final int BACK_CLOSE_COLUMN =1;
|
||||
|
@ -56,17 +58,31 @@ public class ActAppSetting extends AppCompatActivity implements CompoundButton.O
|
|||
swDisableFastScroller.setOnCheckedChangeListener( this );
|
||||
|
||||
|
||||
spBackButtonAction = (Spinner) findViewById( R.id.spBackButtonAction );
|
||||
spBackButtonAction.setOnItemSelectedListener( this );
|
||||
|
||||
String[] caption_list = new String[4];
|
||||
caption_list[0] = getString(R.string.ask_always);
|
||||
caption_list[1] = getString(R.string.close_column);
|
||||
caption_list[2] = getString(R.string.open_column_list);
|
||||
caption_list[3] = getString(R.string.app_exit);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, caption_list);
|
||||
adapter.setDropDownViewResource( R.layout.lv_spinner_dropdown );
|
||||
spBackButtonAction.setAdapter( adapter );
|
||||
{
|
||||
String[] caption_list = new String[ 4 ];
|
||||
caption_list[ 0 ] = getString( R.string.ask_always );
|
||||
caption_list[ 1 ] = getString( R.string.close_column );
|
||||
caption_list[ 2 ] = getString( R.string.open_column_list );
|
||||
caption_list[ 3 ] = getString( R.string.app_exit );
|
||||
ArrayAdapter< String > adapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_item, caption_list );
|
||||
adapter.setDropDownViewResource( R.layout.lv_spinner_dropdown );
|
||||
spBackButtonAction = (Spinner) findViewById( R.id.spBackButtonAction );
|
||||
spBackButtonAction.setAdapter( adapter );
|
||||
spBackButtonAction.setOnItemSelectedListener( this );
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
String[] caption_list = new String[ 2 ];
|
||||
caption_list[ 0 ] = getString( R.string.theme_light );
|
||||
caption_list[ 1 ] = getString( R.string.theme_dark );
|
||||
ArrayAdapter< String > adapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_item, caption_list );
|
||||
adapter.setDropDownViewResource( R.layout.lv_spinner_dropdown );
|
||||
spUITheme = (Spinner) findViewById( R.id.spUITheme );
|
||||
spUITheme.setAdapter( adapter );
|
||||
spUITheme.setOnItemSelectedListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
boolean load_busy;
|
||||
|
@ -77,7 +93,7 @@ public class ActAppSetting extends AppCompatActivity implements CompoundButton.O
|
|||
swPriorLocalURL.setChecked( pref.getBoolean( Pref.KEY_PRIOR_LOCAL_URL, false ) );
|
||||
swDisableFastScroller.setChecked( pref.getBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, false ) );
|
||||
spBackButtonAction.setSelection( pref.getInt(Pref.KEY_BACK_BUTTON_ACTION,0) );
|
||||
|
||||
spUITheme.setSelection( pref.getInt(Pref.KEY_UI_THEME,0) );
|
||||
load_busy = false;
|
||||
}
|
||||
|
||||
|
@ -88,6 +104,7 @@ public class ActAppSetting extends AppCompatActivity implements CompoundButton.O
|
|||
.putBoolean( Pref.KEY_PRIOR_LOCAL_URL, swPriorLocalURL.isChecked() )
|
||||
.putBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, swDisableFastScroller.isChecked() )
|
||||
.putInt( Pref.KEY_BACK_BUTTON_ACTION, spBackButtonAction.getSelectedItemPosition() )
|
||||
.putInt( Pref.KEY_UI_THEME, spUITheme.getSelectedItemPosition() )
|
||||
.apply();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ public class ActColumnList extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
App1.setActivityTheme(this,false);
|
||||
initUI();
|
||||
|
||||
if( savedInstanceState != null ){
|
||||
|
|
|
@ -76,7 +76,7 @@ public class ActMain extends AppCompatActivity
|
|||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
App1.setActivityTheme(this,true);
|
||||
this.density = getResources().getDisplayMetrics().density;
|
||||
|
||||
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
||||
|
@ -839,7 +839,7 @@ public class ActMain extends AppCompatActivity
|
|||
|
||||
// ビルダーを使って表示方法を指定する
|
||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
||||
builder.setToolbarColor( ContextCompat.getColor( this, R.color.colorPrimary ) ).setShowTitle( true );
|
||||
builder.setToolbarColor( Styler.getAttributeColor( this,R.attr.colorPrimary ) ).setShowTitle( true );
|
||||
|
||||
// CustomTabsでURLをひらくIntentを発行
|
||||
CustomTabsIntent customTabsIntent = builder.build();
|
||||
|
|
|
@ -15,6 +15,7 @@ import jp.juggler.subwaytooter.util.Utils;
|
|||
public class ActOSSLicense extends AppCompatActivity{
|
||||
@Override protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
App1.setActivityTheme(this,true);
|
||||
setContentView( R.layout.act_oss_license);
|
||||
|
||||
try{
|
||||
|
|
|
@ -65,7 +65,6 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
static final String KEY_IN_REPLY_TO_TEXT = "in_reply_to_text";
|
||||
static final String KEY_IN_REPLY_TO_IMAGE = "in_reply_to_image";
|
||||
|
||||
|
||||
public static void open( Context context, long account_db_id, TootStatus reply_status ){
|
||||
Intent intent = new Intent( context, ActPost.class );
|
||||
intent.putExtra( KEY_ACCOUNT_DB_ID, account_db_id );
|
||||
|
@ -74,7 +73,8 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
}
|
||||
context.startActivity( intent );
|
||||
}
|
||||
public static void open( Context context, long account_db_id, String initial_text ){
|
||||
|
||||
public static void open( Context context, long account_db_id, String initial_text ){
|
||||
Intent intent = new Intent( context, ActPost.class );
|
||||
intent.putExtra( KEY_ACCOUNT_DB_ID, account_db_id );
|
||||
if( initial_text != null ){
|
||||
|
@ -145,7 +145,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ){
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
App1.setActivityTheme( this, true );
|
||||
initUI();
|
||||
|
||||
if( account_list.isEmpty() ){
|
||||
|
@ -207,15 +207,15 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
}
|
||||
|
||||
String sv = intent.getStringExtra( KEY_INITIAL_TEXT );
|
||||
if( sv != null){
|
||||
etContent.setText(sv);
|
||||
if( sv != null ){
|
||||
etContent.setText( sv );
|
||||
etContent.setSelection( sv.length() );
|
||||
}
|
||||
|
||||
sv = intent.getStringExtra( KEY_REPLY_STATUS );
|
||||
if( sv != null ){
|
||||
try{
|
||||
TootStatus repley_status = TootStatus.parse( log, account,new JSONObject( sv ) );
|
||||
TootStatus repley_status = TootStatus.parse( log, account, new JSONObject( sv ) );
|
||||
|
||||
// CW をリプライ元に合わせる
|
||||
if( ! TextUtils.isEmpty( repley_status.spoiler_text ) ){
|
||||
|
@ -225,13 +225,13 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
|
||||
// mention を自動設定する
|
||||
ArrayList< String > mention_list = new ArrayList<>();
|
||||
mention_list.add( "@"+account.getFullAcct( repley_status.account ) );
|
||||
mention_list.add( "@" + account.getFullAcct( repley_status.account ) );
|
||||
if( repley_status.mentions != null ){
|
||||
for( TootMention mention : repley_status.mentions ){
|
||||
|
||||
if( account.isMe(mention.acct)) continue;
|
||||
|
||||
sv = "@"+account.getFullAcct(mention.acct );
|
||||
|
||||
if( account.isMe( mention.acct ) ) continue;
|
||||
|
||||
sv = "@" + account.getFullAcct( mention.acct );
|
||||
if( ! mention_list.contains( sv ) ){
|
||||
mention_list.add( sv );
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
llReply = findViewById( R.id.llReply );
|
||||
tvReplyTo = (TextView) findViewById( R.id.tvReplyTo );
|
||||
btnRemoveReply = findViewById( R.id.btnRemoveReply );
|
||||
ivReply= (NetworkImageView) findViewById( R.id.ivReply );
|
||||
ivReply = (NetworkImageView) findViewById( R.id.ivReply );
|
||||
|
||||
account_list = SavedAccount.loadAccountList( log );
|
||||
Collections.sort( account_list, new Comparator< SavedAccount >() {
|
||||
|
@ -432,15 +432,15 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
|
||||
if( ! attachment_list.isEmpty() ){
|
||||
// 添付ファイルがあったら確認の上添付ファイルを捨てないと切り替えられない
|
||||
Utils.showToast( this,false,R.string.cant_change_account_when_attachiment_specified );
|
||||
Utils.showToast( this, false, R.string.cant_change_account_when_attachiment_specified );
|
||||
}
|
||||
|
||||
final ArrayList< SavedAccount > tmp_account_list = new ArrayList<>();
|
||||
if( in_reply_to_id != -1L ){
|
||||
if( in_reply_to_id != - 1L ){
|
||||
// リプライは数値IDなのでサーバが同じじゃないと選択できない
|
||||
for( SavedAccount a : account_list ){
|
||||
if( !a.host.equals( account.host ) ) continue;
|
||||
tmp_account_list.add(a);
|
||||
if( ! a.host.equals( account.host ) ) continue;
|
||||
tmp_account_list.add( a );
|
||||
}
|
||||
}else{
|
||||
tmp_account_list.addAll( account_list );
|
||||
|
@ -498,11 +498,11 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
iv.setVisibility( View.VISIBLE );
|
||||
PostAttachment a = attachment_list.get( idx );
|
||||
if( a.status == ATTACHMENT_UPLOADING ){
|
||||
iv.setImageDrawable( ContextCompat.getDrawable( this, R.drawable.ic_loading ) );
|
||||
iv.setImageDrawable( Styler.getAttributeDrawable( this, R.attr.ic_loading ) );
|
||||
}else if( a.attachment != null ){
|
||||
iv.setImageUrl( a.attachment.preview_url, App1.getImageLoader() );
|
||||
}else{
|
||||
iv.setImageDrawable( ContextCompat.getDrawable( this, R.drawable.ic_unknown ) );
|
||||
iv.setImageDrawable( Styler.getAttributeDrawable( this, R.attr.ic_unknown ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +705,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
String visibility;
|
||||
|
||||
private void updateVisibility(){
|
||||
btnVisibility.setImageResource( Styler.getVisibilityIcon( visibility ) );
|
||||
btnVisibility.setImageResource( Styler.getVisibilityIcon( this, visibility ) );
|
||||
}
|
||||
|
||||
private void performVisibility(){
|
||||
|
@ -715,11 +715,6 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
getString( R.string.visibility_private ),
|
||||
getString( R.string.visibility_direct ),
|
||||
};
|
||||
|
||||
// public static final String VISIBILITY_PUBLIC ="public";
|
||||
// public static final String VISIBILITY_UNLISTED ="unlisted";
|
||||
// public static final String VISIBILITY_PRIVATE ="private";
|
||||
// public static final String VISIBILITY_DIRECT ="direct";
|
||||
|
||||
new AlertDialog.Builder( this )
|
||||
.setTitle( R.string.choose_visibility )
|
||||
|
@ -832,7 +827,7 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
|
||||
TootApiResult result = client.request( "/api/v1/statuses", request_builder );
|
||||
if( result.object != null ){
|
||||
status = TootStatus.parse( log, account,result.object );
|
||||
status = TootStatus.parse( log, account, result.object );
|
||||
}
|
||||
return result;
|
||||
|
||||
|
@ -881,8 +876,8 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener {
|
|||
llReply.setVisibility( View.GONE );
|
||||
}else{
|
||||
llReply.setVisibility( View.VISIBLE );
|
||||
tvReplyTo.setText( HTMLDecoder.decodeHTML( account,in_reply_to_text ) );
|
||||
ivReply.setImageUrl( in_reply_to_image,App1.getImageLoader() );
|
||||
tvReplyTo.setText( HTMLDecoder.decodeHTML( account, in_reply_to_text ) );
|
||||
ivReply.setImageUrl( in_reply_to_image, App1.getImageLoader() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -364,8 +364,8 @@ public class AlarmService extends IntentService {
|
|||
.setContentIntent( pi_click )
|
||||
.setDeleteIntent( pi_delete )
|
||||
.setAutoCancel( false )
|
||||
.setSmallIcon( R.drawable.ic_notification )
|
||||
.setColor( ContextCompat.getColor( this, R.color.colorAccent ) )
|
||||
.setSmallIcon( R.drawable.ic_notification ) // ここは常に白テーマのアイコンを使う
|
||||
.setColor( ContextCompat.getColor(this, R.color.Light_colorAccent ) ) // ここは常に白テーマの色を使う
|
||||
.setDefaults( NotificationCompat.DEFAULT_ALL )
|
||||
.setWhen( item.notification.time_created_at );
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package jp.juggler.subwaytooter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -39,7 +41,22 @@ public class App1 extends Application {
|
|||
return db_open_helper.getWritableDatabase();
|
||||
}
|
||||
|
||||
public static void setActivityTheme( Activity activity ,boolean bNoActionBar ){
|
||||
int theme_idx = pref.getInt(Pref.KEY_UI_THEME,0);
|
||||
switch(theme_idx){
|
||||
|
||||
default:
|
||||
case 0:
|
||||
activity.setTheme( bNoActionBar ? R.style.AppTheme_Light_NoActionBar : R.style.AppTheme_Light );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
activity.setTheme( bNoActionBar ? R.style.AppTheme_Dark_NoActionBar : R.style.AppTheme_Dark );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static class DBOpenHelper extends SQLiteOpenHelper {
|
||||
|
||||
DBOpenHelper( Context context ){
|
||||
|
@ -131,15 +148,22 @@ public class App1 extends Application {
|
|||
|
||||
// public static final RelationshipMap relationship_map = new RelationshipMap();
|
||||
|
||||
public static SharedPreferences pref;
|
||||
|
||||
@Override
|
||||
public void onCreate(){
|
||||
super.onCreate();
|
||||
|
||||
|
||||
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||
.setFontAttrId(R.attr.fontPath)
|
||||
.build()
|
||||
);
|
||||
|
||||
if( pref == null ){
|
||||
pref = Pref.pref(getApplicationContext());
|
||||
}
|
||||
|
||||
if( typeface_emoji == null ){
|
||||
typeface_emoji = TypefaceUtils.load(getAssets(), "emojione_android.ttf");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package jp.juggler.subwaytooter;
|
|||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -630,7 +629,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
showBoost(
|
||||
n.account
|
||||
, n.time_created_at
|
||||
, R.drawable.btn_favourite
|
||||
, R.attr.btn_favourite
|
||||
, Utils.formatSpannable1( activity, R.string.display_name_favourited_by, n.account.display_name )
|
||||
);
|
||||
if( n.status != null ) showStatus( activity, n.status, access_info );
|
||||
|
@ -638,7 +637,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
showBoost(
|
||||
n.account
|
||||
, n.time_created_at
|
||||
, R.drawable.btn_boost
|
||||
, R.attr.btn_boost
|
||||
, Utils.formatSpannable1( activity, R.string.display_name_boosted_by, n.account.display_name )
|
||||
);
|
||||
if( n.status != null ) showStatus( activity, n.status, access_info );
|
||||
|
@ -646,7 +645,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
showBoost(
|
||||
n.account
|
||||
, n.time_created_at
|
||||
, R.drawable.btn_boost
|
||||
, R.attr.btn_boost
|
||||
, Utils.formatSpannable1( activity, R.string.display_name_followed_by, n.account.display_name )
|
||||
);
|
||||
//
|
||||
|
@ -657,7 +656,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
showBoost(
|
||||
n.account
|
||||
, n.time_created_at
|
||||
, R.drawable.btn_reply
|
||||
, R.attr.btn_reply
|
||||
, Utils.formatSpannable1( activity, R.string.display_name_replied_by, n.account.display_name )
|
||||
);
|
||||
if( n.status != null ) showStatus( activity, n.status, access_info );
|
||||
|
@ -668,7 +667,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
showBoost(
|
||||
status.account
|
||||
, status.time_created_at
|
||||
, R.drawable.btn_boost
|
||||
, R.attr.btn_boost
|
||||
, Utils.formatSpannable1( activity, R.string.display_name_boosted_by, status.account.display_name )
|
||||
);
|
||||
showStatus( activity, status.reblog, access_info );
|
||||
|
@ -694,10 +693,10 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
btnSearchTag.setText( activity.getString( R.string.read_gap ) );
|
||||
}
|
||||
|
||||
void showBoost( TootAccount who, long time, int icon_id, CharSequence text ){
|
||||
void showBoost( TootAccount who, long time, int icon_attr_id, CharSequence text ){
|
||||
account_boost = who;
|
||||
llBoosted.setVisibility( View.VISIBLE );
|
||||
ivBoosted.setImageResource( icon_id );
|
||||
ivBoosted.setImageResource( Styler.getAttributeResourceId(activity,icon_attr_id) );
|
||||
tvBoostedTime.setText( TootStatus.formatTime( time ) );
|
||||
tvBoostedAcct.setText( access_info.getFullAcct( who ) );
|
||||
tvBoosted.setText( text );
|
||||
|
@ -710,8 +709,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
tvFollowerName.setText( who.display_name );
|
||||
tvFollowerAcct.setText( access_info.getFullAcct( who ) );
|
||||
|
||||
btnFollow.setImageResource( R.drawable.btn_follow );
|
||||
|
||||
btnFollow.setImageResource( Styler.getAttributeResourceId( activity,R.attr.ic_account_add ));
|
||||
}
|
||||
|
||||
private void showStatus( ActMain activity, TootStatus status, SavedAccount account ){
|
||||
|
@ -766,19 +764,19 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
}
|
||||
|
||||
Drawable d;
|
||||
int color;
|
||||
int color_normal = Styler.getAttributeColor( activity,R.attr.colorImageButton );
|
||||
int color_accent = Styler.getAttributeColor( activity,R.attr.colorImageButtonAccent );
|
||||
|
||||
if( activity.isBusyBoost( account, status ) ){
|
||||
color = 0xff000000;
|
||||
d = ContextCompat.getDrawable( activity, R.drawable.btn_boost ).mutate();
|
||||
d.setColorFilter( color, PorterDuff.Mode.SRC_ATOP );
|
||||
d = Styler.getAttributeDrawable( activity,R.attr.btn_refresh ).mutate();
|
||||
d.setColorFilter( color_normal, PorterDuff.Mode.SRC_ATOP );
|
||||
btnBoost.setCompoundDrawablesRelativeWithIntrinsicBounds( d, null, null, null );
|
||||
btnBoost.setText( "?" );
|
||||
btnBoost.setTextColor( color );
|
||||
btnBoost.setTextColor( color_normal );
|
||||
|
||||
}else{
|
||||
color = ( status.reblogged ? 0xff0088ff : 0xff000000 );
|
||||
d = ContextCompat.getDrawable( activity, R.drawable.btn_boost ).mutate();
|
||||
int color = ( status.reblogged ? color_accent : color_normal );
|
||||
d = Styler.getAttributeDrawable( activity,R.attr.btn_boost ).mutate();
|
||||
d.setColorFilter( color, PorterDuff.Mode.SRC_ATOP );
|
||||
btnBoost.setCompoundDrawablesRelativeWithIntrinsicBounds( d, null, null, null );
|
||||
btnBoost.setText( Long.toString( status.reblogs_count ) );
|
||||
|
@ -787,15 +785,14 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
}
|
||||
|
||||
if( activity.isBusyFav( account, status ) ){
|
||||
color = 0xff000000;
|
||||
d = ContextCompat.getDrawable( activity, R.drawable.btn_refresh ).mutate();
|
||||
d.setColorFilter( color, PorterDuff.Mode.SRC_ATOP );
|
||||
d = Styler.getAttributeDrawable( activity,R.attr.btn_refresh ).mutate();
|
||||
d.setColorFilter( color_normal, PorterDuff.Mode.SRC_ATOP );
|
||||
btnFavourite.setCompoundDrawablesRelativeWithIntrinsicBounds( d, null, null, null );
|
||||
btnFavourite.setText( "?" );
|
||||
btnFavourite.setTextColor( color );
|
||||
btnFavourite.setTextColor( color_normal );
|
||||
}else{
|
||||
color = ( status.favourited ? 0xff0088ff : 0xff000000 );
|
||||
d = ContextCompat.getDrawable( activity, R.drawable.btn_favourite ).mutate();
|
||||
int color = ( status.favourited ? color_accent : color_normal );
|
||||
d = Styler.getAttributeDrawable( activity,R.attr.btn_favourite ).mutate();
|
||||
d.setColorFilter( color, PorterDuff.Mode.SRC_ATOP );
|
||||
btnFavourite.setCompoundDrawablesRelativeWithIntrinsicBounds( d, null, null, null );
|
||||
btnFavourite.setText( Long.toString( status.favourites_count ) );
|
||||
|
|
|
@ -16,5 +16,6 @@ public class Pref {
|
|||
public static final String KEY_BACK_BUTTON_ACTION ="back_button_action";
|
||||
public static final String KEY_PRIOR_LOCAL_URL = "prior_local_url";
|
||||
public static final String KEY_DISABLE_FAST_SCROLLER = "disable_fast_scroller";
|
||||
public static final String KEY_UI_THEME = "ui_theme";
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
package jp.juggler.subwaytooter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus;
|
||||
|
||||
/**
|
||||
* Created by tateisu on 2017/04/22.
|
||||
*/
|
||||
|
||||
public class Styler {
|
||||
public static int getVisibilityIcon( String visibility ){
|
||||
class Styler {
|
||||
static int getVisibilityIcon( Context context,String visibility ){
|
||||
return
|
||||
TootStatus.VISIBILITY_PUBLIC.equals( visibility ) ? R.drawable.ic_public
|
||||
: TootStatus.VISIBILITY_UNLISTED.equals( visibility ) ? R.drawable.ic_lock_open
|
||||
: TootStatus.VISIBILITY_PRIVATE.equals( visibility ) ? R.drawable.ic_lock
|
||||
: TootStatus.VISIBILITY_DIRECT.equals( visibility ) ? R.drawable.ic_mail
|
||||
: R.drawable.ic_public;
|
||||
getAttributeResourceId( context,
|
||||
TootStatus.VISIBILITY_PUBLIC.equals( visibility ) ? R.attr.ic_public
|
||||
: TootStatus.VISIBILITY_UNLISTED.equals( visibility ) ? R.attr.ic_lock_open
|
||||
: TootStatus.VISIBILITY_PRIVATE.equals( visibility ) ? R.attr.ic_lock
|
||||
: TootStatus.VISIBILITY_DIRECT.equals( visibility ) ? R.attr.ic_mail
|
||||
: R.attr.ic_public );
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static String getVisibilityString( Context context ,String visibility){
|
||||
static String getVisibilityString( Context context, String visibility ){
|
||||
return
|
||||
TootStatus.VISIBILITY_PUBLIC.equals( visibility ) ? context.getString( R.string.visibility_public )
|
||||
: TootStatus.VISIBILITY_UNLISTED.equals( visibility ) ? context.getString( R.string.visibility_unlisted )
|
||||
|
@ -28,4 +31,28 @@ public class Styler {
|
|||
: TootStatus.VISIBILITY_DIRECT.equals( visibility ) ? context.getString( R.string.visibility_direct )
|
||||
: "?";
|
||||
}
|
||||
|
||||
static int getAttributeColor( @NonNull Context context, int attr_id ){
|
||||
Resources.Theme theme = context.getTheme();
|
||||
TypedArray a = theme.obtainStyledAttributes( new int[]{ attr_id } );
|
||||
int color = a.getColor( 0, 0xFFFF0000 );
|
||||
a.recycle();
|
||||
return color;
|
||||
}
|
||||
|
||||
@NonNull static Drawable getAttributeDrawable( @NonNull Context context, int attr_id ){
|
||||
int res_id = getAttributeResourceId( context,attr_id );
|
||||
Drawable d = ContextCompat.getDrawable( context, res_id );
|
||||
if( d == null ) throw new RuntimeException( String.format( Locale.JAPAN,"getDrawable failed. drawable_id=0x%x",res_id));
|
||||
return d;
|
||||
}
|
||||
|
||||
static int getAttributeResourceId(@NonNull Context context, int attr_id ){
|
||||
Resources.Theme theme = context.getTheme();
|
||||
TypedArray a = theme.obtainStyledAttributes( new int[]{ attr_id } );
|
||||
int res_id = a.getResourceId( 0, 0 );
|
||||
a.recycle();
|
||||
if( res_id == 0) throw new RuntimeException( String.format( Locale.JAPAN,"attr not defined.attr_id=0x%x",attr_id));
|
||||
return res_id;
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 363 B |
After Width: | Height: | Size: 601 B |
After Width: | Height: | Size: 933 B |
Before Width: | Height: | Size: 583 B |
After Width: | Height: | Size: 378 B |
After Width: | Height: | Size: 658 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 971 B |
After Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 971 B |
After Width: | Height: | Size: 277 B |
After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 617 B |
After Width: | Height: | Size: 601 B |
After Width: | Height: | Size: 361 B |
After Width: | Height: | Size: 341 B |
After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 537 B |
After Width: | Height: | Size: 529 B |
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 872 B |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 747 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 252 B |
After Width: | Height: | Size: 230 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 430 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 419 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 212 B |
After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 363 B |
After Width: | Height: | Size: 367 B |
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 124 B |
After Width: | Height: | Size: 427 B |
Before Width: | Height: | Size: 470 B |
After Width: | Height: | Size: 551 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 480 B |
After Width: | Height: | Size: 219 B |
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 173 B |
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#FF808080">
|
||||
<item android:drawable="@color/color_column_header" />
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?attr/colorRippleEffect"
|
||||
>
|
||||
<item android:drawable="?attr/color_column_header" />
|
||||
</ripple>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#FF808080">
|
||||
android:color="?attr/colorRippleEffect">
|
||||
<item android:id="@android:id/mask" android:drawable="@android:color/white" />
|
||||
</ripple>
|
||||
|
|
Before Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 505 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 380 B |
After Width: | Height: | Size: 779 B |