Display account

This commit is contained in:
Thomas 2020-06-28 10:02:30 +02:00
parent 9dca09b1d3
commit 37d2e2f034
5 changed files with 60 additions and 53 deletions

View File

@ -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();

View File

@ -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)))

View File

@ -42,17 +42,53 @@
<ImageView
android:id="@+id/account_pp"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="10dp"
android:background="@drawable/account_pp_border"
android:contentDescription="@string/profile_picture"
android:padding="2dp"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toBottomOf="@id/banner_pp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/banner_pp"
app:layout_scrollFlags="scroll" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/banner_pp"
app:layout_constraintTop_toBottomOf="@id/banner_pp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/account_pp"
android:layout_marginStart="5dp"
android:padding="2dp">
<LinearLayout
android:id="@+id/names_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/account_dn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/account_un"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageButton
android:id="@+id/account_follow"
style="@style/Widget.AppCompat.Button.Colored"
@ -114,50 +150,12 @@
android:orientation="vertical"
android:paddingTop="8dp"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<LinearLayout
android:id="@+id/names_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/account_dn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white"
android:textSize="16sp" />
<TextView
android:id="@+id/account_un"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/account_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:visibility="gone"
android:gravity="center"
android:padding="10dp"
android:textColor="@android:color/white"
@ -166,10 +164,9 @@
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginBottom="2dp"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -240,6 +237,7 @@
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:textColor="@android:color/white"
android:singleLine="true"
android:textSize="14sp" />
</LinearLayout>
@ -250,6 +248,7 @@
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabTextColor="@android:color/white"
app:tabSelectedTextColor="?colorAccent" />
</com.google.android.material.appbar.AppBarLayout>

View File

@ -33,6 +33,8 @@
<LinearLayout
android:id="@+id/bottom_container"
android:layout_marginStart="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

View File

@ -4,5 +4,5 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">5dp</dimen>
<dimen name="drawer_padding">2dp</dimen>
<dimen name="layout_height_header">180dp</dimen>
<dimen name="layout_height_header">100dp</dimen>
</resources>