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

Commit 29143e0

Browse files
authored
app: SamsungCoordinatingLayout update (#88)
Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com>
1 parent 08118a0 commit 29143e0

File tree

6 files changed

+1790
-1719
lines changed

6 files changed

+1790
-1719
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ private void resetToolbarHeight() {
349349
ViewGroup.LayoutParams lp = toolbar.getLayoutParams();
350350
lp.height = mContext.getResources().getDimensionPixelSize(mIsOneUI4 ? R.dimen.sesl4_action_bar_default_height : R.dimen.sesl_action_bar_default_height) + getToolbarTopPadding();
351351
toolbar.setLayoutParams(lp);
352+
353+
collapsedTitleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(mIsOneUI4 ? R.dimen.sesl4_toolbar_title_text_size : R.dimen.sesl_toolbar_title_text_size));
352354
} else
353355
Log.w(TAG + ".resetToolbarHeight", "toolbar is null.");
354356
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ private void updateTitleLayout() {
12561256
} else {
12571257
mExtendedTitle.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
12581258
TextViewCompat.setAutoSizeTextTypeWithDefaults(mExtendedTitle, TextViewCompat.AUTO_SIZE_TEXT_TYPE_NONE);
1259-
mExtendedTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.sesl4_appbar_extended_title_text_size_with_subtitle));
1259+
mExtendedTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(mIsOneUI4 ? R.dimen.sesl4_appbar_extended_title_text_size_with_subtitle : R.dimen.sesl_appbar_extended_title_text_size_with_subtitle));
12601260
}
12611261

12621262
a.recycle();
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
package de.dlyt.yanndroid.oneui.sesl.coordinatorlayout;
2+
3+
import androidx.annotation.NonNull;
4+
import androidx.annotation.Nullable;
5+
import androidx.collection.SimpleArrayMap;
6+
import androidx.core.util.Pools;
7+
8+
import java.util.ArrayList;
9+
import java.util.HashSet;
10+
import java.util.List;
11+
12+
public final class DirectedAcyclicGraph<T> {
13+
private final Pools.Pool<ArrayList<T>> mListPool = new Pools.SimplePool<>(10);
14+
private final SimpleArrayMap<T, ArrayList<T>> mGraph = new SimpleArrayMap<>();
15+
private final ArrayList<T> mSortResult = new ArrayList<>();
16+
private final HashSet<T> mSortTmpMarked = new HashSet<>();
17+
18+
public void addNode(@NonNull T node) {
19+
if (!mGraph.containsKey(node)) {
20+
mGraph.put(node, null);
21+
}
22+
}
23+
24+
public boolean contains(@NonNull T node) {
25+
return mGraph.containsKey(node);
26+
}
27+
28+
public void addEdge(@NonNull T node, @NonNull T incomingEdge) {
29+
if (!mGraph.containsKey(node) || !mGraph.containsKey(incomingEdge)) {
30+
throw new IllegalArgumentException("All nodes must be present in the graph before being added as an edge");
31+
}
32+
33+
ArrayList<T> edges = mGraph.get(node);
34+
if (edges == null) {
35+
edges = getEmptyList();
36+
mGraph.put(node, edges);
37+
}
38+
edges.add(incomingEdge);
39+
}
40+
41+
@Nullable
42+
public List<T> getIncomingEdges(@NonNull T node) {
43+
return mGraph.get(node);
44+
}
45+
46+
@Nullable
47+
public List<T> getOutgoingEdges(@NonNull T node) {
48+
ArrayList<T> result = null;
49+
for (int i = 0, size = mGraph.size(); i < size; i++) {
50+
ArrayList<T> edges = mGraph.valueAt(i);
51+
if (edges != null && edges.contains(node)) {
52+
if (result == null) {
53+
result = new ArrayList<>();
54+
}
55+
result.add(mGraph.keyAt(i));
56+
}
57+
}
58+
return result;
59+
}
60+
61+
public boolean hasOutgoingEdges(@NonNull T node) {
62+
for (int i = 0, size = mGraph.size(); i < size; i++) {
63+
ArrayList<T> edges = mGraph.valueAt(i);
64+
if (edges != null && edges.contains(node)) {
65+
return true;
66+
}
67+
}
68+
return false;
69+
}
70+
71+
public void clear() {
72+
for (int i = 0, size = mGraph.size(); i < size; i++) {
73+
ArrayList<T> edges = mGraph.valueAt(i);
74+
if (edges != null) {
75+
poolList(edges);
76+
}
77+
}
78+
mGraph.clear();
79+
}
80+
81+
@NonNull
82+
public ArrayList<T> getSortedList() {
83+
mSortResult.clear();
84+
mSortTmpMarked.clear();
85+
86+
for (int i = 0, size = mGraph.size(); i < size; i++) {
87+
dfs(mGraph.keyAt(i), mSortResult, mSortTmpMarked);
88+
}
89+
90+
return mSortResult;
91+
}
92+
93+
private void dfs(final T node, final ArrayList<T> result, final HashSet<T> tmpMarked) {
94+
if (result.contains(node)) {
95+
return;
96+
}
97+
if (tmpMarked.contains(node)) {
98+
throw new RuntimeException("This graph contains cyclic dependencies");
99+
}
100+
tmpMarked.add(node);
101+
final ArrayList<T> edges = mGraph.get(node);
102+
if (edges != null) {
103+
for (int i = 0, size = edges.size(); i < size; i++) {
104+
dfs(edges.get(i), result, tmpMarked);
105+
}
106+
}
107+
tmpMarked.remove(node);
108+
result.add(node);
109+
}
110+
111+
int size() {
112+
return mGraph.size();
113+
}
114+
115+
@NonNull
116+
private ArrayList<T> getEmptyList() {
117+
ArrayList<T> list = mListPool.acquire();
118+
if (list == null) {
119+
list = new ArrayList<>();
120+
}
121+
return list;
122+
}
123+
124+
private void poolList(@NonNull ArrayList<T> list) {
125+
list.clear();
126+
mListPool.release(list);
127+
}
128+
}

0 commit comments

Comments
 (0)