Make rule hints expand on tap
This commit is contained in:
parent
65ecf6fba0
commit
8f6ea2ea05
@ -88,6 +88,7 @@ public abstract class Instance extends BaseModel{
|
||||
|
||||
public transient CharSequence parsedText;
|
||||
public transient CharSequence parsedHint;
|
||||
public transient boolean hintExpanded;
|
||||
|
||||
private Translation findTranslationForCurrentLocale(){
|
||||
if(translations==null || translations.isEmpty())
|
||||
|
@ -11,8 +11,9 @@ import org.joinmastodon.android.model.Instance;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
import me.grishka.appkit.views.UsableRecyclerView;
|
||||
|
||||
public class InstanceRuleViewHolder extends BindableViewHolder<Instance.Rule>{
|
||||
public class InstanceRuleViewHolder extends BindableViewHolder<Instance.Rule> implements UsableRecyclerView.DisableableClickable{
|
||||
private final TextView text, number, hint;
|
||||
private int position;
|
||||
|
||||
@ -44,5 +45,17 @@ public class InstanceRuleViewHolder extends BindableViewHolder<Instance.Rule>{
|
||||
hint.setVisibility(View.VISIBLE);
|
||||
hint.setText(item.parsedHint);
|
||||
}
|
||||
hint.setMaxLines(item.hintExpanded ? Integer.MAX_VALUE : 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(){
|
||||
return hint.getVisibility()==View.VISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(){
|
||||
item.hintExpanded=!item.hintExpanded;
|
||||
hint.setMaxLines(item.hintExpanded ? Integer.MAX_VALUE : 2);
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
android:textSize="14sp"
|
||||
android:textColor="?colorM3OnSurfaceVariant"
|
||||
android:textAlignment="viewStart"
|
||||
android:ellipsize="end"
|
||||
tools:text="No discrimination, including (but not limited to) racism, sexism, homophobia or transphobia."/>
|
||||
|
||||
</RelativeLayout>
|
Loading…
x
Reference in New Issue
Block a user