Commit f09510a2 authored by Thomas's avatar Thomas
Browse files

Some fixes and improvements

parent e776ea99
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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
+6 −1
Original line number Diff line number Diff line
@@ -394,7 +394,12 @@ public class ProfileActivity extends BaseActivity {
            }
            binding.fieldsContainer.setVisibility(View.VISIBLE);
        }
        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);
+25 −1
Original line number Diff line number Diff line
@@ -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);
+0 −2
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading