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

Commit a0a5dff

Browse files
committed
README.md update
1 parent 591b7fc commit a0a5dff

File tree

1 file changed

+31
-55
lines changed

1 file changed

+31
-55
lines changed

README.md

Lines changed: 31 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ dependencies {
142142
</details>
143143
<br/>
144144

145+
If you encounter problems with Proguard (missing classes), see this [Issue](https://github.com/Yanndroid/OneUI-Design-Library/issues/53) by [AlirezaIvaz](https://github.com/AlirezaIvaz).
146+
145147
## Usage
146148
In general, most of the views are styled automatically when you apply ```android:theme="@style/OneUITheme"``` in AndroidManifest.xml, the usage of the custom views in the library however is needed to achieve the best results.
147149

@@ -200,7 +202,7 @@ In general, most of the views are styled automatically when you apply ```android
200202

201203
</de.dlyt.yanndroid.oneui.layout.DrawerLayout>
202204
```
203-
The children of this view can be at four different location: on the **main screen**, in the **drawer**, in the **footer** (useful for views like BottomNavigationView) or in the **appbar header** as a custom title. To specify the location of each child you can set the attribute ```app:layout_location``` of the child to either ```main_content``` (default), ```drawer_panel```, ```footer``` or ```appbar_header```.
205+
The children of this view can be at five different location: on the **main screen**, in the **drawer**, in the **footer** (useful for views like BottomNavigationView), in the **appbar header** as a custom title or in the **root layout** (views like FAB). To specify the location of each child you can set the attribute ```app:layout_location``` of the child to either ```main_content``` (default), ```drawer_panel```, ```footer```, ```appbar_header``` or ```root```.
204206

205207
```app:toolbar_title``` and ```app:toolbar_subtitle``` can be used to set the title and subtitle of the AppBar and Toolbar. The AppBar status is set to expanded by default, you can simply set ```app:toolbar_expanded``` to false if you want it to be collapsed. On small screens/dpi the toolbar will not expand.
206208

@@ -222,7 +224,7 @@ public void setDrawerButtonIcon(Drawable drawerIcon)
222224
public void setDrawerButtonTooltip(CharSequence tooltipText)
223225
public void setDrawerButtonOnClickListener(OnClickListener listener)
224226
```
225-
Toolbar methods. (for more use ```getToolbarLayout()``` and it's methods)
227+
Toolbar methods. (for more, use ```getToolbarLayout()``` and it's methods)
226228
```java
227229
public void setToolbarTitle(CharSequence title)
228230
public void setToolbarTitle(CharSequence expandedTitle, CharSequence collapsedTitle)
@@ -239,8 +241,6 @@ Open/close the drawer panel with an optional animation.
239241
public void setDrawerOpen(Boolean open, Boolean animate)
240242
```
241243

242-
See [Advanced](#Advanced) for even more methods.
243-
244244
### ToolbarLayout
245245
"Ready-to-go" Samsung's AppBar.
246246

@@ -259,7 +259,7 @@ See [Advanced](#Advanced) for even more methods.
259259

260260
</de.dlyt.yanndroid.oneui.layout.ToolbarLayout>
261261
```
262-
The children of this view can be at three different location: on the **main screen**, in the **footer** (useful for views like BottomNavigationView) or in the **appbar header** as a custom title. To specify the location of each child you can set the attribute ```app:layout_location``` of the child to either ```main_content``` (default), ```footer``` or ```appbar_header```.
262+
The children of this view can be at four different location: on the **main screen**, in the **footer** (useful for views like BottomNavigationView), in the **appbar header** as a custom title or in the **root layout** (views like FAB). To specify the location of each child you can set the attribute ```app:layout_location``` of the child to either ```main_content``` (default), ```footer```, ```appbar_header``` or ```root```.
263263

264264
```app:title``` and ```app:subtitle``` can be used to set the title and subtitle of the AppBar and Toolbar. The AppBar status is set to expanded by default, you can simply set ```app:toolbar_expanded``` to false if you want it to be collapsed. You can also disable totally the CollapsingToolbar by setting ```app:toolbar_expandable``` to false. On small screens/dpi the toolbar will not expand anyway.
265265

@@ -297,22 +297,12 @@ public void setNavigationButtonVisible(boolean visible)
297297
public void setNavigationButtonBadge(int count)
298298
public void setNavigationOnClickListener(OnClickListener listener)
299299
```
300-
Manage the Toolbar Menu. In the Menu resource file use ```app:showAsAction="always"``` to show the item as a Action instead of in the popup menu. Changing the Icon or the Visibility won't do anything if this item isn't a Action.
300+
Manage the Toolbar Menu. In the Menu resource file use ```app:showAsAction="always"``` to show the item as a Action instead of in the popup menu.
301301
```java
302-
public void inflateToolbarMenu(@MenuRes int resId)
302+
public void inflateToolbarMenu(Menu menu)
303+
public void inflateToolbarMenu(@MenuRes int menuRes)
303304
public Menu getToolbarMenu()
304305
public void setOnToolbarMenuItemClickListener(OnMenuItemClickListener listener)
305-
306-
public void setOverflowMenuBadge(MenuItem item, Integer badge)
307-
public Integer getOverflowMenuBadge(MenuItem item)
308-
309-
public void setToolbarMenuItemIcon(MenuItem item, Drawable drawable)
310-
public void setToolbarMenuItemIcon(MenuItem item, @DrawableRes int resId)
311-
public void setToolbarMenuItemTitle(MenuItem item, CharSequence title) //title = tooltip
312-
public void setToolbarMenuItemVisibility(MenuItem item, boolean visible)
313-
public void setToolbarMenuItemEnabled(MenuItem item, boolean enabled)
314-
315-
public ToolbarImageButton getToolbarMenuItemView(MenuItem item)
316306
```
317307
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.
318308
```java
@@ -323,28 +313,34 @@ public void setSelectModeCount(int count)
323313
public void setSelectModeAllChecked(boolean checked)
324314
public void setSelectModeAllCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener)
325315

316+
public void setSelectModeBottomMenu(Menu menu, OnMenuItemClickListener listener)
326317
public void setSelectModeBottomMenu(@MenuRes int menuRes, OnMenuItemClickListener listener)
327318
public Menu getSelectModeBottomMenu()
328319
```
329-
SearchMode. Changes the layout of the Toolbar to a Search layout, with a text field and a voice input icon. (see [screenshot](readme-resources/screenshots/toolbarlayout_searchmode.png))
320+
SearchMode. Changes the layout of the Toolbar to a Search layout, with a text field and a voice input icon (see [screenshot](readme-resources/screenshots/toolbarlayout_searchmode.png)).
330321
```java
331322
public void showSearchMode()
332323
public void dismissSearchMode()
333324
public boolean isSearchMode()
334325
public void setSearchModeListener(SearchModeListener listener)
335-
336-
public void onSearchModeVoiceInputResult(ActivityResult result)
337-
338-
//for the voice input to work you need to add this in your activity/fragment:
339-
private ActivityResultLauncher<Intent> activityResultLauncher;
326+
```
327+
:warning: For the voice input to work, you need to add this in your activity/fragment:
328+
```java
329+
private ActivityResultLauncher<Intent> activityResultLauncher;
340330
//onCreate:
341331
activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> toolbarLayout.onSearchModeVoiceInputResult(result));
342332
//setSearchModeListener - onVoiceInputClick
343333
activityResultLauncher.launch(intent);
334+
```
335+
Also add this in your manifest for api 30+:
336+
```xml
337+
<queries>
338+
<intent>
339+
<action android:name="android.speech.action.RECOGNIZE_SPEECH" />
340+
</intent>
341+
</queries>
344342
```
345343

346-
See [Advanced](#Advanced) for even more methods.
347-
348344
### SplashView
349345
The activity you are gonna use for SplashView has a different style than the rest of the application, so you need to add this ```android:theme="@style/OneUISplashTheme"``` to your splash activity in AndroidManifest.
350346

@@ -393,8 +389,6 @@ Listener for the Splash Animation
393389
public void setSplashAnimationListener(Animation.AnimationListener listener)
394390
```
395391

