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

Commit cf58d08

Browse files
committed
version 1.2.2, RelatedCard, cleanup, string update
1 parent 6a6ae88 commit cf58d08

File tree

144 files changed

+1505
-1176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+1505
-1176
lines changed

README.md

Lines changed: 84 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![](https://img.shields.io/static/v1?label=telegram&message=Yanndroid&color=blue)](https://t.me/Yanndroid)
99

1010
# Samsung OneUi Design
11-
A library for Android, which makes your app look like Samsung's OneUI. In this library, there is a theme which will apply for each view (see [Progress](#Progress)) in your layout. Of course it also has dark mode and even landscape/dex support. The texts which are the custom views are all translated to 90 languages, so you don't need to worry for these. This library has been tested in AndroidStudio, but should work in other IDEs too. You can try out the latest example [here](https://github.com/Yanndroid/SamsungOneUi/raw/master/app/release/app-release.apk).
11+
A library for Android, which makes your app look like Samsung's OneUI 3. In this library, there is a theme which will apply for each view (see [Progress](#Progress)) in your layout. Of course it also has dark mode and even landscape/dex support. The text which is in the custom views is translated to 90 languages, so you don't need to worry for these. This library has been tested in AndroidStudio, but should work in other IDEs too. You can try out the latest example [here](https://github.com/Yanndroid/SamsungOneUi/raw/master/app/release/app-release.apk). Suggestions, improvements and help are always welcome.
1212

1313
Excuse my bad english, feel free to correct it. :)
1414

@@ -23,7 +23,9 @@ Excuse my bad english, feel free to correct it. :)
2323
- [DrawerDivider](#DrawerDivider)
2424
- [SplashViewSimple](#SplashViewSimple)
2525
- [SplashViewAnimated](#SplashViewAnimated)
26+
- [AboutPage](#AboutPage)
2627
- [SwitchBar](#SwitchBar)
28+
- [RelatedCard](#RelatedCard)
2729
- [SeekBar](#SeekBar)
2830
- [ProgressBar](#ProgressBar)
2931
- [Button](#Button)
@@ -59,7 +61,7 @@ allprojects {
5961
2. Add the dependency to build.gradle (Module: ...)
6062
```gradle
6163
dependencies {
62-
implementation 'com.github.Yanndroid:SamsungOneUi:1.2.0'
64+
implementation 'com.github.Yanndroid:SamsungOneUi:1.2.2'
6365
...
6466
}
6567
```
@@ -90,7 +92,7 @@ repositories {
9092
9193
9294
dependencies {
93-
implementation 'de.dlyt.yanndroid:samsung:1.2.0'
95+
implementation 'de.dlyt.yanndroid:samsung:1.2.2'
9496
...
9597
}
9698
```
@@ -106,7 +108,7 @@ dependencies {
106108
```
107109

108110
## Usage
109-
In general most of the views (see [Progress](#Progress)) are styled automatically when you set ```android:theme="@style/SamsungTheme"``` in AndroidManifest.xml.
111+
In general, most of the views (see [Progress](#Progress)) are styled automatically when you set ```android:theme="@style/SamsungTheme"``` in AndroidManifest.xml.
110112

111113
### DrawerLayout
112114
"Ready-to-go" DrawerLayout with collapsing toolbar.
@@ -115,14 +117,14 @@ In general most of the views (see [Progress](#Progress)) are styled automaticall
115117
android:layout_width="match_parent"
116118
android:layout_height="match_parent"
117119
app:drawer_icon="..."
118-
app:drawer_viewId="@id/viewindrawer"
120+
app:drawer_viewId="@id/viewInDrawer"
119121
app:toolbar_subtitle="..."
120122
app:toolbar_title="..."
121123
app:toolbar_expanded="..."
122124
app:toolbar_expandable="...">
123125

124126
<View
125-
android:id="@+id/viewindrawer"
127+
android:id="@+id/viewInDrawer"
126128
... />
127129

128130
<!--other views-->
@@ -429,6 +431,44 @@ Listener for the splash animation
429431
public void setSplashAnimationListener(Animation.AnimationListener listener)
430432
```
431433

434+
### AboutPage
435+
A layout that looks like and has the same functions as the about screen in any Samsung app.
436+
437+
<img src="readme-resources/screenshots/aboutpage_1.png" width="150"/> <img src="readme-resources/screenshots/aboutpage_2.png" width="150"/> <img src="readme-resources/screenshots/aboutpage_3.png" width="150"/>
438+
439+
```xml
440+
<de.dlyt.yanndroid.samsung.layout.AboutPage
441+
android:layout_width="match_parent"
442+
android:layout_height="match_parent"
443+
app:optional_text="...">
444+
445+
<com.google.android.material.button.MaterialButton
446+
style="@style/ButtonStyle.AboutPage"
447+
android:text="..." />
448+
449+
450+
</de.dlyt.yanndroid.samsung.layout.AboutPage>
451+
```
452+
The app name and version are automatically added to the view. The info icon at the top right will redirect the user to the app info in settings. The ```app:optional_text="..."``` is the text between the version and the status text. The status text will change according to the state you set the view (see below). You can use ```style="@style/ButtonStyle.AboutPage"``` for the buttons, which are shown at the bottom.
453+
:warning: For the back button (top left) to work you need to call this methode in your activity ```aboutPage.initAboutPage(this);```
454+
455+
#### Methods
456+
Essential for the back button to work.
457+
```java
458+
public void initAboutPage(Activity activity)
459+
```
460+
Set the update state of the view to either ```AboutPage.LOADING```, ```AboutPage.NO_UPDATE``` or ```AboutPage.UPDATE_AVAILABLE```. This will change the visibility of certain views and the text of the Status.
461+
```java
462+
public void setUpdateState(@UpdateState int state)
463+
```
464+
Set the optional text between the version and the status text.
465+
```java
466+
public void setOptionalText(String text)
467+
```
468+
OnClickListener for the update button.
469+
```java
470+
public void setUpdateButtonOnClickListener(OnClickListener listener)
471+
```
432472

433473
### SwitchBar
434474
A SwitchBar like in the wifi or bluetooth settings.
@@ -458,6 +498,36 @@ Switchbar Listener.
458498
public void addOnSwitchChangeListener(OnSwitchChangeListener onSwitchChangeListener)
459499
```
460500

501+
### RelatedCard
502+
It's like the "Looking for something else?" card in settings.
503+
504+
<img src="readme-resources/screenshots/relatedcard.png" width="300"/>
505+
506+
(Depending on your screen right now you might not see it, but there's actually a light blue card around it.)
507+
508+
```xml
509+
<de.dlyt.yanndroid.samsung.RelatedCard
510+
android:layout_width="match_parent"
511+
android:layout_height="wrap_content"
512+
app:title="...">
513+
514+
<com.google.android.material.textview.MaterialTextView
515+
style="@style/RelatedButtonStyle"
516+
android:text="..." />
517+
518+
519+
</de.dlyt.yanndroid.samsung.RelatedCard>
520+
```
521+
You can simply use ```style="@style/RelatedButtonStyle"``` for the child TextViews.
522+
523+
#### Methods
524+
Get/set the title text.
525+
```java
526+
public String getTitle()
527+
public void setTitle(String title)
528+
```
529+
530+
461531
### SeekBar
462532
A Seekbar like the brightness slider in the QS.
463533

@@ -469,7 +539,7 @@ A Seekbar like the brightness slider in the QS.
469539
android:layout_height="wrap_content"
470540
app:seslSeekBarMode="expand" />
471541
```
472-
If you don't want the expanding seekbar, you can use the default seekbar instead , as the style will also apply on this one.
542+
If you don't want/need the expanding seekbar, you can use the default seekbar instead, as the style will also apply on this one.
473543

474544
#### Methods
475545
Set a warning at progress i.
@@ -726,6 +796,7 @@ My sample app icon for example:
726796
- [x] Landscape support
727797
- [x] Tablet support
728798
- [x] About screen
799+
- [x] Related card
729800
- [x] Button
730801
- [x] Scrollbar
731802
- [x] Desktop support (DeX) *
@@ -739,7 +810,6 @@ My sample app icon for example:
739810
- [ ] Preferences
740811
- [ ] SearchView
741812
- [ ] Tooltip
742-
- [ ] Related card
743813
- [ ] Progress dialog
744814
- [ ] Bottom navigation
745815
- [ ] (Textview)
@@ -754,6 +824,7 @@ My sample app icon for example:
754824

755825
- Scrollbar
756826
- AboutPage
827+
- RelatedCard
757828
- corner fix
758829
- language update
759830
- customizable splash animation
@@ -769,11 +840,11 @@ My sample app icon for example:
769840
<summary>1.2.1</summary>
770841

771842
- landscape support
772-
- table support
843+
- tablet support
773844
- dex support
774845
- expandable attribute for toolbar
775846
- toolbar subtitle color
776-
- added subheader style
847+
- added Header style
777848

778849
</details>
779850

@@ -785,7 +856,7 @@ My sample app icon for example:
785856
- readme finished
786857
- much more icons
787858
- rtl support
788-
- 90 languages
859+
- translated to 90 languages
789860

790861
</details>
791862

@@ -796,10 +867,10 @@ My sample app icon for example:
796867
- most of the stuff (I don't remember anymore...)
797868

798869
</details>
799-
870+
&nbsp;
800871

801872
## More info
802-
- [Official OneUI Guide](https://design.samsung.com/global/contents/one-ui/download/oneui_design_guide_eng.pdf)
873+
- [Official OneUI Design Guide](https://design.samsung.com/global/contents/one-ui/download/oneui_design_guide_eng.pdf)
803874

804875

805876
## Special thanks to:

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ dependencies {
3434
implementation 'com.google.android.material:material:1.4.0'
3535
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
3636
implementation project(path: ':yanndroid:samsung')
37-
implementation 'androidx.preference:preference:1.1.1'
3837
testImplementation 'junit:junit:4.+'
3938
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
4039
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

app/release/app-release.apk

-1.31 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"versionCode": 1,
14-
"versionName": "1.2.1",
14+
"versionName": "1.2.2",
1515
"outputFile": "app-release.apk"
1616
}
1717
]

app/src/main/java/de/dlyt/yanndroid/samsungexample/AboutActivity.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package de.dlyt.yanndroid.samsungexample;
22

3+
import android.content.res.Configuration;
34
import android.os.Bundle;
5+
import android.view.WindowManager;
46

57
import androidx.appcompat.app.AppCompatActivity;
68

@@ -20,12 +22,16 @@ protected void onCreate(Bundle savedInstanceState) {
2022
AboutPage about_page = findViewById(R.id.about_page);
2123
about_page.initAboutPage(this);
2224

23-
MaterialButton about_btn1 = findViewById(R.id.about_btn1);
24-
MaterialButton about_btn2 = findViewById(R.id.about_btn2);
25-
MaterialButton about_btn3 = findViewById(R.id.about_btn3);
26-
about_btn1.setOnClickListener(v -> about_page.setUpdateState(AboutPage.LOADING));
27-
about_btn2.setOnClickListener(v -> about_page.setUpdateState(AboutPage.NO_UPDATE));
28-
about_btn3.setOnClickListener(v -> about_page.setUpdateState(AboutPage.UPDATE_AVAILABLE));
25+
((MaterialButton) findViewById(R.id.about_btn1)).setOnClickListener(v -> about_page.setUpdateState(AboutPage.LOADING));
26+
((MaterialButton) findViewById(R.id.about_btn2)).setOnClickListener(v -> about_page.setUpdateState(AboutPage.NO_UPDATE));
27+
((MaterialButton) findViewById(R.id.about_btn3)).setOnClickListener(v -> about_page.setUpdateState(AboutPage.UPDATE_AVAILABLE));
28+
29+
30+
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
31+
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
32+
} else {
33+
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
34+
}
2935

3036
}
3137
}

0 commit comments

Comments
 (0)