カラム種別に応じたアイコンをヘッダと一覧に表示
|
@ -8,6 +8,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.woxthebox.draglistview.DragItem;
|
||||
|
@ -200,6 +201,7 @@ public class ActColumnList extends AppCompatActivity {
|
|||
int acct_color_bg;
|
||||
boolean bOldSelection;
|
||||
int old_index;
|
||||
int type;
|
||||
|
||||
MyItem( JSONObject src, long id, Context context ){
|
||||
this.json = src;
|
||||
|
@ -211,6 +213,7 @@ public class ActColumnList extends AppCompatActivity {
|
|||
this.acct_color_bg = c;
|
||||
this.old_index = src.optInt( Column.KEY_OLD_INDEX );
|
||||
this.id = id;
|
||||
this.type = src.optInt( Column.KEY_TYPE );
|
||||
}
|
||||
|
||||
void setOldSelection( boolean b ){
|
||||
|
@ -219,10 +222,11 @@ public class ActColumnList extends AppCompatActivity {
|
|||
}
|
||||
|
||||
// リスト要素のViewHolder
|
||||
static class MyViewHolder extends DragItemAdapter.ViewHolder {
|
||||
class MyViewHolder extends DragItemAdapter.ViewHolder {
|
||||
final View ivBookmark;
|
||||
final TextView tvAccess;
|
||||
final TextView tvName;
|
||||
final ImageView ivColumnIcon;
|
||||
final int acct_pad_lr;
|
||||
|
||||
MyViewHolder( final View viewRoot ){
|
||||
|
@ -234,9 +238,9 @@ public class ActColumnList extends AppCompatActivity {
|
|||
ivBookmark = viewRoot.findViewById( R.id.ivBookmark );
|
||||
tvAccess = (TextView) viewRoot.findViewById( R.id.tvAccess );
|
||||
tvName = (TextView) viewRoot.findViewById( R.id.tvName );
|
||||
|
||||
ivColumnIcon = (ImageView) viewRoot.findViewById( R.id.ivColumnIcon );
|
||||
acct_pad_lr = (int) ( 0.5f + 4f * viewRoot.getResources().getDisplayMetrics().density );
|
||||
|
||||
|
||||
// リスト要素のビューが ListSwipeItem だった場合、Swipe操作を制御できる
|
||||
if( viewRoot instanceof ListSwipeItem ){
|
||||
ListSwipeItem lsi = (ListSwipeItem) viewRoot;
|
||||
|
@ -254,6 +258,8 @@ public class ActColumnList extends AppCompatActivity {
|
|||
tvAccess.setBackgroundColor( item.acct_color_bg );
|
||||
tvAccess.setPaddingRelative( acct_pad_lr, 0, acct_pad_lr, 0 );
|
||||
tvName.setText( item.name );
|
||||
ivColumnIcon.setImageResource( Styler.getAttributeResourceId(
|
||||
ActColumnList.this, Column.getIconAttrId( item.type ) ) );
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -287,6 +293,10 @@ public class ActColumnList extends AppCompatActivity {
|
|||
tv = (TextView) dragView.findViewById( R.id.tvName );
|
||||
tv.setText( item.name );
|
||||
|
||||
ImageView ivColumnIcon = (ImageView) dragView.findViewById( R.id.ivColumnIcon );
|
||||
ivColumnIcon.setImageResource( Styler.getAttributeResourceId(
|
||||
ActColumnList.this, Column.getIconAttrId( item.type ) ) );
|
||||
|
||||
dragView.findViewById( R.id.ivBookmark ).setVisibility(
|
||||
clickedView.findViewById( R.id.ivBookmark ).getVisibility()
|
||||
);
|
||||
|
|
|
@ -42,6 +42,7 @@ import jp.juggler.subwaytooter.util.Utils;
|
|||
class Column {
|
||||
private static final LogCategory log = new LogCategory( "Column" );
|
||||
public static final java.lang.String KEY_COLUMN_COLOR = "color";
|
||||
|
||||
private static Object getParamAt( Object[] params, int idx ){
|
||||
if( params == null || idx >= params.length ){
|
||||
throw new IndexOutOfBoundsException( "getParamAt idx=" + idx );
|
||||
|
@ -79,10 +80,10 @@ class Column {
|
|||
private static final String PATH_STATUSES = "/api/v1/statuses/%d"; // 1:status_id
|
||||
private static final String PATH_STATUSES_CONTEXT = "/api/v1/statuses/%d/context"; // 1:status_id
|
||||
private static final String PATH_SEARCH = "/api/v1/search?q=%s"; // 1: query(urlencoded) , also, append "&resolve=1" if resolve non-local accounts
|
||||
private static final String PATH_INSTANCE="/api/v1/instance";
|
||||
private static final String PATH_INSTANCE = "/api/v1/instance";
|
||||
|
||||
private static final String KEY_ACCOUNT_ROW_ID = "account_id";
|
||||
private static final String KEY_TYPE = "type";
|
||||
static final String KEY_TYPE = "type";
|
||||
static final String KEY_DONT_CLOSE = "dont_close";
|
||||
private static final String KEY_WITH_ATTACHMENT = "with_attachment";
|
||||
private static final String KEY_DONT_SHOW_BOOST = "dont_show_boost";
|
||||
|
@ -102,7 +103,6 @@ class Column {
|
|||
static final String KEY_COLUMN_NAME = "column_name";
|
||||
static final String KEY_OLD_INDEX = "old_index";
|
||||
|
||||
|
||||
static final int TYPE_HOME = 1;
|
||||
static final int TYPE_LOCAL = 2;
|
||||
static final int TYPE_FEDERATE = 3;
|
||||
|
@ -202,9 +202,9 @@ class Column {
|
|||
|
||||
// 以下は保存には必要ないが、カラムリスト画面で使う
|
||||
AcctColor ac = AcctColor.load( access_info.acct );
|
||||
item.put( KEY_COLUMN_ACCESS, AcctColor.hasNickname(ac) ? ac.nickname : access_info.acct );
|
||||
item.put( KEY_COLUMN_ACCESS_COLOR, AcctColor.hasColorForeground(ac) ? ac.color_fg : 0 );
|
||||
item.put( KEY_COLUMN_ACCESS_COLOR_BG, AcctColor.hasColorBackground( ac) ? ac.color_bg : 0 );
|
||||
item.put( KEY_COLUMN_ACCESS, AcctColor.hasNickname( ac ) ? ac.nickname : access_info.acct );
|
||||
item.put( KEY_COLUMN_ACCESS_COLOR, AcctColor.hasColorForeground( ac ) ? ac.color_fg : 0 );
|
||||
item.put( KEY_COLUMN_ACCESS_COLOR_BG, AcctColor.hasColorBackground( ac ) ? ac.color_bg : 0 );
|
||||
item.put( KEY_COLUMN_NAME, getColumnName( true ) );
|
||||
item.put( KEY_OLD_INDEX, old_index );
|
||||
}
|
||||
|
@ -311,8 +311,9 @@ class Column {
|
|||
return activity.getString( R.string.federate_timeline );
|
||||
|
||||
case TYPE_PROFILE:
|
||||
|
||||
return activity.getString( R.string.statuses_of
|
||||
, who_account != null ? access_info.getFullAcct( who_account ) : Long.toString( profile_id )
|
||||
, who_account != null ? AcctColor.getNickname( access_info.getFullAcct( who_account ) ) : Long.toString( profile_id )
|
||||
);
|
||||
|
||||
case TYPE_FAVOURITES:
|
||||
|
@ -342,17 +343,63 @@ class Column {
|
|||
}else{
|
||||
return activity.getString( R.string.search );
|
||||
}
|
||||
|
||||
|
||||
case TYPE_FOLLOW_REQUESTS:
|
||||
return activity.getString( R.string.follow_requests );
|
||||
}
|
||||
}
|
||||
|
||||
static int getIconAttrId(int type){
|
||||
switch( type ){
|
||||
|
||||
default:
|
||||
case TYPE_REPORTS:
|
||||
return R.attr.ic_info;
|
||||
|
||||
case TYPE_HOME:
|
||||
return R.attr.btn_home;
|
||||
|
||||
case TYPE_LOCAL:
|
||||
return R.attr.btn_local_tl;
|
||||
|
||||
case TYPE_FEDERATE:
|
||||
return R.attr.btn_federate_tl;
|
||||
|
||||
case TYPE_PROFILE:
|
||||
return R.attr.btn_statuses;
|
||||
|
||||
case TYPE_FAVOURITES:
|
||||
return R.attr.btn_favourite;
|
||||
|
||||
case TYPE_NOTIFICATIONS:
|
||||
return R.attr.btn_notification;
|
||||
|
||||
case TYPE_CONVERSATION:
|
||||
return R.attr.ic_conversation;
|
||||
|
||||
case TYPE_HASHTAG:
|
||||
return R.attr.ic_hashtag;
|
||||
|
||||
case TYPE_MUTES:
|
||||
return R.attr.ic_mute;
|
||||
|
||||
case TYPE_BLOCKS:
|
||||
return R.attr.ic_block;
|
||||
|
||||
case TYPE_SEARCH:
|
||||
return R.attr.ic_search;
|
||||
|
||||
case TYPE_FOLLOW_REQUESTS:
|
||||
return R.attr.ic_account_add;
|
||||
}
|
||||
}
|
||||
|
||||
void onNicknameUpdated(){
|
||||
|
||||
|
||||
fireVisualCallback2();
|
||||
}
|
||||
|
||||
|
||||
interface StatusEntryCallback {
|
||||
void onIterate( TootStatus status );
|
||||
}
|
||||
|
@ -482,7 +529,7 @@ class Column {
|
|||
fireVisualCallback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 自分のステータスを削除した時に呼ばれる
|
||||
void removeStatus( SavedAccount target_account, long status_id ){
|
||||
|
||||
|
@ -518,6 +565,7 @@ class Column {
|
|||
|
||||
interface VisualCallback {
|
||||
void onVisualColumn();
|
||||
|
||||
void onVisualColumn2();
|
||||
}
|
||||
|
||||
|
@ -554,15 +602,16 @@ class Column {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
void fireVisualCallback(){
|
||||
Utils.runOnMainThread( proc_fireVisualCallback );
|
||||
}
|
||||
|
||||
|
||||
// カラムヘッダ部分だけ更新する
|
||||
void fireVisualCallback2(){
|
||||
Utils.runOnMainThread( proc_fireVisualCallback2 );
|
||||
}
|
||||
|
||||
|
||||
private AsyncTask< Void, Void, TootApiResult > last_task;
|
||||
|
||||
private void cancelLastTask(){
|
||||
|
@ -876,8 +925,8 @@ class Column {
|
|||
|
||||
default:
|
||||
case TAB_STATUS:
|
||||
if( access_info.isPseudo()){
|
||||
return client.request(PATH_INSTANCE );
|
||||
if( access_info.isPseudo() ){
|
||||
return client.request( PATH_INSTANCE );
|
||||
|
||||
}else{
|
||||
String s = String.format( Locale.JAPAN, PATH_ACCOUNT_STATUSES, profile_id );
|
||||
|
@ -885,7 +934,6 @@ class Column {
|
|||
return getStatuses( client, s );
|
||||
|
||||
}
|
||||
|
||||
|
||||
case TAB_FOLLOWING:
|
||||
return parseAccountList( client,
|
||||
|
@ -1418,8 +1466,8 @@ class Column {
|
|||
|
||||
default:
|
||||
case TAB_STATUS:
|
||||
if( access_info.isPseudo()){
|
||||
return client.request(PATH_INSTANCE );
|
||||
if( access_info.isPseudo() ){
|
||||
return client.request( PATH_INSTANCE );
|
||||
}else{
|
||||
String s = String.format( Locale.JAPAN, PATH_ACCOUNT_STATUSES, profile_id );
|
||||
if( with_attachment ) s = s + "&only_media=1";
|
||||
|
@ -1439,7 +1487,7 @@ class Column {
|
|||
|
||||
case TYPE_BLOCKS:
|
||||
return getAccountList( client, PATH_BLOCKS );
|
||||
|
||||
|
||||
case TYPE_FOLLOW_REQUESTS:
|
||||
return getAccountList( client, PATH_FOLLOW_REQUESTS );
|
||||
|
||||
|
@ -1800,8 +1848,8 @@ class Column {
|
|||
default:
|
||||
case TAB_STATUS:
|
||||
|
||||
if( access_info.isPseudo()){
|
||||
return client.request(PATH_INSTANCE );
|
||||
if( access_info.isPseudo() ){
|
||||
return client.request( PATH_INSTANCE );
|
||||
|
||||
}else{
|
||||
String s = String.format( Locale.JAPAN, PATH_ACCOUNT_STATUSES, profile_id );
|
||||
|
@ -1880,16 +1928,14 @@ class Column {
|
|||
list_new.add( o );
|
||||
}
|
||||
|
||||
|
||||
|
||||
int pos = list_data.indexOf( gap );
|
||||
if( pos != - 1 ){
|
||||
|
||||
|
||||
list_data.remove( pos );
|
||||
list_data.addAll( pos, list_new );
|
||||
|
||||
// リフレッシュ開始時はリストの先頭を見ていたのだからスクロール範囲を調整したい
|
||||
scroll_hack = pos + list_new.size() -2;
|
||||
scroll_hack = pos + list_new.size() - 2;
|
||||
if( scroll_hack < 1 ) scroll_hack = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1922,7 +1968,7 @@ class Column {
|
|||
private void updateRelation( TootApiClient client, ArrayList< Object > list_tmp ){
|
||||
if( list_tmp == null || list_tmp.isEmpty() ) return;
|
||||
HashSet< Long > who_set = new HashSet<>();
|
||||
HashSet<String> acct_set = new HashSet<>();
|
||||
HashSet< String > acct_set = new HashSet<>();
|
||||
{
|
||||
TootAccount a;
|
||||
TootStatus s;
|
||||
|
@ -1931,20 +1977,20 @@ class Column {
|
|||
if( o instanceof TootAccount ){
|
||||
a = (TootAccount) o;
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}else if( o instanceof TootStatus ){
|
||||
s = (TootStatus) o;
|
||||
a = s.account;
|
||||
if( a != null ){
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}
|
||||
s = s.reblog;
|
||||
if( s != null ){
|
||||
a = s.account;
|
||||
if( a != null ){
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}
|
||||
}
|
||||
}else if( o instanceof TootNotification ){
|
||||
|
@ -1953,7 +1999,7 @@ class Column {
|
|||
a = n.account;
|
||||
if( a != null ){
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}
|
||||
//
|
||||
s = n.status;
|
||||
|
@ -1961,14 +2007,14 @@ class Column {
|
|||
a = s.account;
|
||||
if( a != null ){
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}
|
||||
s = s.reblog;
|
||||
if( s != null ){
|
||||
a = s.account;
|
||||
if( a != null ){
|
||||
who_set.add( a.id );
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ));
|
||||
acct_set.add( "@" + access_info.getFullAcct( a ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2020,16 +2066,15 @@ class Column {
|
|||
long now = System.currentTimeMillis();
|
||||
int n = 0;
|
||||
while( n < size ){
|
||||
int length = size-n;
|
||||
int length = size - n;
|
||||
if( length > ACCT_DB_STEP ) length = ACCT_DB_STEP;
|
||||
AcctSet.saveList( now, acct_list, n,length );
|
||||
AcctSet.saveList( now, acct_list, n, length );
|
||||
n += length;
|
||||
}
|
||||
log.d( "updateRelation: update %d acct.", n );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,6 +97,8 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
private EditText etRegexFilter;
|
||||
private TextView tvRegexFilterError;
|
||||
private View btnColumnClose;
|
||||
private ImageView ivColumnIcon;
|
||||
|
||||
private boolean bSimpleList;
|
||||
|
||||
void onPageCreate( View root, int page_idx, int page_count ){
|
||||
|
@ -109,7 +111,7 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
|
||||
tvColumnName = (TextView) root.findViewById( R.id.tvColumnName );
|
||||
tvColumnContext = (TextView) root.findViewById( R.id.tvColumnContext );
|
||||
|
||||
ivColumnIcon = (ImageView) root.findViewById( R.id.ivColumnIcon );
|
||||
btnColumnClose = root.findViewById( R.id.btnColumnClose );
|
||||
|
||||
btnColumnClose.setOnClickListener( this );
|
||||
|
@ -409,6 +411,8 @@ class ColumnViewHolder implements View.OnClickListener, Column.VisualCallback, S
|
|||
|
||||
showColumnCloseButton();
|
||||
|
||||
ivColumnIcon.setImageResource( Styler.getAttributeResourceId( activity, Column.getIconAttrId(column.type) ) );
|
||||
|
||||
}
|
||||
|
||||
private void showColumnCloseButton(){
|
||||
|
|
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 648 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 434 B |
After Width: | Height: | Size: 977 B |
After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
|
@ -87,6 +87,12 @@
|
|||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:id="@+id/ivColumnIcon"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tvName"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -58,6 +58,12 @@
|
|||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:id="@+id/ivColumnIcon"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tvColumnName"
|
||||
android:layout_width="0dp"
|
||||
|
@ -102,7 +108,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -107,5 +107,6 @@
|
|||
<attr name="ic_account_remove" format="reference" />
|
||||
<attr name="ic_hourglass" format="reference" />
|
||||
<attr name="ic_edit" format="reference" />
|
||||
<attr name="ic_hashtag" format="reference" />
|
||||
|
||||
</resources>
|
|
@ -72,6 +72,7 @@
|
|||
<item name="ic_account_remove">@drawable/ic_account_remove</item>
|
||||
<item name="ic_hourglass">@drawable/ic_hourglass</item>
|
||||
<item name="ic_edit">@drawable/ic_edit</item>
|
||||
<item name="ic_hashtag">@drawable/ic_hashtag</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
@ -152,6 +153,7 @@
|
|||
<item name="ic_account_remove">@drawable/ic_account_remove_dark</item>
|
||||
<item name="ic_hourglass">@drawable/ic_hourglass_dark</item>
|
||||
<item name="ic_edit">@drawable/ic_edit_dark</item>
|
||||
<item name="ic_hashtag">@drawable/ic_hashtag_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark.NoActionBar" parent="AppTheme.Dark">
|
||||
|
|