396-
See [Advanced](#Advanced) for even more methods.
397-
398392
2) A simple Splash View without animation. (Samsung apps use their own ```com.samsung.android.startingwindow.LAYOUT_RESID_FOR_MASS``` flag in manifest)
399393

400394
<img loading="lazy" align="left" src="readme-resources/screenshots/splash_simple.png" width="150"/>
@@ -425,8 +419,6 @@ Returns the text of the Splash TextView
425419
public String getText()
426420
```
427421

428-
See [Advanced](#Advanced) for even more methods.
429-
430422
### AboutPage
431423
A layout that looks like and has the same functions as the About Screen in any Samsung app. Like the [SplashView](#SplashView), the activity you're gonna use has a different style than the rest of the application, so you need to add this ```android:theme="@style/OneUIAboutTheme"``` to your About Activity in AndroidManifest.
432424

@@ -468,8 +460,6 @@ public void setUpdateButtonOnClickListener(OnClickListener listener)
468460
public void setRetryButtonOnClickListener(OnClickListener listener)
469461
```
470462

471-
See [Advanced](#Advanced) for even more methods.
472-
473463
### SwitchBarLayout
474464
This is a extended [ToolbarLayout](#ToolbarLayout) with [SwitchBar](#SwitchBar). Useful for creating inner preferences layouts in pair with [SwitchPreferenceScreen](#SwitchPreferenceScreen).
475465

@@ -508,8 +498,6 @@ Expand or collapse the toolbar with an optional animation.
508498
public void setToolbarExpanded(boolean expanded, boolean animate)
509499
```
510500

511-
See [Advanced](#Advanced) for even more methods.
512-
513501
### CoordinatorLayout
514502
Samsung's CoordinatorLayout
515503
```xml
@@ -739,7 +727,7 @@ Control the state (colored, bold text).
739727
```java
740728
public void setButtonSelected(Boolean selected)
741729
public void toggleButtonSelected()
742-
public Boolean isButtonSelcted()
730+
public Boolean isButtonSelected()
743731
```
744732
Enable/disable the OptionButton.
745733
```java
@@ -1100,21 +1088,21 @@ Samsung's Radio Preferences used in Light/Dark mode Settings and Resolution Sett
11001088

11011089
Create a PopupMenu with it's anchor.
11021090
```java
1103-
//de.dlyt.yanndroid.oneui.view.PopupMenu
1091+
//de.dlyt.yanndroid.oneui.menu.PopupMenu
11041092
PopupMenu popupMenu = new PopupMenu(view);
11051093
```
1106-
Inflate a menu resource or a list of the items to show.
1094+
Inflate a menu resource or a Menu (de.dlyt.yanndroid.oneui.menu.Menu).
11071095
```java
11081096
public void inflate(@MenuRes int menuRes)
1109-
public void inflate(ArrayList<MenuItem> menuItems)
1097+
public void inflate(Menu menu)
11101098
```
1111-
Get the menu (will only work if you inflate with a menu resource)
1099+
Get the menu.
11121100
```java
11131101
public Menu getMenu()
11141102
```
1115-
Set the menu item click listener.
1103+
Set the menu item click and update listener.
11161104
```java
1117-
public void setOnMenuItemClickListener(OnMenuItemClickListener listener)
1105+
public void setPopupMenuListener(PopupMenuListener listener)
11181106
```
11191107
Show and dismiss the popup.
11201108
```java
@@ -1123,17 +1111,6 @@ public void show(int xoff, int yoff) //with offset
11231111
public void dismiss()
11241112
public boolean isShowing()
11251113
```
1126-
Manage the menu items.
1127-
```java
1128-
public void setMenuItemBadge(MenuItem item, Integer badge)
1129-
public void setMenuItemTitle(MenuItem item, CharSequence title)
1130-
public void setMenuItemEnabled(MenuItem item, boolean enabled)
1131-
public Integer getMenuItemBadge(MenuItem item)
1132-
```
1133-
Get the number of all badges in the menu.
1134-
```java
1135-
public Integer getTotalBadgeCount()
1136-
```
11371114

11381115
### Tooltip
11391116
Samsung's Tooltip.
@@ -1174,7 +1151,7 @@ Snackbar.make(view, "Text label", Snackbar.LENGTH_SHORT).setAction("Action", new
11741151
```
11751152

11761153
### Advanced
1177-
This is for advanced usage only. I've added the method ```getView(int view)``` to some of the custom views to access the views inside it and change them directly. This can be helpful if you want to do something which isn't implemented in the custom views yet as I can't think of all possible uses. Currently this method is available in DrawerLayout, ToolbarLayout, SplashView, AboutPage and SwitchBarLayout.
1154+
For further customization or if you need something which isn't implemented in the custom views yet (I can't think of all possible uses), you can always access the views inside it with ```findViewById(int id)``` and change them directly. For the Ids please refer to the source code.
11781155

11791156
### Icons
11801157
There are also a lot of the stock icons you can find in Samsung apps included in this library, and we will add more over time. You can use them with ```@drawable/ic_samsung_...``` and ```R.drawable.ic_samsung_...```.
@@ -1436,5 +1413,4 @@ Starting with v2.1.0, the new OneUI 4 design is being added to this library. Sin
14361413
- [BlackMesa123](https://github.com/BlackMesa123) for a lot of OneUI stuff, more compatibility and his experience.
14371414
- [TenSeventy7](https://github.com/TenSeventy7) for some stuff and help.
14381415
- [leonbcode](https://github.com/leonbcode) for github actions, so this library is always up-to-date.
1439-
- [AlirezaIvaz](https://github.com/AlirezaIvaz) for translation correction (Persian) and issue reporting.
1440-
- [nfauv2001](https://github.com/nfauv2001) for helping me out with my english.
1416+
- All the [Contributors](https://github.com/Yanndroid/OneUI-Design-Library/graphs/contributors) and Issue Reporters.

0 commit comments

Comments
 (0)