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

Commit 56fb878

Browse files
authored
app: OUI4 bg/fg colors (#65)
Signed-off-by: BlackMesa123 <[email protected]>
1 parent 22a286d commit 56fb878

File tree

19 files changed

+55
-25
lines changed

19 files changed

+55
-25
lines changed

app/src/main/java/de/dlyt/yanndroid/oneuiexample/fragments/MainActivityFirstFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
3737
public void onViewCreated(View view, Bundle savedInstanceState) {
3838
super.onViewCreated(view, savedInstanceState);
3939

40-
getView().setBackgroundColor(getResources().getColor(R.color.background_color));
40+
getView().setBackgroundColor(getResources().getColor(R.color.sesl4_round_and_bgcolor));
4141

4242
// TabLayout and ViewPager
4343
TabLayout tabLayout = mRootView.findViewById(R.id.tabLayout);

app/src/main/res/layout-land/activity_switchbar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<de.dlyt.yanndroid.oneui.view.RoundNestedScrollView
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent"
12-
android:background="@color/background_color"
12+
android:background="?roundedCornerColor"
1313
android:fillViewport="true"
1414
app:layout_behavior="@string/sesl_appbar_scrolling_view_behavior"
1515
app:roundedCorners="top_left|top_right">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<de.dlyt.yanndroid.oneui.view.RoundNestedScrollView
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent"
12-
android:background="@color/background_color"
12+
android:background="?roundedCornerColor"
1313
android:fillViewport="true"
1414
android:orientation="vertical"
1515
android:scrollbarStyle="outsideOverlay"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
android:layout_width="match_parent"
321321
android:layout_height="50dp"
322322
android:layout_marginTop="10dp"
323-
android:background="@color/background_color"
323+
android:background="?roundedCornerColor"
324324
android:orientation="horizontal">
325325

326326
<LinearLayout
@@ -369,7 +369,7 @@
369369
android:layout_width="match_parent"
370370
android:layout_height="match_parent"
371371
android:layout_weight="1"
372-
android:background="@color/background_color"
372+
android:background="?roundedCornerColor"
373373
android:backgroundTint="@color/sesl_control_color_normal" />
374374

375375
</LinearLayout>
@@ -381,7 +381,7 @@
381381
<View
382382
android:layout_width="match_parent"
383383
android:layout_height="@dimen/sesl_list_subheader_min_height"
384-
android:background="@color/background_color" />
384+
android:background="?roundedCornerColor" />
385385

386386
</LinearLayout>
387387
</de.dlyt.yanndroid.oneui.view.NestedScrollView>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<View xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="fill_parent"
44
android:layout_height="80.0dip"
5-
android:background="@color/background_color" />
5+
android:background="?roundedCornerColor" />

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
public class DrawerLayout extends LinearLayout {
3737

38-
38+
private boolean mIsOneUI4;
3939
public static final int N_BADGE = -1;
4040
private Context mContext;
4141
private AppCompatActivity mActivity;
@@ -58,6 +58,8 @@ public class DrawerLayout extends LinearLayout {
5858
public DrawerLayout(Context context, @Nullable AttributeSet attrs) {
5959
super(context, attrs);
6060

61+
mIsOneUI4 = context.getTheme().obtainStyledAttributes(new int[]{R.attr.isOneUI4}).getBoolean(0, false);
62+
6163
mContext = context;
6264
mActivity = getActivity();
6365

@@ -140,7 +142,7 @@ public void onDrawerSlide(View drawerView, float slideOffset) {
140142
content.setTranslationX(slideX);
141143

142144
float[] hsv = new float[3];
143-
Color.colorToHSV(ContextCompat.getColor(getContext(), R.color.background_color), hsv);
145+
Color.colorToHSV(ContextCompat.getColor(getContext(), mIsOneUI4 ? R.color.sesl4_round_and_bgcolor : R.color.sesl_round_and_bgcolor), hsv);
144146
hsv[2] *= 1f - (slideOffset * 0.2f);
145147
window.setStatusBarColor(Color.HSVToColor(hsv));
146148
window.setNavigationBarColor(Color.HSVToColor(hsv));

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/sesl/appbar/SamsungAppBarLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public SamsungAppBarLayout(Context var1, AttributeSet var2, int var3) {
106106
ViewCompat.setBackground(this, this.mBackground);
107107
} else {
108108
this.mBackground = null;
109-
this.setBackgroundColor(this.getResources().getColor(R.color.sesl_action_bar_background_color, var1.getTheme()));
109+
this.setBackgroundColor(this.getResources().getColor(mIsOneUI4 ? R.color.sesl4_action_bar_background_color : R.color.sesl_action_bar_background_color, var1.getTheme()));
110110
}
111111

112112
if (var4.hasValue(R.styleable.SamsungAppBarLayout_expanded)) {
@@ -555,7 +555,7 @@ public void onConfigurationChanged(Configuration var1) {
555555
this.setBackground(this.mBackground);
556556
} else {
557557
this.mBackground = null;
558-
this.setBackgroundColor(this.getResources().getColor(R.color.sesl_action_bar_background_color, getContext().getTheme()));
558+
this.setBackgroundColor(this.getResources().getColor(mIsOneUI4 ? R.color.sesl4_action_bar_background_color : R.color.sesl_action_bar_background_color, getContext().getTheme()));
559559
}
560560

561561
this.mBottomPadding = mIsOneUI4 ? 0 : this.getContext().getResources().getDimensionPixelSize(R.dimen.sesl_extended_appbar_bottom_padding);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ public void run() {
826826
this.mGoToTopImageLight = var8.getDrawable(var11.resourceId, null);
827827
}
828828

829-
this.mRectColor = var8.getColor(R.color.background_color, null);
829+
this.mRectColor = var8.getColor(mIsOneUI4 ? R.color.sesl4_round_and_bgcolor : R.color.sesl_round_and_bgcolor, null);
830830

831831
this.mRectPaint.setColor(this.mRectColor);
832832
this.mRectPaint.setStyle(Style.FILL_AND_STROKE);

yanndroid/oneui/src/main/res/drawable/bottomnavview_button_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:android="http://schemas.android.com/apk/res/android">
44
<item android:gravity="center_vertical" android:id="@android:id/mask" android:height="43.0dip">
55
<shape android:shape="rectangle">
6-
<solid android:color="@color/background_color" />
6+
<solid android:color="?roundedCornerColor" />
77
<corners android:radius="26.0dip" />
88
</shape>
99
</item>

yanndroid/oneui/src/main/res/drawable/related_card_background.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
33
<item>
44
<shape android:shape="rectangle">
5-
<solid android:color="@color/background_color" />
5+
<solid android:color="?roundedCornerColor" />
66
</shape>
77
</item>
88
<item>

0 commit comments

Comments
 (0)