Improves search layout
This commit is contained in:
parent
6b9ccc110c
commit
d03061204d
|
@ -131,11 +131,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
holder.status_toot_date = (TextView) v.findViewById(R.id.status_toot_date);
|
||||
holder.status_reblog_user = (TextView) v.findViewById(R.id.status_reblog_user);
|
||||
holder.main_container = (LinearLayout) v.findViewById(R.id.main_container);
|
||||
holder.status_search_title = (TextView) v.findViewById(R.id.status_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderStatus) v.getTag();
|
||||
}
|
||||
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.status_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.status_search_title.setVisibility(View.GONE);
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
if( !status.getIn_reply_to_account_id().equals("null") || !status.getIn_reply_to_id().equals("null") ){
|
||||
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply);
|
||||
|
@ -220,12 +224,16 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
holder.account_sc = (TextView) v.findViewById(R.id.account_sc);
|
||||
holder.account_fgc = (TextView) v.findViewById(R.id.account_fgc);
|
||||
holder.account_frc = (TextView) v.findViewById(R.id.account_frc);
|
||||
|
||||
holder.account_search_title = (TextView) v.findViewById(R.id.account_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderAccounts) v.getTag();
|
||||
}
|
||||
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.account_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.account_search_title.setVisibility(View.GONE);
|
||||
|
||||
holder.account_dn.setText(account.getDisplay_name());
|
||||
holder.account_un.setText(String.format("@%s",account.getUsername()));
|
||||
|
@ -260,10 +268,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
v = layoutInflater.inflate(R.layout.drawer_tag, parent, false);
|
||||
holder = new ViewHolderTag();
|
||||
holder.tag_name = (TextView) v.findViewById(R.id.tag_name);
|
||||
holder.tag_search_title = (TextView) v.findViewById(R.id.tag_search_title);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolderTag) v.getTag();
|
||||
}
|
||||
if( isFirstTypeItem(type, position) )
|
||||
holder.tag_search_title.setVisibility(View.VISIBLE);
|
||||
else
|
||||
holder.tag_search_title.setVisibility(View.GONE);
|
||||
holder.tag_name.setText(String.format("#%s",tag));
|
||||
holder.tag_name.setPaintFlags(holder.tag_name.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
holder.tag_name.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -280,6 +293,15 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isFirstTypeItem(int type, int position){
|
||||
if( position == 0 && type == STATUS_TYPE)
|
||||
return true;
|
||||
else if( position == statuses.size() && type == ACCOUNT_TYPE )
|
||||
return true;
|
||||
else if( position == (statuses.size() + accounts.size()) && type == TAG_TYPE )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private class ViewHolderStatus {
|
||||
TextView status_content;
|
||||
|
@ -289,6 +311,7 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
TextView status_toot_date;
|
||||
TextView status_reblog_user;
|
||||
LinearLayout main_container;
|
||||
TextView status_search_title;
|
||||
}
|
||||
|
||||
|
||||
|
@ -300,9 +323,11 @@ public class SearchListAdapter extends BaseAdapter {
|
|||
TextView account_sc;
|
||||
TextView account_fgc;
|
||||
TextView account_frc;
|
||||
TextView account_search_title;
|
||||
}
|
||||
|
||||
private class ViewHolderTag {
|
||||
TextView tag_name;
|
||||
TextView tag_search_title;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@
|
|||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -26,6 +25,27 @@
|
|||
android:id="@+id/main_container"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/account_search_title"
|
||||
android:visibility="gone"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="@string/accounts"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/account_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -126,3 +146,5 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -25,6 +25,27 @@
|
|||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:layout_marginTop="5dp"
|
||||
android:id="@+id/main_container"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/status_search_title"
|
||||
android:visibility="gone"
|
||||
android:text="@string/status"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/statuts_search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/status_account_profile"
|
||||
|
@ -87,3 +108,4 @@
|
|||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
|
@ -18,12 +18,30 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp"
|
||||
android:paddingLeft="@dimen/drawer_padding"
|
||||
android:paddingRight="@dimen/drawer_padding"
|
||||
android:id="@+id/account_container"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tag_search_title"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:visibility="gone"
|
||||
android:textSize="18sp"
|
||||
android:background="@color/blue_light"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/tags"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:padding="20dp"
|
||||
android:id="@+id/tag_name"
|
||||
android:textSize="16sp"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<string name="email">Email</string>
|
||||
<string name="accounts">Comptes</string>
|
||||
<string name="toots">Pouets</string>
|
||||
<string name="tags">Tags</string>
|
||||
<string name="token">Jeton</string>
|
||||
<string name="two_factor_authentification">Authentification en deux étapes ?</string>
|
||||
<string name="other_instance">Autre instance que mastodon.etalab.gouv.fr ?</string>
|
||||
|
|
Loading…
Reference in New Issue