diff options
author | Thomas <tschneider.ac@gmail.com> | 2022-06-15 16:47:39 +0200 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2022-06-15 16:47:39 +0200 |
commit | f09510a217fb27e3da08142f2709851baabbf851 (patch) | |
tree | 06b2a75d369ab5fe85546b25f06779dccad3bbf3 /app/src | |
parent | e776ea99a18c87a0a87c7270ed2bc0c36d7f205d (diff) |
Some fixes and improvements
Diffstat (limited to 'app/src')
8 files changed, 150 insertions, 13 deletions
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 86e466500..9c5f431da 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 e73afa80b..479421e9b 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 ed044b062..091f2a94e 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<RecyclerView.ViewHolder> 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<RecyclerView.ViewHolder> 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<RecyclerView.ViewHolder> 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<RecyclerView.ViewHolder> 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 a9045f083..fdf12167f 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 1996c0f58..da36a04bd 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 000000000..5abdbbdfb --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_reply_16.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="16dp" + android:autoMirrored="true" + android:tint="#FFFFFF" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="?attr/colorControlNormal" + android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z" /> +</vector> 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 000000000..3434cc04f --- /dev/null +++ b/app/src/main/res/drawable/ic_bot.xml @@ -0,0 +1,73 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="48" + android:viewportHeight="48"> + <path + android:fillColor="#00000000" + android:pathData="M26,27H12A11,11 0,0 1,12 5H26A11,11 0,0 1,37 16" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M26,23H12A7,7 0,0 1,12 9H26a7,7 0,0 1,7 7" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="?attr/colorControlNormal" + android:pathData="M25.9091,15.2265a1.2954,1.6193 0,1 0,2.5909 0a1.2954,1.6193 0,1 0,-2.5909 0z" /> + <path + android:fillColor="?attr/colorControlNormal" + android:pathData="M9.5,15.2265a1.2954,1.6193 0,1 0,2.5909 0a1.2954,1.6193 0,1 0,-2.5909 0z" /> + <path + android:fillColor="#00000000" + android:pathData="M14.6818,16.1789a5.4972,5.4972 0,0 0,8.6364 0" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M38,26.8792m-1.1776,8.9216a8.999,8.999 52.5191,1 1,2.3552 -17.8432a8.999,8.999 52.5191,1 1,-2.3552 17.8432" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" /> + <path + android:fillColor="#00000000" + android:pathData="M33.3333,34.6667L30,40.6667" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M19,1L19,5" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M6,40H27.302a3.6336,3.6336 0,0 1,3.6931 3.3118A3.5002,3.5002 0,0 1,27.5 47H6a5,5 0,0 1,-5 -5V32a5,5 0,0 1,5 -5H16" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M8,31h8v4h-8z" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + <path + android:fillColor="#00000000" + android:pathData="M24,40L24,47" + android:strokeWidth="2" + android:strokeColor="?attr/colorControlNormal" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> +</vector> diff --git a/app/src/main/res/layout/drawer_status.xml b/app/src/main/res/layout/drawer_status.xml index 22b4d1118..93808fc2a 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"> - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/avatar" - android:layout_width="36dp" - android:layout_height="36dp" - android:scaleType="centerInside" - tools:src="@tools:sample/avatars" /> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="wrap_content" + android:layout_height="match_parent"> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/avatar" + android:layout_width="36dp" + android:layout_height="36dp" + android:scaleType="centerInside" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:src="@tools:sample/avatars" /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/reply_icon" + android:layout_width="16dp" + android:layout_height="16dp" + android:src="@drawable/ic_baseline_reply_16" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/bot_icon" + android:layout_width="16dp" + android:layout_height="16dp" + android:src="@drawable/ic_baseline_reply_16" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> + <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" |