Some RTL Fixes
This commit is contained in:
parent
5d49c8104b
commit
6b8b0af8cd
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
/.idea/deploymentTargetDropDown.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="R5CRB1GE0RY" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-02-18T08:17:36.558261831Z" />
|
||||
</State>
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
</project>
|
@ -72,7 +72,15 @@ public class CategoryView extends FrameLayout {
|
||||
* @param onClickItem Callback when clicking on an item
|
||||
*/
|
||||
public <T extends Category.Named> void setup(Category<T> category, Runnable onClickTitle, Consumer<T> onClickItem) {
|
||||
String titleText = (category.isOpen ? "▼" : "▶") + " " + category.name;
|
||||
String icon = category.isOpen ? "▼" : "▶";
|
||||
String titleText = category.name;
|
||||
if (getResources().getConfiguration().getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
|
||||
// RTL
|
||||
titleText += " " + icon;
|
||||
} else {
|
||||
// LTR
|
||||
titleText = icon + " " + titleText;
|
||||
}
|
||||
title.setText(titleText);
|
||||
card.setVisibility(category.isOpen ? VISIBLE : GONE);
|
||||
title.setOnClickListener(v -> onClickTitle.run());
|
||||
@ -113,6 +121,7 @@ public class CategoryView extends FrameLayout {
|
||||
getContext().getTheme().resolveAttribute(androidx.appcompat.R.attr.selectableItemBackground, outValue, true);
|
||||
item.setBackgroundResource(outValue.resourceId);
|
||||
// Layout
|
||||
item.setTextAlignment(TEXT_ALIGNMENT_VIEW_START);
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
item.setLayoutParams(layoutParams);
|
||||
// Add To View
|
||||
|
Loading…
Reference in New Issue
Block a user