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

Commit 3114a30

Browse files
committed
v2.1.1
- ThemeColor > ThemeUtil - dark mode fix (ThemeUtil) - Button/AboutPage improvements - preference notifyChanged() - ToolbarLayout getToolbarMenuItemView() - OneUI4 Switch - minor changes
1 parent 6e22377 commit 3114a30

20 files changed

+146
-30
lines changed

README.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ v2.0.0 and future versions are (and only will be) available on mavenCentral. For
3636
1. Add the dependency to build.gradle (Module: ...)
3737
```gradle
3838
dependencies {
39-
implementation 'io.github.yanndroid:oneui:2.1.0'
39+
implementation 'io.github.yanndroid:oneui:2.1.1'
4040
...
4141
}
4242
```
@@ -311,6 +311,8 @@ public void setToolbarMenuItemIcon(MenuItem item, @DrawableRes int resId)
311311
public void setToolbarMenuItemTitle(MenuItem item, CharSequence title) //title = tooltip
312312
public void setToolbarMenuItemVisibility(MenuItem item, boolean visible)
313313
public void setToolbarMenuItemEnabled(MenuItem item, boolean enabled)
314+
315+
public ToolbarImageButton getToolbarMenuItemView(MenuItem item)
314316
```
315317
SelectMode. Changes the layout of the Toolbar to the one you can see in any Samsung app, when you long click a list item. This will show a "All" checkbox, "x selected" counter as the title and a bottom menu (see [screenshot](readme-resources/screenshots/toolbarlayout_selectmode.png)). In the Menu resource file for the bottom menu use ```app:showAsAction="always"``` to show the item as a Action instead of in the "more" menu.
316318
```java
@@ -438,7 +440,7 @@ A layout that looks like and has the same functions as the About Screen in any S
438440
app:update_state="...">
439441

440442
<com.google.android.material.button.MaterialButton
441-
style="@style/AboutPageButtonStyle"
443+
style="@style/ButtonStyle.AboutPage"
442444
android:text="..." />
443445

444446
...
@@ -448,7 +450,7 @@ A layout that looks like and has the same functions as the About Screen in any S
448450

449451
The App Name and Version are automatically added to the view. The Info Button at the top right will redirect the user to the App Info in System Settings. ```app:optional_text``` is the text that can be added between the version and the status text. The status text will change according to the state you have set to the view programmatically (see below) ,or in the layout with ```app:update_state```.
450452

451-
You can use ```style="@style/AboutPageButtonStyle"``` for the buttons, which are shown at the bottom.
453+
You can use ```style="@style/ButtonStyle.AboutPage"``` for the buttons, which are shown at the bottom (layout_width and layout_height are also in this style).
452454
<br clear="left"/>
453455

454456
#### Methods
@@ -610,10 +612,10 @@ The Button has three styles which you can use, depending on your needs.
610612
<img loading="lazy" src="readme-resources/screenshots/button.png" width="300"/>
611613

612614
```@style/ButtonStyle.Transparent```
613-
```@style/ButtonStyle.Invert```
614-
```@style/ButtonStyle.Invert.Secondary```
615+
```@style/ButtonStyle.Colored```
616+
```@style/ButtonStyle.Filled```
615617

