[app] Set maxLines for online modules (#1391)
This commit is contained in:
parent
8ebdcd55b4
commit
d9ee2d9b3b
|
|
@ -196,12 +196,8 @@ public class RepoFragment extends BaseFragment implements RepoLoader.Listener {
|
|||
public void onBindViewHolder(@NonNull RepoAdapter.ViewHolder holder, int position) {
|
||||
OnlineModule module = showList.get(position);
|
||||
holder.appName.setText(module.getDescription());
|
||||
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder(module.getName());
|
||||
String summary = module.getSummary();
|
||||
if (summary != null) {
|
||||
sb.append("\n");
|
||||
sb.append(summary);
|
||||
}
|
||||
ModuleUtil.InstalledModule installedModule = ModuleUtil.getInstance().getModule(module.getName());
|
||||
if (installedModule != null) {
|
||||
var ver = repoLoader.getModuleLatestVersion(installedModule.packageName);
|
||||
|
|
@ -220,7 +216,14 @@ public class RepoFragment extends BaseFragment implements RepoLoader.Listener {
|
|||
sb.setSpan(foregroundColorSpan, sb.length() - recommended.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
}
|
||||
}
|
||||
String summary = module.getSummary();
|
||||
if (summary != null) {
|
||||
sb.append("\n");
|
||||
sb.append(summary);
|
||||
}
|
||||
|
||||
holder.appDescription.setText(sb);
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
searchView.clearFocus();
|
||||
searchView.onActionViewCollapsed();
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ package org.lsposed.manager.ui.widget;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.Layout;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.transition.TransitionManager;
|
||||
|
|
@ -32,13 +34,14 @@ import android.util.AttributeSet;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import org.lsposed.manager.R;
|
||||
|
||||
public class ExpandableTextView extends TextView {
|
||||
public class ExpandableTextView extends MaterialTextView {
|
||||
private CharSequence text = null;
|
||||
private int nextLines = 0;
|
||||
private final int maxLines;
|
||||
|
|
@ -65,6 +68,11 @@ public class ExpandableTextView extends TextView {
|
|||
setMaxLines(nextLines);
|
||||
ExpandableTextView.super.setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
ds.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
}
|
||||
};
|
||||
collapse.setSpan(span, 0, collapse.length(), 0);
|
||||
expand = new SpannableString(context.getString(R.string.expand));
|
||||
|
|
|
|||
|
|
@ -33,28 +33,30 @@
|
|||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/item_root"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/description"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/description"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<TextView
|
||||
<org.lsposed.manager.ui.widget.ExpandableTextView
|
||||
android:id="@+id/description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="6"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
|||
Loading…
Reference in New Issue