diff --git a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java index 86e46650..9c5f431d 100644 --- a/app/src/main/java/app/fedilab/android/activities/LoginActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/LoginActivity.java @@ -20,7 +20,6 @@ import static app.fedilab.android.helper.MastodonHelper.REDIRECT_CONTENT_WEB; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.FrameLayout; @@ -63,7 +62,6 @@ public class LoginActivity extends BaseActivity { String code = matcher.group(1); OauthVM oauthVM = new ViewModelProvider(LoginActivity.this).get(OauthVM.class); - Log.v(Helper.TAG, "finalInstance: " + currentInstanceLogin); //We are dealing with a Mastodon API if (apiLogin == Account.API.MASTODON) { //API call to get the user token diff --git a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java index e73afa80..479421e9 100644 --- a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java @@ -394,7 +394,12 @@ public class ProfileActivity extends BaseActivity { } binding.fieldsContainer.setVisibility(View.VISIBLE); } - binding.accountDn.setText(account.span_display_name != null ? account.span_display_name : account.display_name, TextView.BufferType.SPANNABLE); + if (account.span_display_name == null && account.display_name == null) { + binding.accountDn.setText(account.username); + } else { + binding.accountDn.setText(account.span_display_name != null ? account.span_display_name : account.display_name, TextView.BufferType.SPANNABLE); + } + binding.accountUn.setText(String.format("@%s", account.acct)); binding.accountUn.setOnLongClickListener(v -> { ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index ed044b06..091f2a94 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -342,6 +342,8 @@ public class StatusAdapter extends RecyclerView.Adapter Helper.changeDrawableColor(context, holder.binding.visibility, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_star_outline, theme_icons_color); Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color); + Helper.changeDrawableColor(context, R.drawable.ic_bot, theme_icons_color); + Helper.changeDrawableColor(context, R.drawable.ic_baseline_reply_16, theme_icons_color); holder.binding.actionButtonFavorite.setInActiveImageTintColor(theme_icons_color); holder.binding.actionButtonBookmark.setInActiveImageTintColor(theme_icons_color); holder.binding.actionButtonBoost.setInActiveImageTintColor(theme_icons_color); @@ -416,6 +418,7 @@ public class StatusAdapter extends RecyclerView.Adapter holder.binding.favoritesCount.setTextColor(theme_text_color); Helper.changeDrawableColor(context, holder.binding.repeatInfo, theme_text_color); Helper.changeDrawableColor(context, holder.binding.favInfo, theme_text_color); + Helper.changeDrawableColor(context, R.drawable.ic_baseline_lock_24, theme_text_color); } holder.binding.toggleTruncate.setVisibility(View.GONE); @@ -737,6 +740,28 @@ public class StatusAdapter extends RecyclerView.Adapter if (theme_text_header_2_line != -1) { holder.binding.username.setTextColor(theme_text_header_2_line); } + + if (statusToDeal.account.locked) { + final float scale = context.getResources().getDisplayMetrics().density; + Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_lock_24); + assert img != null; + img.setBounds(0, 0, (int) (16 * scale + 0.5f), (int) (16 * scale + 0.5f)); + holder.binding.username.setCompoundDrawables(null, null, img, null); + } else { + holder.binding.username.setCompoundDrawables(null, null, null, null); + } + + if (statusToDeal.account.bot) { + holder.binding.botIcon.setVisibility(View.VISIBLE); + } else { + holder.binding.botIcon.setVisibility(View.GONE); + } + if (statusToDeal.in_reply_to_id != null) { + holder.binding.replyIcon.setVisibility(View.VISIBLE); + } else { + holder.binding.replyIcon.setVisibility(View.GONE); + } + if (status.isFocused) { holder.binding.statusInfo.setVisibility(View.VISIBLE); holder.binding.reblogsCount.setText(String.valueOf(status.reblogs_count)); @@ -944,7 +969,6 @@ public class StatusAdapter extends RecyclerView.Adapter layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_24); Glide.with(layoutMediaBinding.media.getContext()) .load(statusToDeal.media_attachments.get(0).preview_url) - .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners((int) Helper.convertDpToPixel(3, context)))) .into(layoutMediaBinding.media); } else { layoutMediaBinding.viewHide.setImageResource(R.drawable.ic_baseline_visibility_off_24); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java b/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java index a9045f08..fdf12167 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java @@ -27,7 +27,6 @@ import android.net.Uri; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; -import android.util.Log; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.MenuInflater; @@ -280,7 +279,6 @@ public class FragmentLoginMain extends Fragment { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(redirectUrl)); - Log.v(Helper.TAG, ">value: " + finalInstance); try { startActivity(intent); } catch (Exception e) { diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java index 1996c0f5..da36a04b 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -430,7 +430,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. } int position = 0; for (Status statusAlreadyPresent : this.statuses) { - if (statusAlreadyPresent.created_at != null && statusReceived.created_at != null && statusReceived.created_at.after(statusAlreadyPresent.created_at)) { + if (statusAlreadyPresent.created_at != null && statusReceived.created_at != null && statusReceived.created_at.after(statusAlreadyPresent.created_at) && !statusAlreadyPresent.pinned) { idOfAddedStatuses.add(statusReceived.id); this.statuses.add(position, statusReceived); statusAdapter.notifyItemInserted(position); diff --git a/app/src/main/res/drawable/ic_baseline_reply_16.xml b/app/src/main/res/drawable/ic_baseline_reply_16.xml new file mode 100644 index 00000000..5abdbbdf --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_reply_16.xml @@ -0,0 +1,11 @@ + + + diff --git a/app/src/main/res/drawable/ic_bot.xml b/app/src/main/res/drawable/ic_bot.xml new file mode 100644 index 00000000..3434cc04 --- /dev/null +++ b/app/src/main/res/drawable/ic_bot.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index 22b4d111..93808fc2 100644 --- a/app/src/main/res/layout/drawer_status.xml +++ b/app/src/main/res/layout/drawer_status.xml @@ -96,12 +96,40 @@ android:orientation="horizontal" android:padding="6dp"> - + + + + + + + + +