とりあえずメイン画面の表示だけタブレット対応した

This commit is contained in:
tateisu 2017-05-12 23:10:02 +09:00
parent d4899af01d
commit af2fade576
16 changed files with 1132 additions and 487 deletions

File diff suppressed because it is too large Load Diff

View File

@ -714,6 +714,11 @@ class Column implements StreamReader.Callback {
if( holder != null ) holder.showColumnHeader(); if( holder != null ) holder.showColumnHeader();
} }
}; };
private final Runnable proc_showColumnColor = new Runnable() {
@Override public void run(){
if( holder != null ) holder.showColumnColor();
}
};
void fireShowContent(){ void fireShowContent(){
Utils.runOnMainThread( proc_showContent ); Utils.runOnMainThread( proc_showContent );
@ -724,6 +729,11 @@ class Column implements StreamReader.Callback {
Utils.runOnMainThread( proc_showColumnHeader ); Utils.runOnMainThread( proc_showColumnHeader );
} }
void fireColumnColor(){
Utils.runOnMainThread( proc_showColumnColor );
}
private AsyncTask< Void, Void, TootApiResult > last_task; private AsyncTask< Void, Void, TootApiResult > last_task;
private void cancelLastTask(){ private void cancelLastTask(){

View File

@ -37,46 +37,6 @@ class ColumnPagerAdapter extends PagerAdapter {
return holder_list.get( idx ); return holder_list.get( idx );
} }
int addColumn( ViewPager pager, Column column ){
return addColumn( pager, column, pager.getCurrentItem() + 1 );
}
int addColumn( ViewPager pager, Column column, int index ){
int size = column_list.size();
if( index > size ) index = size;
pager.setAdapter( null );
column_list.add( index, column );
pager.setAdapter( this );
return index;
}
void removeColumn( ViewPager pager, Column column ){
int idx_column = column_list.indexOf( column );
if( idx_column == - 1 ) return;
pager.setAdapter( null );
column_list.remove( idx_column ).dispose();
pager.setAdapter( this );
}
void setOrder( ViewPager pager, ArrayList< Integer > order ){
pager.setAdapter( null );
ArrayList< Column > tmp_list = new ArrayList<>();
HashSet< Integer > used_set = new HashSet<>();
for( Integer i : order ){
used_set.add( i );
tmp_list.add( column_list.get( i ) );
}
for( int i = 0, ie = column_list.size() ; i < ie ; ++ i ){
if( used_set.contains( i ) ) continue;
column_list.get( i ).dispose();
}
column_list.clear();
column_list.addAll( tmp_list );
pager.setAdapter( this );
}
@Override public CharSequence getPageTitle( int page_idx ){ @Override public CharSequence getPageTitle( int page_idx ){
return getColumn( page_idx).getColumnName( false ); return getColumn( page_idx).getColumnName( false );
@ -108,7 +68,7 @@ class ColumnPagerAdapter extends PagerAdapter {
ColumnViewHolder holder = holder_list.get( page_idx ); ColumnViewHolder holder = holder_list.get( page_idx );
holder_list.remove( page_idx ); holder_list.remove( page_idx );
if( holder != null ){ if( holder != null ){
holder.is_destroyed.set( true );
holder.onPageDestroy( view ); holder.onPageDestroy( view );
} }
} }

View File

@ -54,6 +54,7 @@ class ColumnViewHolder
void onPageDestroy( @SuppressWarnings("UnusedParameters") View root ){ void onPageDestroy( @SuppressWarnings("UnusedParameters") View root ){
log.d( "onPageDestroy:%s", column.getColumnName( true ) ); log.d( "onPageDestroy:%s", column.getColumnName( true ) );
is_destroyed.set( true );
saveScrollPosition(); saveScrollPosition();

View File

@ -33,6 +33,7 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
@NonNull private final TootAccount who; @NonNull private final TootAccount who;
@Nullable private final TootStatus status; @Nullable private final TootStatus status;
@NonNull private final UserRelation relation; @NonNull private final UserRelation relation;
@NonNull private final Column column;
private final Dialog dialog; private final Dialog dialog;
@ -41,15 +42,16 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
DlgContextMenu( DlgContextMenu(
@NonNull ActMain activity @NonNull ActMain activity
, @NonNull SavedAccount access_info , @NonNull Column column
, @NonNull TootAccount who , @NonNull TootAccount who
, @Nullable TootStatus status , @Nullable TootStatus status
, int column_type
){ ){
this.activity = activity; this.activity = activity;
this.access_info = access_info; this.column = column;
this.access_info = column.access_info;
this.who = who; this.who = who;
this.status = status; this.status = status;
int column_type = column.column_type;
this.relation = UserRelation.load( access_info.db_id, who.id ); this.relation = UserRelation.load( access_info.db_id, who.id );
@ -235,11 +237,13 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
dialog.dismiss(); dialog.dismiss();
int pos = activity.nextPosition( column ) ;
switch( v.getId() ){ switch( v.getId() ){
case R.id.btnStatusWebPage: case R.id.btnStatusWebPage:
if( status != null ){ if( status != null ){
activity.openChromeTab( access_info, status.url, true ); activity.openChromeTab(pos,access_info, status.url, true );
} }
break; break;
@ -318,13 +322,13 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
case R.id.btnBoostedBy: case R.id.btnBoostedBy:
if( status != null ){ if( status != null ){
activity.addColumn( access_info, Column.TYPE_BOOSTED_BY, status.id ); activity.addColumn( pos,access_info, Column.TYPE_BOOSTED_BY, status.id );
} }
break; break;
case R.id.btnFavouritedBy: case R.id.btnFavouritedBy:
if( status != null ){ if( status != null ){
activity.addColumn( access_info, Column.TYPE_FAVOURITED_BY, status.id ); activity.addColumn( pos,access_info, Column.TYPE_FAVOURITED_BY, status.id );
} }
break; break;
@ -371,7 +375,7 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
break; break;
case R.id.btnProfile: case R.id.btnProfile:
activity.performOpenUser( access_info, who ); activity.performOpenUser( pos,access_info, who );
break; break;
case R.id.btnSendMessage: case R.id.btnSendMessage:
@ -379,7 +383,7 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
break; break;
case R.id.btnAccountWebPage: case R.id.btnAccountWebPage:
activity.openChromeTab( access_info, who.url, true ); activity.openChromeTab( pos, access_info, who.url, true );
break; break;
case R.id.btnFollowRequestOK: case R.id.btnFollowRequestOK:
@ -399,7 +403,7 @@ class DlgContextMenu implements View.OnClickListener, View.OnLongClickListener {
break; break;
case R.id.btnOpenProfileFromAnotherAccount: case R.id.btnOpenProfileFromAnotherAccount:
activity.performOpenUserFromAnotherAccount( who, account_list_non_pseudo_same_instance ); activity.performOpenUserFromAnotherAccount( pos,who, account_list_non_pseudo_same_instance );
break; break;
case R.id.btnNickname: case R.id.btnNickname:

View File

@ -17,7 +17,7 @@ import jp.juggler.subwaytooter.view.MyLinkMovementMethod;
import jp.juggler.subwaytooter.view.MyNetworkImageView; import jp.juggler.subwaytooter.view.MyNetworkImageView;
class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener { class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener {
private final Column column; final Column column;
private final ActMain activity; private final ActMain activity;
private final SavedAccount access_info; private final SavedAccount access_info;
@ -106,12 +106,13 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
@Override @Override
public void onClick( View v ){ public void onClick( View v ){
switch( v.getId() ){ switch( v.getId() ){
case R.id.ivBackground: case R.id.ivBackground:
if( who != null ){ if( who != null ){
// 強制的にブラウザで開く // 強制的にブラウザで開く
activity.openChromeTab( access_info, who.url, true ); activity.openChromeTab( activity.nextPosition( column ), access_info, who.url, true );
} }
break; break;
@ -135,13 +136,13 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
case R.id.btnMore: case R.id.btnMore:
if( who != null ){ if( who != null ){
new DlgContextMenu( activity, access_info, who, null, column.column_type ).show(); new DlgContextMenu( activity, column, who, null ).show();
} }
break; break;
case R.id.btnFollow: case R.id.btnFollow:
if( who != null ){ if( who != null ){
new DlgContextMenu( activity, access_info, who, null, column.column_type ).show(); new DlgContextMenu( activity, column, who, null ).show();
} }
break; break;

View File

@ -385,6 +385,9 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
} }
@Override public void onClick( View v ){ @Override public void onClick( View v ){
int pos = activity.nextPosition( column ) ;
switch( v.getId() ){ switch( v.getId() ){
case R.id.btnHideMedia: case R.id.btnHideMedia:
MediaShown.save( access_info.host, status.id, false ); MediaShown.save( access_info.host, status.id, false );
@ -415,33 +418,33 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
case R.id.ivThumbnail: case R.id.ivThumbnail:
if( access_info.isPseudo() ){ if( access_info.isPseudo() ){
new DlgContextMenu( activity, access_info, account_thumbnail, null, column.column_type ).show(); new DlgContextMenu( activity, column, account_thumbnail, null ).show();
}else{ }else{
activity.performOpenUser( access_info, account_thumbnail ); activity.performOpenUser( pos,access_info, account_thumbnail );
} }
break; break;
case R.id.llBoosted: case R.id.llBoosted:
if( access_info.isPseudo() ){ if( access_info.isPseudo() ){
new DlgContextMenu( activity, access_info, account_boost, null, column.column_type ).show(); new DlgContextMenu( activity, column, account_boost, null ).show();
}else{ }else{
activity.performOpenUser( access_info, account_boost ); activity.performOpenUser( pos,access_info, account_boost );
} }
break; break;
case R.id.llFollow: case R.id.llFollow:
if( access_info.isPseudo() ){ if( access_info.isPseudo() ){
new DlgContextMenu( activity, access_info, account_follow, null, column.column_type ).show(); new DlgContextMenu( activity, column, account_follow, null ).show();
}else{ }else{
activity.performOpenUser( access_info, account_follow ); activity.performOpenUser( pos,access_info, account_follow );
} }
break; break;
case R.id.btnFollow: case R.id.btnFollow:
new DlgContextMenu( activity, access_info, account_follow, null, column.column_type ).show(); new DlgContextMenu( activity, column, account_follow, null ).show();
break; break;
case R.id.btnSearchTag: case R.id.btnSearchTag:
if( search_tag != null ){ if( search_tag != null ){
activity.openHashTag( access_info, search_tag ); activity.openHashTag( pos,access_info, search_tag );
}else if( gap != null ){ }else if( gap != null ){
column.startGap( gap, position ); column.startGap( gap, position );
} }
@ -453,7 +456,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
switch( v.getId() ){ switch( v.getId() ){
case R.id.ivThumbnail: case R.id.ivThumbnail:
new DlgContextMenu( activity, access_info, account_thumbnail, null, column.column_type ).show(); new DlgContextMenu( activity, column, account_thumbnail, null ).show();
return true; return true;
case R.id.btnFollow: case R.id.btnFollow:
@ -481,7 +484,8 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener {
sv = a.url; sv = a.url;
} }
} }
activity.openChromeTab( access_info, sv, false ); int pos = activity.nextPosition( column ) ;
activity.openChromeTab(pos, access_info, sv, false );
}catch( Throwable ex ){ }catch( Throwable ex ){
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -113,7 +113,7 @@ class StatusButtons implements View.OnClickListener, View.OnLongClickListener {
if( close_window != null ) close_window.dismiss(); if( close_window != null ) close_window.dismiss();
switch( v.getId() ){ switch( v.getId() ){
case R.id.btnConversation: case R.id.btnConversation:
activity.openStatus( access_info, status ); activity.openStatus( activity.nextPosition( column ), access_info, status );
break; break;
case R.id.btnReply: case R.id.btnReply:
if( access_info.isPseudo() ){ if( access_info.isPseudo() ){
@ -152,7 +152,7 @@ class StatusButtons implements View.OnClickListener, View.OnLongClickListener {
break; break;
case R.id.btnMore: case R.id.btnMore:
new DlgContextMenu( activity, access_info, status.account, status, column.column_type ).show(); new DlgContextMenu( activity, column, status.account, status ).show();
break; break;
case R.id.btnFollow2: case R.id.btnFollow2:

View File

@ -0,0 +1,54 @@
package jp.juggler.subwaytooter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
class TabletColumnPagerAdapter extends RecyclerView.Adapter<TabletColumnViewHolder >{
private final ActMain activity;
private final LayoutInflater mLayoutInflater;
private final List<Column> column_list;
TabletColumnPagerAdapter( ActMain activity ){
super();
this.activity = activity;
this.column_list = activity.app_state.column_list;
mLayoutInflater = LayoutInflater.from( activity );
}
@Override public int getItemCount(){
return column_list.size();
}
private int mColumnWidth = 0;
void setColumnWidth( int width ){
mColumnWidth = width;
}
@Override public TabletColumnViewHolder onCreateViewHolder( ViewGroup parent, int viewType ){
View v = mLayoutInflater.inflate( R.layout.page_column, parent, false );
return new TabletColumnViewHolder( v );
}
@Override public void onBindViewHolder( TabletColumnViewHolder holder, int position ){
if( mColumnWidth > 0 ){
ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams();
lp.width = mColumnWidth;
holder.itemView.setLayoutParams( lp );
}
holder.bind( activity, column_list.get(position), position , column_list.size() );
}
}

View File

@ -0,0 +1,37 @@
package jp.juggler.subwaytooter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import jp.juggler.subwaytooter.util.LogCategory;
class TabletColumnViewHolder extends RecyclerView.ViewHolder{
static final LogCategory log = new LogCategory( "TabletColumnViewHolder" );
ColumnViewHolder vh;
private int old_position;
TabletColumnViewHolder( View v ){
super( v );
v.findViewById( R.id.vTabletDivider ).setVisibility( View.VISIBLE );
}
void bind( ActMain activity, Column column,int position,int column_count ){
if( vh != null ){
log.d("destroy #%s",old_position);
vh.onPageDestroy( itemView );
vh = null;
}
old_position = position;
log.d("create #%s",position);
vh =new ColumnViewHolder( activity, column);
vh.onPageCreate( itemView,position,column_count );
if( ! column.bFirstInitialized ){
column.startLoading();
}
}
}

View File

@ -9,7 +9,7 @@ import jp.juggler.subwaytooter.table.AcctColor;
public class MyClickableSpan extends ClickableSpan { public class MyClickableSpan extends ClickableSpan {
public interface LinkClickCallback { public interface LinkClickCallback {
void onClickLink( LinkClickContext account, String url ); void onClickLink( View widget,LinkClickContext account, String url );
} }
public static LinkClickCallback link_callback; public static LinkClickCallback link_callback;
@ -30,7 +30,7 @@ public class MyClickableSpan extends ClickableSpan {
@Override public void onClick( View widget ){ @Override public void onClick( View widget ){
if( link_callback != null ){ if( link_callback != null ){
link_callback.onClickLink( this.account, url ); link_callback.onClickLink( widget,this.account, url );
} }
} }

View File

@ -0,0 +1,174 @@
package jp.juggler.subwaytooter.view;
import android.annotation.SuppressLint;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.LinearSnapHelper;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
/**
* Created by tateisu on 2017/05/12.
*/
public class GravitySnapHelper extends LinearSnapHelper {
private OrientationHelper verticalHelper;
private OrientationHelper horizontalHelper;
private int gravity;
private boolean isRTL;
@SuppressLint("RtlHardcoded")
public GravitySnapHelper(int gravity) {
this.gravity = gravity;
if (this.gravity == Gravity.LEFT) {
this.gravity = Gravity.START;
} else if (this.gravity == Gravity.RIGHT) {
this.gravity = Gravity.END;
}
}
@Override
public void attachToRecyclerView(@Nullable RecyclerView recyclerView)
throws IllegalStateException {
if (recyclerView != null) {
isRTL = ViewCompat.getLayoutDirection(recyclerView) == ViewCompat.LAYOUT_DIRECTION_RTL;
}
super.attachToRecyclerView(recyclerView);
}
@Override
public int[] calculateDistanceToFinalSnap(
@NonNull RecyclerView.LayoutManager layoutManager
,@NonNull View targetView
) {
int[] out = new int[2];
if (layoutManager.canScrollHorizontally()) {
if (gravity == Gravity.START) {
out[0] = distanceToStart(targetView, getHorizontalHelper(layoutManager));
} else { // END
out[0] = distanceToEnd(targetView, getHorizontalHelper(layoutManager));
}
} else {
out[0] = 0;
}
if (layoutManager.canScrollVertically()) {
if (gravity == Gravity.TOP) {
out[1] = distanceToStart(targetView, getVerticalHelper(layoutManager));
} else { // BOTTOM
out[1] = distanceToEnd(targetView, getVerticalHelper(layoutManager));
}
} else {
out[1] = 0;
}
return out;
}
@Override
public View findSnapView(RecyclerView.LayoutManager layoutManager) {
if (layoutManager instanceof LinearLayoutManager ) {
switch (gravity) {
case Gravity.START:
return findStartView(layoutManager, getHorizontalHelper(layoutManager));
case Gravity.TOP:
return findStartView(layoutManager, getVerticalHelper(layoutManager));
case Gravity.END:
return findEndView(layoutManager, getHorizontalHelper(layoutManager));
case Gravity.BOTTOM:
return findEndView(layoutManager, getVerticalHelper(layoutManager));
}
}
return super.findSnapView(layoutManager);
}
private int distanceToStart(View targetView, OrientationHelper helper) {
if ( isRTL ) {
return distanceToEnd(targetView, helper);
}
return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
private int distanceToEnd(View targetView, OrientationHelper helper) {
if ( isRTL ) {
return helper.getDecoratedStart(targetView) - helper.getStartAfterPadding();
}
return helper.getDecoratedEnd(targetView) - helper.getEndAfterPadding();
}
private View findStartView(RecyclerView.LayoutManager layoutManager,
OrientationHelper helper) {
if (layoutManager instanceof LinearLayoutManager) {
int firstChild = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition();
if (firstChild == RecyclerView.NO_POSITION) {
return null;
}
View child = layoutManager.findViewByPosition(firstChild);
if (helper.getDecoratedEnd(child) >= helper.getDecoratedMeasurement(child) / 2
&& helper.getDecoratedEnd(child) > 0) {
return child;
} else {
if (((LinearLayoutManager) layoutManager).findLastCompletelyVisibleItemPosition()
== layoutManager.getItemCount() - 1) {
return null;
} else {
return layoutManager.findViewByPosition(firstChild + 1);
}
}
}
return super.findSnapView(layoutManager);
}
private View findEndView(RecyclerView.LayoutManager layoutManager,
OrientationHelper helper) {
if (layoutManager instanceof LinearLayoutManager) {
int lastChild = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
if (lastChild == RecyclerView.NO_POSITION) {
return null;
}
View child = layoutManager.findViewByPosition(lastChild);
if (helper.getDecoratedStart(child) + helper.getDecoratedMeasurement(child) / 2
<= helper.getTotalSpace()) {
return child;
} else {
if (((LinearLayoutManager) layoutManager).findFirstCompletelyVisibleItemPosition()
== 0) {
return null;
} else {
return layoutManager.findViewByPosition(lastChild - 1);
}
}
}
return super.findSnapView(layoutManager);
}
private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) {
if (verticalHelper == null) {
verticalHelper = OrientationHelper.createVerticalHelper(layoutManager);
}
return verticalHelper;
}
private OrientationHelper getHorizontalHelper(RecyclerView.LayoutManager layoutManager) {
if (horizontalHelper == null) {
horizontalHelper = OrientationHelper.createHorizontalHelper(layoutManager);
}
return horizontalHelper;
}
}

View File

@ -0,0 +1,81 @@
package jp.juggler.subwaytooter.view;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.view.MotionEventCompat;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
public class MyRecyclerView extends RecyclerView {
public MyRecyclerView( Context context ){
super( context );
init(context);
}
public MyRecyclerView( Context context, @Nullable AttributeSet attrs ){
super( context, attrs );
init(context);
}
public MyRecyclerView( Context context, @Nullable AttributeSet attrs, int defStyle ){
super( context, attrs, defStyle );
init(context);
}
private void init( Context context ){
final ViewConfiguration vc = ViewConfiguration.get(context);
mTouchSlop = vc.getScaledTouchSlop();
}
boolean mForbidStartDragging;
int mScrollPointerId;
int mInitialTouchX;
int mInitialTouchY;
int mTouchSlop;
@Override
public boolean onInterceptTouchEvent( MotionEvent e ){
final int action = MotionEventCompat.getActionMasked( e );
// final int actionIndex = MotionEventCompat.getActionIndex( e );
switch( action ){
case MotionEvent.ACTION_DOWN:
mForbidStartDragging = false;
mScrollPointerId = e.getPointerId(0);
mInitialTouchX = (int) (e.getX() + 0.5f);
mInitialTouchY = (int) (e.getY() + 0.5f);
break;
case MotionEvent.ACTION_MOVE:
final int index = e.findPointerIndex( mScrollPointerId );
if( index >= 0 ){
if( mForbidStartDragging ) return false;
final int x = (int) ( e.getX( index ) + 0.5f );
final int y = (int) ( e.getY( index ) + 0.5f );
boolean canScrollHorizontally = getLayoutManager().canScrollHorizontally();
boolean canScrollVertically = getLayoutManager().canScrollVertically();
final int dx = x - mInitialTouchX;
final int dy = y - mInitialTouchY;
if( ( ! canScrollVertically && Math.abs( dy ) > mTouchSlop )
|| ( ! canScrollHorizontally && Math.abs( dx ) > mTouchSlop )
){
mForbidStartDragging = true;
return false;
}
}
break;
}
return super.onInterceptTouchEvent( e );
}
}

View File

@ -0,0 +1,50 @@
//package jp.juggler.subwaytooter.view;
//
//import android.content.Context;
//import android.content.res.TypedArray;
//import android.graphics.Canvas;
//import android.graphics.Paint;
//import android.graphics.Rect;
//import android.support.v7.widget.RecyclerView;
//import android.view.View;
//
//import jp.juggler.subwaytooter.R;
//import jp.juggler.subwaytooter.Styler;
//
//public class TabletColumnDivider extends RecyclerView.ItemDecoration {
//
// final Paint paint = new Paint();
// int width;
//
// public TabletColumnDivider(Context context) {
//
// width = (int)(0.5f + 1f * context.getResources().getDisplayMetrics().density);
// int color = Styler.getAttributeColor(context, R.attr.colorSettingDivider);
//
// paint.setColor( color );
// }
//
// @Override public void onDraw( Canvas c, RecyclerView parent, RecyclerView.State state) {
// drawDivider(c, parent);
// }
//
// void drawDivider(Canvas c, RecyclerView parent) {
// final int t = parent.getPaddingTop();
// final int b = parent.getHeight() - parent.getPaddingBottom();
//
// final int childCount = parent.getChildCount();
// for (int i = 0; i < childCount; i++) {
// final View child = parent.getChildAt(i);
// final int r = child.getRight();
// final int l = r - width;
// c.drawRect( l,t,r,b,paint );
//
// }
// }
//
// @Override
// public void getItemOffsets( Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
// outRect.set(width,0,width,0);
// }
//
//}

View File

@ -46,6 +46,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
/> />
<jp.juggler.subwaytooter.view.MyRecyclerView
android:id="@+id/rvPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout

View File

@ -1,130 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> >
<LinearLayout <LinearLayout
android:id="@+id/llColumnHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:background="@drawable/btn_bg_ddd" android:orientation="vertical">
android:orientation="vertical"
android:paddingBottom="3dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="3dp"
>
<LinearLayout <LinearLayout
android:id="@+id/llColumnHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="bottom" android:background="@drawable/btn_bg_ddd"
android:orientation="horizontal"
>
<TextView
android:id="@+id/tvColumnContext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:paddingEnd="4dp"
android:paddingStart="4dp"
android:textColor="?attr/colorColumnHeaderAcct"
android:textSize="12sp"
tools:text="tvColumnContext"
/>
<TextView
android:id="@+id/tvColumnIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="end"
android:textColor="?attr/colorColumnHeaderPageNumber"
android:textSize="12sp"
tools:text="col 6/12"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/ivColumnIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
/>
<TextView
android:id="@+id/tvColumnName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="tvColumnName"
/>
<ImageButton
android:id="@+id/btnColumnSetting"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/setting"
android:src="?attr/ic_tune"
/>
<ImageButton
android:id="@+id/btnColumnReload"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/reload"
android:src="?attr/btn_refresh"
/>
<ImageButton
android:id="@+id/btnColumnClose"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/close_column"
android:src="?attr/btn_close"
/>
</LinearLayout>
</LinearLayout>
<jp.juggler.subwaytooter.view.MaxHeightScrollView
android:id="@+id/llColumnSetting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:maxHeight="240dp"
android:fadeScrollbars="false"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorColumnSettingBackground"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="3dp" android:paddingBottom="3dp"
android:paddingEnd="12dp" android:paddingEnd="12dp"
@ -132,190 +24,315 @@
android:paddingTop="3dp" android:paddingTop="3dp"
> >
<CheckBox
android:id="@+id/cbDontCloseColumn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_close_column"
/>
<CheckBox
android:id="@+id/cbWithAttachment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/with_attachment"
/>
<CheckBox
android:id="@+id/cbDontShowBoost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_show_boost"
/>
<CheckBox
android:id="@+id/cbDontShowReply"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_show_reply"
/>
<CheckBox
android:id="@+id/cbDontStreaming"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_use_streaming_api"
/>
<CheckBox
android:id="@+id/cbDontAutoRefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_refresh_on_activity_resume"
/>
<CheckBox
android:id="@+id/cbHideMediaDefault"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hide_media_default"
/>
<LinearLayout <LinearLayout
android:id="@+id/llRegexFilter"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="horizontal" android:orientation="horizontal"
> >
<TextView <TextView
android:layout_width="wrap_content" android:id="@+id/tvColumnContext"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:labelFor="@+id/etRegexFilter" android:layout_weight="1"
android:text="@string/regex_filter" android:gravity="end"
android:textColor="?attr/colorColumnHeaderPageNumber" android:paddingEnd="4dp"
android:paddingStart="4dp"
android:textColor="?attr/colorColumnHeaderAcct"
android:textSize="12sp"
tools:text="tvColumnContext"
/> />
<TextView <TextView
android:id="@+id/tvRegexFilterError" android:id="@+id/tvColumnIndex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:gravity="end"
android:textColor="?attr/colorColumnHeaderPageNumber"
android:textSize="12sp"
tools:text="col 6/12"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/ivColumnIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="4dp"
android:importantForAccessibility="no"
/>
<TextView
android:id="@+id/tvColumnName"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_weight="1" android:layout_weight="1"
android:textColor="?attr/colorRegexFilterError" tools:text="tvColumnName"
/> />
<ImageButton
android:id="@+id/btnColumnSetting"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/setting"
android:src="?attr/ic_tune"
/>
<ImageButton
android:id="@+id/btnColumnReload"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/reload"
android:src="?attr/btn_refresh"
/>
<ImageButton
android:id="@+id/btnColumnClose"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="2dp"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/close_column"
android:src="?attr/btn_close"
/>
</LinearLayout> </LinearLayout>
<EditText
android:id="@+id/etRegexFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:scrollHorizontally="true"
/>
<Button
android:id="@+id/btnDeleteNotification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/notification_delete"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/color_and_background"
android:textAllCaps="false"
/>
</LinearLayout> </LinearLayout>
</jp.juggler.subwaytooter.view.MaxHeightScrollView>
<RelativeLayout <jp.juggler.subwaytooter.view.MaxHeightScrollView
android:id="@+id/llSearch" android:id="@+id/llColumnSetting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSearchFormBackground"
android:paddingBottom="3dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="3dp"
>
<ImageButton
android:id="@+id/btnSearch"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/search"
android:src="?attr/ic_search"
/>
<EditText
android:id="@+id/etSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toStartOf="@id/btnSearch" android:fadeScrollbars="false"
android:imeOptions="actionSearch" app:maxHeight="240dp"
android:inputType="text" >
tools:ignore="LabelFor"/>
<CheckBox <LinearLayout
android:id="@+id/cbResolve"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/etSearch"
android:text="@string/resolve_non_local_account"
/>
</RelativeLayout>
<FrameLayout
android:id="@+id/flColumnBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<ImageView
android:id="@+id/ivColumnBackgroundImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:visibility="gone"
/>
<TextView
android:id="@+id/tvLoading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
/>
<com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
android:id="@+id/swipyRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srl_direction="both">
<jp.juggler.subwaytooter.view.MyListView
android:id="@+id/listView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="?attr/colorColumnSettingBackground"
android:clipToPadding="false" android:orientation="vertical"
android:divider="?attr/colorSettingDivider" android:paddingBottom="3dp"
android:dividerHeight="1dp"
android:fadeScrollbars="false"
android:fastScrollEnabled="true"
android:paddingEnd="12dp" android:paddingEnd="12dp"
android:paddingStart="12dp" android:paddingStart="12dp"
android:scrollbarStyle="outsideOverlay" android:paddingTop="3dp"
>
<CheckBox
android:id="@+id/cbDontCloseColumn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_close_column"
/>
<CheckBox
android:id="@+id/cbWithAttachment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/with_attachment"
/>
<CheckBox
android:id="@+id/cbDontShowBoost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_show_boost"
/>
<CheckBox
android:id="@+id/cbDontShowReply"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_show_reply"
/>
<CheckBox
android:id="@+id/cbDontStreaming"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_use_streaming_api"
/>
<CheckBox
android:id="@+id/cbDontAutoRefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dont_refresh_on_activity_resume"
/>
<CheckBox
android:id="@+id/cbHideMediaDefault"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hide_media_default"
/>
<LinearLayout
android:id="@+id/llRegexFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/etRegexFilter"
android:text="@string/regex_filter"
android:textColor="?attr/colorColumnHeaderPageNumber"
/>
<TextView
android:id="@+id/tvRegexFilterError"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_weight="1"
android:textColor="?attr/colorRegexFilterError"
/>
</LinearLayout>
<EditText
android:id="@+id/etRegexFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:scrollHorizontally="true"
/>
<Button
android:id="@+id/btnDeleteNotification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/notification_delete"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btnColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/color_and_background"
android:textAllCaps="false"
/>
</LinearLayout>
</jp.juggler.subwaytooter.view.MaxHeightScrollView>
<RelativeLayout
android:id="@+id/llSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSearchFormBackground"
android:paddingBottom="3dp"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:paddingTop="3dp"
>
<ImageButton
android:id="@+id/btnSearch"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:background="@drawable/btn_bg_transparent"
android:contentDescription="@string/search"
android:src="?attr/ic_search"
/> />
</com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout> <EditText
</FrameLayout> android:id="@+id/etSearch"
</LinearLayout> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/btnSearch"
android:imeOptions="actionSearch"
android:inputType="text"
tools:ignore="LabelFor"/>
<CheckBox
android:id="@+id/cbResolve"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/etSearch"
android:text="@string/resolve_non_local_account"
/>
</RelativeLayout>
<FrameLayout
android:id="@+id/flColumnBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<ImageView
android:id="@+id/ivColumnBackgroundImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:visibility="gone"
/>
<TextView
android:id="@+id/tvLoading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
/>
<com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
android:id="@+id/swipyRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srl_direction="both">
<jp.juggler.subwaytooter.view.MyListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="?attr/colorSettingDivider"
android:dividerHeight="1dp"
android:fadeScrollbars="false"
android:fastScrollEnabled="true"
android:paddingEnd="12dp"
android:paddingStart="12dp"
android:scrollbarStyle="outsideOverlay"
/>
</com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout>
</FrameLayout>
</LinearLayout>
<View
android:id="@+id/vTabletDivider"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="?attr/colorSettingDivider"
android:visibility="gone"
/>
</FrameLayout>