Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit b70913e

Browse files
authored
app: render fix, more OUI4 elements (#61)
* app: add Samsung sec-roboto font set Signed-off-by: BlackMesa123 <[email protected]> * app: OneUI 4 popup bg, selector Signed-off-by: BlackMesa123 <[email protected]> * app: use correct typeface in missing classes Signed-off-by: BlackMesa123 <[email protected]>
1 parent 3e1384e commit b70913e

29 files changed

+127
-56
lines changed

app/src/main/res/layout/fragment_views_tab.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
android:onClick="progressDialog"
225225
app:counter="44"
226226
app:counterEnabled="true"
227-
app:icon="@drawable/ic_samsung_info"
227+
app:icon="@drawable/ic_samsung_settings_3"
228228
app:selected="true"
229229
app:text="OptionButton" />
230230

yanndroid/oneui/src/main/java/androidx/appcompat/widget/SeslDropDownItemTextView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public SeslDropDownItemTextView(Context context, AttributeSet attributeSet, int
3131
public void setChecked(boolean z) {
3232
Context context;
3333
super.setChecked(z);
34-
setTypeface(Typeface.create("sec-roboto-light", z ? 1 : 0));
34+
setTypeface(ResourcesCompat.getFont(getContext(), R.font.sesl_roboto), z ? 1 : 0);
3535
if (z && (context = getContext()) != null && getCurrentTextColor() == -65281) {
3636
Log.w(TAG, "text color reload!");
3737
ColorStateList colorStateList = ResourcesCompat.getColorStateList(context.getResources(), R.color.sesl_spinner_dropdown_text_color, context.getTheme());

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/layout/AboutPage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import androidx.annotation.IntDef;
2222
import androidx.annotation.Nullable;
23+
import androidx.core.content.res.ResourcesCompat;
2324

2425
import com.google.android.material.button.MaterialButton;
2526

@@ -107,7 +108,7 @@ public void onClick(View view) {
107108
});
108109

109110
if (mIsOneUI4) {
110-
app_name.setTypeface(Typeface.create("sec-roboto-regular", Typeface.NORMAL));
111+
app_name.setTypeface(ResourcesCompat.getFont(context, R.font.sesl_roboto), Typeface.NORMAL);
111112
app_name.setTextSize(0, getResources().getDimension(R.dimen.sesl4_about_app_name_text_size));
112113
version.setTextSize(0, getResources().getDimension(R.dimen.sesl4_about_secondary_text_size));
113114
about_optional_text.setTextSize(0, getResources().getDimension(R.dimen.sesl4_about_secondary_text_size));

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/menu/PopupMenu.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import de.dlyt.yanndroid.oneui.sesl.utils.ReflectUtils;
2222

2323
public class PopupMenu {
24+
private boolean mIsOneUI4;
2425

2526
private Context context;
2627
private View anchor;
@@ -41,6 +42,7 @@ public class PopupMenu {
4142
public PopupMenu(View anchor) {
4243
this.context = anchor.getContext();
4344
this.anchor = anchor;
45+
mIsOneUI4 = context.getTheme().obtainStyledAttributes(new int[]{R.attr.isOneUI4}).getBoolean(0, false);
4446
}
4547

4648
public interface PopupMenuListener {
@@ -89,7 +91,7 @@ public void inflate(Menu menu, CharSequence title) {
8991
listView.setAdapter(popupMenuAdapter);
9092
listView.setMaxHeight(context.getResources().getDimensionPixelSize(R.dimen.sesl_menu_popup_max_height));
9193
listView.setDivider(null);
92-
listView.setSelector(context.getResources().getDrawable(R.drawable.sesl_list_selector, context.getTheme()));
94+
listView.setSelector(context.getResources().getDrawable(mIsOneUI4 ? R.drawable.sesl4_list_selector : R.drawable.sesl_list_selector, context.getTheme()));
9395
listView.setOnItemClickListener((parent, view, position, id) -> {
9496
MenuItem clickedMenuItem = menu.getItem(position);
9597
if (clickedMenuItem.isCheckable()) clickedMenuItem.toggleChecked();
@@ -127,7 +129,7 @@ public void onMenuItemUpdate(MenuItem menuItem) {
127129
popupWindow.setWidth(getPopupMenuWidth());
128130
popupWindow.setHeight(getPopupMenuHeight());
129131
popupWindow.setAnimationStyle(R.style.MenuPopupAnimStyle);
130-
popupWindow.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.sesl_menu_popup_background, context.getTheme()));
132+
popupWindow.setBackgroundDrawable(context.getResources().getDrawable(mIsOneUI4 ? R.drawable.sesl4_menu_popup_background : R.drawable.sesl_menu_popup_background, context.getTheme()));
131133
popupWindow.setOutsideTouchable(true);
132134
popupWindow.setElevation(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 12, context.getResources().getDisplayMetrics()));
133135
popupWindow.setFocusable(true);

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/sesl/tabs/SamsungBaseTabLayout.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import androidx.appcompat.content.res.AppCompatResources;
4646
import androidx.appcompat.widget.TooltipCompat;
4747
import androidx.core.content.ContextCompat;
48+
import androidx.core.content.res.ResourcesCompat;
4849
import androidx.core.graphics.drawable.DrawableCompat;
4950
import androidx.core.util.Pools;
5051
import androidx.core.view.AccessibilityDelegateCompat;
@@ -89,15 +90,14 @@ public class SamsungBaseTabLayout extends HorizontalScrollView {
8990
public boolean inlineLabel;
9091
public int mBadgeColor;
9192
public int mBadgeTextColor;
92-
public Typeface mBoldTypeface;
9393
public int mDepthStyle;
9494
public int mIconTextGap;
9595
public boolean mIsScaledTextSizeType;
96-
public Typeface mNormalTypeface;
9796
public int mRequestedTabWidth;
9897
public int mSubTabIndicatorHeight;
9998
public int mSubTabSelectedIndicatorColor;
10099
public int mTabSelectedIndicatorColor;
100+
public Typeface mTypeface;
101101
public int mode;
102102
public TabLayoutOnPageChangeListener pageChangeListener;
103103
public PagerAdapter pagerAdapter;
@@ -197,9 +197,7 @@ public SamsungBaseTabLayout(Context var1, AttributeSet var2, int var3) {
197197
}
198198

199199
Resources var12 = this.getResources();
200-
String var13 = var12.getString(R.string.sesl_font_family_regular);
201-
this.mBoldTypeface = Typeface.create(var13, 1);
202-
this.mNormalTypeface = Typeface.create(var13, 0);
200+
this.mTypeface = ResourcesCompat.getFont(var1, R.font.sesl_roboto);
203201
this.mSubTabIndicatorHeight = var12.getDimensionPixelSize(R.dimen.sesl_tablayout_subtab_indicator_height);
204202
if (var9.hasValue(R.styleable.SamsungTabLayout_tabTextColor)) {
205203
this.tabTextColors = MaterialResources.getColorStateList(var1, var9, R.styleable.SamsungTabLayout_tabTextColor);
@@ -1089,7 +1087,7 @@ public final void setSelectedTabView(int var1, boolean var2) {
10891087
if (var4 == var1) {
10901088
if (var8.textView != null) {
10911089
this.startTextColorChangeAnimation(var8.textView, this.getSelectedTabTextColor());
1092-
var8.textView.setTypeface(this.mBoldTypeface);
1090+
var8.textView.setTypeface(mTypeface, Typeface.BOLD);
10931091
var8.textView.setSelected(true);
10941092
}
10951093

@@ -1108,7 +1106,7 @@ public final void setSelectedTabView(int var1, boolean var2) {
11081106
}
11091107

11101108
if (var8.textView != null) {
1111-
var8.textView.setTypeface(this.mNormalTypeface);
1109+
var8.textView.setTypeface(mTypeface, Typeface.NORMAL);
11121110
this.startTextColorChangeAnimation(var8.textView, this.tabTextColors.getDefaultColor());
11131111
var8.textView.setSelected(false);
11141112
}
@@ -2292,7 +2290,7 @@ public final boolean startTabTouchAnimation(MotionEvent var1, KeyEvent var2) {
22922290
if (var3 != 0) {
22932291
if (var3 != 1) {
22942292
if (var3 == 3) {
2295-
this.textView.setTypeface(SamsungBaseTabLayout.this.mNormalTypeface);
2293+
this.textView.setTypeface(mTypeface, Typeface.NORMAL);
22962294
var5 = SamsungBaseTabLayout.this;
22972295
var5.startTextColorChangeAnimation(this.textView, var5.tabTextColors.getDefaultColor());
22982296
var6 = this.mIndicatorView;
@@ -2305,7 +2303,7 @@ public final boolean startTabTouchAnimation(MotionEvent var1, KeyEvent var2) {
23052303
if (var7 != null) {
23062304
var4 = var7.view.textView;
23072305
if (var4 != null) {
2308-
var4.setTypeface(SamsungBaseTabLayout.this.mBoldTypeface);
2306+
var4.setTypeface(mTypeface, Typeface.BOLD);
23092307
var8 = SamsungBaseTabLayout.this;
23102308
var8.startTextColorChangeAnimation(var7.view.textView, var8.getSelectedTabTextColor());
23112309
}
@@ -2343,7 +2341,7 @@ public final boolean startTabTouchAnimation(MotionEvent var1, KeyEvent var2) {
23432341
if (this.tab.position != SamsungBaseTabLayout.this.getSelectedTabPosition()) {
23442342
TextView var9 = this.textView;
23452343
if (var9 != null) {
2346-
var9.setTypeface(SamsungBaseTabLayout.this.mBoldTypeface);
2344+
var9.setTypeface(mTypeface, Typeface.BOLD);
23472345
var5 = SamsungBaseTabLayout.this;
23482346
var5.startTextColorChangeAnimation(this.textView, var5.getSelectedTabTextColor());
23492347
var6 = this.mIndicatorView;
@@ -2356,7 +2354,7 @@ public final boolean startTabTouchAnimation(MotionEvent var1, KeyEvent var2) {
23562354
if (var7 != null) {
23572355
var4 = var7.view.textView;
23582356
if (var4 != null) {
2359-
var4.setTypeface(SamsungBaseTabLayout.this.mNormalTypeface);
2357+
var4.setTypeface(mTypeface, Typeface.NORMAL);
23602358
var8 = SamsungBaseTabLayout.this;
23612359
var8.startTextColorChangeAnimation(var7.view.textView, var8.tabTextColors.getDefaultColor());
23622360
}

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/sesl/utils/SamsungEdgeEffect.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.widget.EdgeEffect;
2121

2222
import androidx.annotation.ColorInt;
23+
import androidx.core.view.ViewCompat;
2324
import androidx.reflect.view.SeslHapticFeedbackConstantsReflector;
2425

2526
import de.dlyt.yanndroid.oneui.R;
@@ -61,7 +62,7 @@ public class SamsungEdgeEffect extends EdgeEffect {
6162
public static float sMaxAlpha;
6263
public float MAX_SCALE = 1.0f;
6364
public final Rect mBounds = new Rect();
64-
public boolean mCanVerticalScroll = true;
65+
public boolean mCanVerticalScroll = false;
6566
public float mDisplacement = 0.5f;
6667
public final DisplayMetrics mDisplayMetrics;
6768
public float mDuration;
@@ -113,7 +114,7 @@ public SamsungEdgeEffect(Context context) {
113114
int color = obtainStyledAttributes.getColor(0, -10066330);
114115
obtainStyledAttributes.recycle();
115116
if (mIsOneUI4)
116-
this.mPaint.setColor(color);
117+
this.mPaint.setColor(color & ViewCompat.MEASURED_SIZE_MASK);
117118
else
118119
mPaint.setColor((0xFFFFFF & color) | 0x33000000);
119120
this.mPaint.setStyle(Paint.Style.FILL);
@@ -337,7 +338,7 @@ public void setColor(@ColorInt int i) {
337338

338339
public void setHostView(View view, boolean z) {
339340
this.mHostView = view;
340-
this.mCanVerticalScroll = z;
341+
//this.mCanVerticalScroll = z;
341342
}
342343

343344
public void setSize(int i, int i2) {

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/view/RecyclerView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
import de.dlyt.yanndroid.oneui.sesl.utils.SamsungEdgeEffect;
9393

9494
public class RecyclerView extends ViewGroup implements NestedScrollingChild2, ScrollingView {
95+
private boolean mIsOneUI4;
9596
public static final int HORIZONTAL = 0;
9697
public static final int INVALID_TYPE = -1;
9798
public static final long NO_ID = -1L;
@@ -398,6 +399,7 @@ public RecyclerView(Context var1, AttributeSet var2) {
398399
@SuppressLint("WrongConstant")
399400
public RecyclerView(Context var1, AttributeSet var2, int var3) {
400401
super(var1, var2, var3);
402+
mIsOneUI4 = var1.getTheme().obtainStyledAttributes(new int[]{R.attr.isOneUI4}).getBoolean(0, false);
401403
this.mSeslTouchSlop = 0;
402404
this.mSeslPagingTouchSlop = 0;
403405
this.mUsePagingTouchSlopForStylus = false;
@@ -6446,7 +6448,7 @@ public void seslSetGoToTopEnabled(boolean var1, boolean var2) {
64466448
if (var2) {
64476449
var3 = this.mGoToTopImageLight;
64486450
} else {
6449-
var3 = this.mContext.getResources().getDrawable(R.drawable.sesl_list_go_to_top, null);
6451+
var3 = this.mContext.getResources().getDrawable(mIsOneUI4 ? R.drawable.sesl4_list_go_to_top : R.drawable.sesl_list_go_to_top, null);
64506452
}
64516453

64526454
this.mGoToTopImage = var3;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:color="@color/sesl4_ripple_color">
4+
<item android:drawable="@drawable/sesl_go_to_top" />
5+
</ripple>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item>
4+
<ripple android:color="@color/sesl4_ripple_color">
5+
<item android:id="@android:id/mask">
6+
<color android:color="@color/sesl_white" />
7+
</item>
8+
</ripple>
9+
</item>
10+
</selector>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item
4+
android:bottom="@dimen/sesl_menu_popup_bottom_margin"
5+
android:top="@dimen/sesl_menu_popup_top_margin">
6+
<shape android:shape="rectangle">
7+
<stroke
8+
android:width="@dimen/sesl4_menu_popup_stroke_width"
9+
android:color="@color/sesl4_menu_popup_background_stroke_color" />
10+
<padding
11+
android:bottom="@dimen/sesl_menu_popup_bottom_padding"
12+
android:top="@dimen/sesl_menu_popup_top_padding" />
13+
<corners android:radius="@dimen/sesl4_menu_popup_corner_radius" />
14+
<solid android:color="@color/sesl4_menu_popup_background_color" />
15+
</shape>
16+
</item>
17+
</layer-list>

0 commit comments

Comments
 (0)