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

Commit 5c033d5

Browse files
authored
app/ToolbarLayout: more OUI4 stuff (#67)
* app/ToolbarLayout: more OUI4 stuff Signed-off-by: BlackMesa123 <[email protected]> * app/ToolbarLayout: fix wrong Toolbar height during layoutChanges Signed-off-by: BlackMesa123 <[email protected]>
1 parent d498bf2 commit 5c033d5

File tree

23 files changed

+96
-30
lines changed

23 files changed

+96
-30
lines changed

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/dialog/ProgressDialog.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class ProgressDialog extends AlertDialog {
5252
public ProgressDialog(Context context) {
5353
super(context);
5454
mContext = context;
55+
mIsOneUI4 = context.getTheme().obtainStyledAttributes(new int[]{R.attr.isOneUI4}).getBoolean(0, false);
5556
initFormats();
5657
}
5758

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ public void onAttachedToWindow() {
290290
protected void onConfigurationChanged(Configuration newConfig) {
291291
super.onConfigurationChanged(newConfig);
292292
refreshLayout(newConfig);
293+
resetToolbarHeight();
293294
}
294295

295296
private AppCompatActivity getActivity() {
@@ -308,7 +309,7 @@ private float getDIPForPX(int i) {
308309
}
309310

310311
private int getToolbarTopPadding() {
311-
return mIsOneUI4 ? getResources().getDimensionPixelSize(R.dimen.sesl4_action_bar_top_padding) : 0;
312+
return mIsOneUI4 ? mContext.getResources().getDimensionPixelSize(R.dimen.sesl4_action_bar_top_padding) : 0;
312313
}
313314

314315
private int getWindowHeight() {
@@ -372,7 +373,7 @@ private void resetToolbarHeight() {
372373
toolbar.setPaddingRelative(mSelectMode || mSearchMode || navigationButtonVisible ? 0 : getResources().getDimensionPixelSize(R.dimen.sesl_action_bar_content_inset), getToolbarTopPadding(), 0, 0);
373374

374375
ViewGroup.LayoutParams lp = toolbar.getLayoutParams();
375-
lp.height += getToolbarTopPadding();
376+
lp.height = mContext.getResources().getDimensionPixelSize(mIsOneUI4 ? R.dimen.sesl4_action_bar_default_height : R.dimen.sesl_action_bar_default_height) + getToolbarTopPadding();
376377
toolbar.setLayoutParams(lp);
377378
} else
378379
Log.w(TAG + ".resetToolbarHeight", "toolbar is null.");
@@ -821,7 +822,7 @@ public void onOffsetChanged(SamsungAppBarLayout layout, int verticalOffset) {
821822

822823
LinearLayout collapsedTitleContainer = findViewById(R.id.toolbar_layout_collapsed_title_container);
823824

824-
if (appBarLayout.getHeight() <= ((int) getResources().getDimension(mIsOneUI4 ? R.dimen.sesl4_action_bar_height_with_padding : R.dimen.sesl_action_bar_height_with_padding))) {
825+
if (appBarLayout.seslIsCollapsed()) {
825826
collapsedTitleContainer.setAlpha(1.0f);
826827
} else {
827828
float collapsedTitleAlpha = ((150.0f / alphaRange) * (((float) layoutPosition) - toolbarTitleAlphaStart));
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+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:alpha="@dimen/sesl_disabled_color_alpha" android:color="@color/sesl4_action_bar_text_color_menu" android:state_enabled="false" />
4+
<item android:color="@color/sesl4_action_bar_text_color_menu" />
5+
</selector>

yanndroid/oneui/src/main/res/layout/samsung_toolbarlayout_main_toolbar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:id="@+id/toolbar_layout_main_toolbar"
44
android:layout_width="fill_parent"
5-
android:layout_height="?actionBarSize"
5+
android:layout_height="fill_parent"
66
android:gravity="center_vertical">
77

88
<!-- action mode checkbox -->

yanndroid/oneui/src/main/res/layout/samsung_toolbarlayout_search_toolbar.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
android:id="@+id/toolbar_layout_search_toolbar"
44
android:layout_width="match_parent"
5-
android:layout_height="?actionBarSize"
5+
android:layout_height="match_parent"
66
android:gravity="center_vertical"
77
android:visibility="gone">
88

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+
<resources>
3+
<!--#############-->
4+
<!--# OneUI 4 #-->
5+
<!--#############-->
6+
7+
<item name="sesl4_appbar_height_proportion" type="dimen">0.25</item>
8+
</resources>

yanndroid/oneui/src/main/res/values-h580dp-land/dimens.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!--# OneUI 4 #-->
1010
<!--#############-->
1111

12-
<item name="sesl4_appbar_height_proportion" type="dimen">0.32</item>
12+
<item name="sesl4_appbar_height_proportion" type="dimen">0.44</item>
1313
<dimen name="sesl4_action_bar_default_height">64.0dip</dimen>
1414
<dimen name="sesl4_action_bar_height_with_padding">80.0dip</dimen>
1515
<dimen name="sesl4_action_bar_top_padding">16.0dip</dimen>
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+
<resources>
3+
<!--#############-->
4+
<!--# OneUI 4 #-->
5+
<!--#############-->
6+
7+
<item name="sesl4_appbar_height_proportion" type="dimen">0.42</item>
8+
</resources>
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+
<resources>
3+
<!--#############-->
4+
<!--# OneUI 4 #-->
5+
<!--#############-->
6+
7+
<item name="sesl4_appbar_height_proportion" type="dimen">0.405</item>
8+
</resources>

yanndroid/oneui/src/main/res/values-h639dp/dimens.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,4 @@
22
<resources>
33
<!--AppBarLayout-->
44
<item name="sesl_appbar_height_proportion" type="dimen">0.405</item>
5-
6-
<!--#############-->
7-
<!--# OneUI 4 #-->
8-
<!--#############-->
9-
10-
<item name="sesl4_appbar_height_proportion" type="dimen">0.405</item>
115
</resources>

0 commit comments

Comments
 (0)