616-
(There are also ```AboutPageButtonStyle``` and ```AboutPageButtonStyle.Update``` for the [AboutPage](#AboutPage), you can also use them.)
618+
(There are also ```ButtonStyle.AboutPage``` and ```ButtonStyle.AboutPageUpdate``` for the [AboutPage](#AboutPage), you can also use.)
617619

618620
### SeekBar
619621
Samsung's SeekBar.
@@ -1237,18 +1239,19 @@ Then apply it on the activities you want with ```android:theme="@style/ThemeName
12371239
#### 3. Via Code
12381240
This method allows you to change the color of your theme dynamically within your app. It's based on [this idea](https://stackoverflow.com/a/48517223). In your activity onCreate add this line at the top **before** ```super.onCreate(...)```:
12391241
```java
1240-
new ThemeColor(this);
1242+
new ThemeUtil(this);
12411243
```
12421244
This will apply the color theme at launch. If you want to change the color you can use these functions:
12431245
```java
1244-
ThemeColor.setColor(Activity activity, int red, int green, int blue)
1245-
ThemeColor.setColor(Activity activity, float red, float green, float blue)
1246-
ThemeColor.setColor(Activity activity, float[] hsv)
1246+
ThemeUtil.setColor(Activity activity, int red, int green, int blue)
1247+
ThemeUtil.setColor(Activity activity, float red, float green, float blue)
1248+
ThemeUtil.setColor(Activity activity, float[] hsv)
12471249
```
1248-
The color you apply with these functions will apply on every activity with ```new ThemeColor(this)``` at the top. You can also enable/disable Dark theme programmatically:
1250+
The color you apply with these functions will apply on every activity with ```new ThemeUtil(this)``` at the top. If you are using ThemeUtil and you want to enable/disable Dark theme you'll have to do it with these methods:
12491251
```java
12501252
// mode: DARK_MODE_AUTO; DARK_MODE_DISABLED; DARK_MODE_ENABLED
1251-
ThemeColor.setDarkMode(AppCompatActivity activity, int mode)
1253+
public static void setDarkMode(AppCompatActivity activity, int mode)
1254+
public static int getDarkMode(Context context)
12521255
```
12531256

12541257
### App Icon
@@ -1262,7 +1265,7 @@ The sample app icon for example:
12621265
<img loading="lazy" src="readme-resources/app-icons/sample.png" width="50" height="50" />
12631266

12641267
### OneUI 4
1265-
Starting with v2.1.0, the new OneUI 4 design is being added to this library. Since Samsung hasn't released a stable version yet and still has a lot of stuff to fix, only some views are (partly) using the new style. As long as OneUI 4 is beta, this feature will also be, so don't expect too much. All the views which don't have the new style yet will use the old one (OneUI 3) instead. If you already want to use the OneUI 4 style, instead of ```@style/OneUITheme``` use ```@style/OneUITheme``` in your manifest file.
1268+
Starting with v2.1.0, the new OneUI 4 design is being added to this library. Since Samsung hasn't released a stable version yet and still has a lot of stuff to fix, only some views are (partly) using the new style. As long as OneUI 4 is beta, this feature will also be, so don't expect too much. All the views which don't have the new style yet will use the old one (OneUI 3) instead. If you already want to use the OneUI 4 style, instead of ```@style/OneUITheme```, ```@style/OneUIAboutTheme``` and ```@style/OneUISplashTheme``` use ```@style/OneUI4Theme```, ```@style/OneUI4AboutTheme``` and ```@style/OneUI4SplashTheme``` in your manifest file.
12661269

12671270
## Progress
12681271

@@ -1296,6 +1299,19 @@ Starting with v2.1.0, the new OneUI 4 design is being added to this library. Sin
12961299

12971300
## Changelog
12981301

1302+
<details>
1303+
<summary>2.1.1</summary>
1304+
1305+
- ThemeColor > ThemeUtil
1306+
- dark mode fix (ThemeUtil)
1307+
- Button/AboutPage improvements
1308+
- preference notifyChanged()
1309+
- ToolbarLayout getToolbarMenuItemView()
1310+
- OneUI4 Switch
1311+
- minor changes
1312+
1313+
</details>
1314+
12991315
<details>
13001316
<summary>2.1.0</summary>
13011317

@@ -1343,7 +1359,7 @@ Starting with v2.1.0, the new OneUI 4 design is being added to this library. Sin
13431359
- NestedScrollView, RecyclerView, Round Layouts
13441360
- and much more (most of the stuff in this release)
13451361
- a lot of fixes and improvements
1346-
- support for api 21> (needs to be tested)
1362+
- support for api 21+
13471363
- Snackbar & PopupMenu
13481364
- more icons
13491365
- now available on mavencentral

app/release/app-release.apk

4.87 KB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
{
1111
"type": "SINGLE",
1212
"filters": [],
13-
"versionCode": 53,
14-
"versionName": "2.1.0",
13+
"versionCode": 54,
14+
"versionName": "2.1.1",
1515
"outputFile": "app-release.apk"
1616
}
1717
]

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
22
android.useAndroidX=true
33
android.enableJetifier=true
44
# version
5-
VERSION_NAME=2.1.0
6-
VERSION_CODE=5
5+
VERSION_NAME=2.1.1
6+
VERSION_CODE=6
77
# mavenCentral
88
GROUP_ID=io.github.yanndroid
99
ARTIFACT_ID=oneui

yanndroid/oneui/src/main/res/color/sesl_switch_thumb_on_stroke_color.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

yanndroid/oneui/src/main/res/color/sesl_switch_track_on_color.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.
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:gravity="center"
5+
android:left="3.0dip"
6+
android:right="3.0dip">
7+
<shape android:shape="oval">
8+
<size
9+
android:width="22.0dip"
10+
android:height="22.0dip" />
11+
<solid android:color="@color/sesl_switch_thumb_off_disabled_color" />
12+
<stroke
13+
android:width="1.0dip"
14+
android:color="@color/sesl4_switch_thumb_off_disabled_stroke_color" />
15+
</shape>
16+
</item>
17+
</layer-list>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item
4+
android:gravity="center"
5+
android:left="3.0dip"
6+
android:right="3.0dip">
7+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
8+
android:shape="oval">
9+
<size
10+
android:width="22.0dip"
11+
android:height="22.0dip" />
12+
<solid android:color="@color/sesl_switch_thumb_on_disabled_color" />
13+
<stroke
14+
android:width="1.0dip"
15+
android:color="@color/control_color_normal" />
16+
</shape>
17+
</item>
18+
</layer-list>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector
3+
xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:state_enabled="false" android:state_checked="true" android:drawable="@drawable/sesl4_switch_thumb_disabled_on" />
5+
<item android:state_enabled="false" android:drawable="@drawable/sesl4_switch_thumb_disabled_off" />
6+
<item android:state_checked="true" android:drawable="@drawable/sesl_switch_thumb_on" />
7+
<item android:drawable="@drawable/sesl_switch_thumb_off" />
8+
</selector>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:gravity="center">
4+
<shape android:shape="rectangle">
5+
<corners android:radius="9.25dip" />
6+
<size
7+
android:width="37.0dip"
8+
android:height="18.5dip" />
9+
<solid android:color="@color/sesl4_switch_track_off_disabled_color" />
10+
</shape>
11+
</item>
12+
</layer-list>

0 commit comments

Comments
 (0)