From 37d2e2f0346cd05c098fafda4592c9c1883a7a5c Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 28 Jun 2020 10:02:30 +0200 Subject: [PATCH] Display account --- .../fedilabtube/ShowAccountActivity.java | 19 +++-- .../fedilab/fedilabtube/helper/Helper.java | 5 +- .../main/res/layout/activity_show_account.xml | 85 +++++++++---------- app/src/main/res/layout/drawer_peertube.xml | 2 + app/src/main/res/values/dimens.xml | 2 +- 5 files changed, 60 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java b/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java index a380286..084e928 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/ShowAccountActivity.java @@ -268,14 +268,19 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi SpannableString spannableString; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - spannableString = new SpannableString(Html.fromHtml(account.getNote(), FROM_HTML_MODE_LEGACY)); - else - spannableString = new SpannableString(Html.fromHtml(account.getNote())); + if( account.getNote() != null && account.getNote().compareTo("null") != 0 && account.getNote().trim().length() > 0 ) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + spannableString = new SpannableString(Html.fromHtml(account.getNote(), FROM_HTML_MODE_LEGACY)); + else + spannableString = new SpannableString(Html.fromHtml(account.getNote())); - account.setNoteSpan(spannableString); - account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE); - account_note.setMovementMethod(LinkMovementMethod.getInstance()); + account.setNoteSpan(spannableString); + account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE); + account_note.setMovementMethod(LinkMovementMethod.getInstance()); + account_note.setVisibility(View.VISIBLE); + }else{ + account_note.setVisibility(View.GONE); + } Helper.loadGiF(ShowAccountActivity.this, account, account_pp); //Follow button String target = account.getAcct(); diff --git a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java index d6c3a93..b71c8c1 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java +++ b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java @@ -362,10 +362,11 @@ public class Helper { if (url.startsWith("/")) { url = Helper.getLiveInstance(context) + url; } - + if( !url.startsWith("http")){ + url = "https://" + url; + } try { Glide.with(imageView.getContext()) - .asDrawable() .load(url) .thumbnail(0.1f) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))) diff --git a/app/src/main/res/layout/activity_show_account.xml b/app/src/main/res/layout/activity_show_account.xml index 6ed631d..3b40929 100644 --- a/app/src/main/res/layout/activity_show_account.xml +++ b/app/src/main/res/layout/activity_show_account.xml @@ -42,17 +42,53 @@ + + + + + + + - - - - - - - - - - - - - - @@ -250,6 +248,7 @@ android:layout_height="wrap_content" app:tabGravity="fill" app:tabMode="fixed" + app:tabTextColor="@android:color/white" app:tabSelectedTextColor="?colorAccent" /> diff --git a/app/src/main/res/layout/drawer_peertube.xml b/app/src/main/res/layout/drawer_peertube.xml index 1ae37cf..33fb2be 100644 --- a/app/src/main/res/layout/drawer_peertube.xml +++ b/app/src/main/res/layout/drawer_peertube.xml @@ -33,6 +33,8 @@ diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 05f7dd8..cf75b17 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -4,5 +4,5 @@ 16dp 5dp 2dp - 180dp + 100dp \ No newline at end of file