mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-30 19:05:02 +01:00
bug fix, layout fix for mastodon userlist
This commit is contained in:
parent
513deead7b
commit
47dbcc266a
@ -98,7 +98,6 @@ public class FragmentAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
/**
|
||||
* setup adapter for the home activity
|
||||
*
|
||||
*/
|
||||
public void setupForHomePage() {
|
||||
Bundle paramHomeTl = new Bundle();
|
||||
|
@ -166,7 +166,7 @@ public class UserHolder extends ViewHolder implements OnClickListener {
|
||||
* @param enable true to enable delete button
|
||||
*/
|
||||
public void setDeleteButton(boolean enable) {
|
||||
if (enable){
|
||||
if (enable) {
|
||||
delete.setVisibility(VISIBLE);
|
||||
} else {
|
||||
delete.setVisibility(GONE);
|
||||
|
@ -38,14 +38,14 @@ public class UserlistHolder extends ViewHolder implements OnClickListener {
|
||||
|
||||
private static final NumberFormat NUM_FORMAT = NumberFormat.getIntegerInstance();
|
||||
|
||||
private ImageView profileImage, userVerified, userLocked, privateIcon, followIcon, dateIcon, memberIcon, subscriberIcon;
|
||||
private ImageView profileImage, userVerified, userLocked, privateIcon, followIcon;
|
||||
private TextView title, description, username, screenname, date, member, subscriber, followList;
|
||||
|
||||
private GlobalSettings settings;
|
||||
private Picasso picasso;
|
||||
|
||||
private OnHolderClickListener listener;
|
||||
|
||||
private boolean enableExtras, enableImages;
|
||||
|
||||
/**
|
||||
* @param parent Parent view from adapter
|
||||
*/
|
||||
@ -53,14 +53,14 @@ public class UserlistHolder extends ViewHolder implements OnClickListener {
|
||||
super(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list, parent, false));
|
||||
CardView background = (CardView) itemView;
|
||||
ViewGroup container = itemView.findViewById(R.id.item_list_container);
|
||||
View dateIcon = itemView.findViewById(R.id.item_list_date_icon);
|
||||
View memberIcon = itemView.findViewById(R.id.item_list_member_icon);
|
||||
View subscriberIcon = itemView.findViewById(R.id.item_list_subscriber_icon);
|
||||
profileImage = itemView.findViewById(R.id.item_list_profile);
|
||||
userVerified = itemView.findViewById(R.id.item_list_user_verified);
|
||||
userLocked = itemView.findViewById(R.id.item_list_user_locked);
|
||||
privateIcon = itemView.findViewById(R.id.item_list_private);
|
||||
followIcon = itemView.findViewById(R.id.item_list_follow_icon);
|
||||
dateIcon = itemView.findViewById(R.id.item_list_date_icon);
|
||||
memberIcon = itemView.findViewById(R.id.item_list_member_icon);
|
||||
subscriberIcon = itemView.findViewById(R.id.item_list_subscriber_icon);
|
||||
title = itemView.findViewById(R.id.item_list_title);
|
||||
description = itemView.findViewById(R.id.item_list_description);
|
||||
username = itemView.findViewById(R.id.item_list_username);
|
||||
@ -69,14 +69,29 @@ public class UserlistHolder extends ViewHolder implements OnClickListener {
|
||||
member = itemView.findViewById(R.id.item_list_member);
|
||||
subscriber = itemView.findViewById(R.id.item_list_subscriber);
|
||||
followList = itemView.findViewById(R.id.item_list_following_indicator);
|
||||
this.settings = settings;
|
||||
this.picasso = picasso;
|
||||
this.listener = listener;
|
||||
|
||||
enableExtras = settings.getLogin().getApiType() == Account.API_TWITTER;
|
||||
enableImages = settings.imagesEnabled();
|
||||
|
||||
if (!enableExtras) {
|
||||
// disable extra views
|
||||
date.setVisibility(View.GONE);
|
||||
dateIcon.setVisibility(View.GONE);
|
||||
member.setVisibility(View.GONE);
|
||||
subscriber.setVisibility(View.GONE);
|
||||
description.setVisibility(View.GONE);
|
||||
memberIcon.setVisibility(View.GONE);
|
||||
subscriberIcon.setVisibility(View.GONE);
|
||||
// add title icon
|
||||
privateIcon.setImageResource(R.drawable.list);
|
||||
}
|
||||
AppStyles.setTheme(container, Color.TRANSPARENT);
|
||||
background.setCardBackgroundColor(settings.getCardColor());
|
||||
itemView.setOnClickListener(this);
|
||||
profileImage.setOnClickListener(this);
|
||||
|
||||
this.picasso = picasso;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
|
||||
@ -98,24 +113,17 @@ public class UserlistHolder extends ViewHolder implements OnClickListener {
|
||||
public void setContent(UserList userlist) {
|
||||
User owner = userlist.getListOwner();
|
||||
title.setText(userlist.getTitle());
|
||||
description.setText(userlist.getDescription());
|
||||
if (settings.getLogin().getApiType() == Account.API_TWITTER) {
|
||||
if (enableExtras) {
|
||||
description.setText(userlist.getDescription());
|
||||
date.setText(StringTools.formatCreationTime(itemView.getResources(), userlist.getTimestamp()));
|
||||
member.setText(NUM_FORMAT.format(userlist.getMemberCount()));
|
||||
subscriber.setText(NUM_FORMAT.format(userlist.getSubscriberCount()));
|
||||
} else {
|
||||
date.setVisibility(View.GONE);
|
||||
dateIcon.setVisibility(View.GONE);
|
||||
member.setVisibility(View.GONE);
|
||||
subscriber.setVisibility(View.GONE);
|
||||
memberIcon.setVisibility(View.GONE);
|
||||
subscriberIcon.setVisibility(View.GONE);
|
||||
}
|
||||
if (owner != null) {
|
||||
username.setText(owner.getUsername());
|
||||
screenname.setText(owner.getScreenname());
|
||||
String profileImageUrl = owner.getProfileImageThumbnailUrl();
|
||||
if (settings.imagesEnabled() && !profileImageUrl.isEmpty()) {
|
||||
if (enableImages && !profileImageUrl.isEmpty()) {
|
||||
Transformation roundCorner = new RoundedCornersTransformation(3, 0);
|
||||
picasso.load(profileImageUrl).transform(roundCorner).error(R.drawable.no_image).into(profileImage);
|
||||
} else {
|
||||
@ -147,7 +155,7 @@ public class UserlistHolder extends ViewHolder implements OnClickListener {
|
||||
username.setVisibility(View.GONE);
|
||||
screenname.setVisibility(View.GONE);
|
||||
}
|
||||
if (userlist.isPrivate()) {
|
||||
if (userlist.isPrivate() || !enableExtras) {
|
||||
privateIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
privateIcon.setVisibility(View.GONE);
|
||||
|
@ -225,8 +225,8 @@ public interface Connection {
|
||||
/**
|
||||
* get public timeline
|
||||
*
|
||||
* @param minId get statuses with ID above the min ID
|
||||
* @param maxId get statuses with ID under the max ID
|
||||
* @param minId get statuses with ID above the min ID
|
||||
* @param maxId get statuses with ID under the max ID
|
||||
* @return statuses of the public timeline
|
||||
*/
|
||||
List<Status> getPublicTimeline(long minId, long maxId) throws ConnectionException;
|
||||
|
@ -42,7 +42,7 @@ public class MastodonException extends ConnectionException {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public MastodonException(Exception e) {
|
||||
MastodonException(Exception e) {
|
||||
super(e);
|
||||
if (e instanceof UnknownHostException) {
|
||||
errorCode = ERROR_NETWORK;
|
||||
@ -52,7 +52,7 @@ public class MastodonException extends ConnectionException {
|
||||
/**
|
||||
* @param response response containing error information
|
||||
*/
|
||||
public MastodonException(Response response) {
|
||||
MastodonException(Response response) {
|
||||
super(response.message());
|
||||
errorCode = response.code();
|
||||
ResponseBody body = response.body();
|
||||
@ -75,7 +75,7 @@ public class MastodonException extends ConnectionException {
|
||||
/**
|
||||
* @param message error message
|
||||
*/
|
||||
public MastodonException(String message) {
|
||||
MastodonException(String message) {
|
||||
super(message);
|
||||
errorMessage = message;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class UserImpl implements User {
|
||||
|
||||
if (account.getApiType() != Account.API_TWITTER || defaultImage || profileImageOrig.isEmpty()) {
|
||||
profileImageSmall = profileImageOrig;
|
||||
} else{
|
||||
} else {
|
||||
profileImageSmall = profileImageOrig + "_bigger";
|
||||
}
|
||||
if (account.getApiType() != Account.API_TWITTER || profileBannerOrig.isEmpty()) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M10,0.4c-5.295,0 -9.601,4.307 -9.601,9.6S4.705,19.6 10,19.6c5.293,0 9.6,-4.307 9.6,-9.6S15.293,0.4 10,0.4zM18.188,10c0,1.873 -0.636,3.6 -1.696,4.98c-0.3,-0.234 -0.619,-0.867 -0.319,-1.523c0.303,-0.66 0.382,-2.188 0.312,-2.783c-0.066,-0.594 -0.375,-2.025 -1.214,-2.039c-0.838,-0.012 -1.413,-0.289 -1.911,-1.283c-1.033,-2.068 1.939,-2.465 0.906,-3.609c-0.289,-0.322 -1.783,1.322 -2.002,-0.869C12.25,2.717 12.399,2.482 12.6,2.238C15.844,3.328 18.188,6.395 18.188,10zM8.875,1.893C8.679,2.275 8.162,2.43 7.848,2.717C7.164,3.336 6.87,3.25 6.502,3.844C6.131,4.438 4.935,5.293 4.935,5.723s0.604,0.936 0.906,0.838c0.302,-0.1 1.099,-0.094 1.567,0.07c0.469,0.166 3.914,0.332 2.816,3.244c-0.348,0.926 -1.873,0.77 -2.279,2.303c-0.061,0.225 -0.272,1.186 -0.285,1.5c-0.025,0.486 0.344,2.318 -0.125,2.318c-0.471,0 -1.738,-1.639 -1.738,-1.936s-0.328,-1.338 -0.328,-2.23c0,-0.891 -1.518,-0.877 -1.518,-2.062c0,-1.068 0.823,-1.6 0.638,-2.113c-0.181,-0.51 -1.627,-0.527 -2.23,-0.59C3.412,4.334 5.889,2.307 8.875,1.893zM7.424,17.77c0.492,-0.26 0.542,-0.596 0.988,-0.613c0.51,-0.023 0.925,-0.199 1.5,-0.326c0.51,-0.111 1.423,-0.629 2.226,-0.695c0.678,-0.055 2.015,0.035 2.375,0.689c-1.295,0.861 -2.848,1.363 -4.514,1.363C9.1,18.188 8.234,18.039 7.424,17.77z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M10,0.4c-5.295,0 -9.601,4.307 -9.601,9.6S4.705,19.6 10,19.6c5.293,0 9.6,-4.307 9.6,-9.6S15.293,0.4 10,0.4zM18.188,10c0,1.873 -0.636,3.6 -1.696,4.98c-0.3,-0.234 -0.619,-0.867 -0.319,-1.523c0.303,-0.66 0.382,-2.188 0.312,-2.783c-0.066,-0.594 -0.375,-2.025 -1.214,-2.039c-0.838,-0.012 -1.413,-0.289 -1.911,-1.283c-1.033,-2.068 1.939,-2.465 0.906,-3.609c-0.289,-0.322 -1.783,1.322 -2.002,-0.869C12.25,2.717 12.399,2.482 12.6,2.238C15.844,3.328 18.188,6.395 18.188,10zM8.875,1.893C8.679,2.275 8.162,2.43 7.848,2.717C7.164,3.336 6.87,3.25 6.502,3.844C6.131,4.438 4.935,5.293 4.935,5.723s0.604,0.936 0.906,0.838c0.302,-0.1 1.099,-0.094 1.567,0.07c0.469,0.166 3.914,0.332 2.816,3.244c-0.348,0.926 -1.873,0.77 -2.279,2.303c-0.061,0.225 -0.272,1.186 -0.285,1.5c-0.025,0.486 0.344,2.318 -0.125,2.318c-0.471,0 -1.738,-1.639 -1.738,-1.936s-0.328,-1.338 -0.328,-2.23c0,-0.891 -1.518,-0.877 -1.518,-2.062c0,-1.068 0.823,-1.6 0.638,-2.113c-0.181,-0.51 -1.627,-0.527 -2.23,-0.59C3.412,4.334 5.889,2.307 8.875,1.893zM7.424,17.77c0.492,-0.26 0.542,-0.596 0.988,-0.613c0.51,-0.023 0.925,-0.199 1.5,-0.326c0.51,-0.111 1.423,-0.629 2.226,-0.695c0.678,-0.055 2.015,0.035 2.375,0.689c-1.295,0.861 -2.848,1.363 -4.514,1.363C9.1,18.188 8.234,18.039 7.424,17.77z"
|
||||
android:fillColor="#FFFFFF" />
|
||||
</vector>
|
||||
|
Loading…
x
Reference in New Issue
Block a user