changes in follow request item

- Show display name and full username
- change buttons position to give more space to long usernames
This commit is contained in:
Kasun 2019-05-07 04:18:36 +05:30
parent 25a2972e89
commit b74c256e53
2 changed files with 72 additions and 43 deletions

View File

@ -64,7 +64,7 @@ public class AccountsFollowRequestAdapter extends RecyclerView.Adapter implement
this.context = context;
accountsFollowRequestAdapter = this;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@ -78,7 +78,8 @@ public class AccountsFollowRequestAdapter extends RecyclerView.Adapter implement
final Account account = accounts.get(position);
holder.btn_authorize.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.green_1), PorterDuff.Mode.MULTIPLY);
holder.btn_reject.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.red_1), PorterDuff.Mode.MULTIPLY);
holder.account_un.setText(String.format("@%s", account.getUsername()));
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(),true));
holder.account_un.setText(account.getAcct());
//Profile picture
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
@ -89,6 +90,12 @@ public class AccountsFollowRequestAdapter extends RecyclerView.Adapter implement
openAccountDetails(account);
}
});
holder.account_dn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openAccountDetails(account);
}
});
holder.account_un.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -157,11 +164,13 @@ public class AccountsFollowRequestAdapter extends RecyclerView.Adapter implement
ImageView account_pp;
Button btn_authorize;
Button btn_reject;
TextView account_dn;
TextView account_un;
public ViewHolder(View itemView) {
super(itemView);
account_pp = itemView.findViewById(R.id.account_pp);
account_dn = itemView.findViewById(R.id.account_dn);
account_un = itemView.findViewById(R.id.account_un);
btn_authorize = itemView.findViewById(R.id.btn_authorize);
btn_reject = itemView.findViewById(R.id.btn_reject);

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2017 Thomas Schneider
This file is a part of Mastalab
@ -15,54 +14,75 @@
You should have received a copy of the GNU General Public License along with Mastalab; if not,
see <http://www.gnu.org/licenses>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/account_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/account_container"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
android:layout_marginBottom="5dp">
<ImageView
android:layout_gravity="center"
android:id="@+id/account_pp"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/profile_picture"/>
android:layout_gravity="center"
android:contentDescription="@string/profile_picture"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/account_dn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:maxLines="1"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/account_un"
app:layout_constraintLeft_toRightOf="@id/account_pp"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/account_un"
android:padding="5dp"
android:maxLines="1"
android:gravity="center"
android:textSize="16sp"
android:layout_gravity="center"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:gravity="end"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btn_authorize"
android:text="@string/authorize"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_gravity="end"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn_reject"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:text="@string/reject"
android:layout_gravity="end"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:maxLines="1"
android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@id/btn_top_barrier"
app:layout_constraintLeft_toRightOf="@id/account_pp"
app:layout_constraintTop_toBottomOf="@id/account_dn" />
</LinearLayout>
<android.support.constraint.Barrier
android:id="@+id/btn_top_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="btn_authorize,btn_reject" />
<Button
android:id="@+id/btn_authorize"
style="@style/Base.Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="@string/authorize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/btn_reject" />
<Button
android:id="@+id/btn_reject"
style="@style/Base.Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="@string/reject"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>