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

Commit 5233f15

Browse files
committed
- Number/Time/Date pickers (incomplete)
- icons imrpovements
1 parent b5aa7fb commit 5233f15

File tree

61 files changed

+13783
-22
lines changed

Some content is hidden

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

61 files changed

+13783
-22
lines changed

app/src/main/java/de/dlyt/yanndroid/oneuiexample/MainActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
2929

3030
import de.dlyt.yanndroid.oneui.dialog.AlertDialog;
3131
import de.dlyt.yanndroid.oneui.dialog.ClassicColorPickerDialog;
32+
import de.dlyt.yanndroid.oneui.dialog.DatePickerDialog;
3233
import de.dlyt.yanndroid.oneui.dialog.DetailedColorPickerDialog;
3334
import de.dlyt.yanndroid.oneui.dialog.ProgressDialog;
3435
import de.dlyt.yanndroid.oneui.layout.DrawerLayout;
3536
import de.dlyt.yanndroid.oneui.layout.ToolbarLayout;
3637
import de.dlyt.yanndroid.oneui.menu.MenuItem;
3738
import de.dlyt.yanndroid.oneui.menu.PopupMenu;
39+
import de.dlyt.yanndroid.oneui.sesl.picker.app.SeslDatePickerDialog;
40+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslDatePicker;
3841
import de.dlyt.yanndroid.oneui.sesl.support.ViewSupport;
3942
import de.dlyt.yanndroid.oneui.sesl.tabs.SamsungTabLayout;
4043
import de.dlyt.yanndroid.oneui.sesl.utils.ReflectUtils;
@@ -326,6 +329,16 @@ public void onColorSet(int i) {
326329
}
327330
}
328331

332+
public void datePickerDialog(View view){
333+
DatePickerDialog datePickerDialog = new DatePickerDialog(mContext, new SeslDatePickerDialog.OnDateSetListener() {
334+
@Override
335+
public void onDateSet(SeslDatePicker seslDatePicker, int year, int month, int day) {
336+
Toast.makeText(mContext, "Year: " + year + "\nMonth: " + month + "\nDay: " + day, Toast.LENGTH_SHORT).show();
337+
}
338+
});
339+
datePickerDialog.show();
340+
}
341+
329342
public void standardDialog(View view) {
330343
AlertDialog dialog = new AlertDialog.Builder(this)
331344
.setTitle("Title")

app/src/main/java/de/dlyt/yanndroid/oneuiexample/tabs/IconsTab.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class IconsTab extends Fragment {
106106
R.drawable.ic_oui3_sd_card,
107107
R.drawable.ic_oui3_secure_folder,
108108
R.drawable.ic_oui3_security,
109-
R.drawable.ic_oui3_selected_2,
109+
R.drawable.ic_oui3_selected,
110110
R.drawable.ic_oui3_send,
111111
R.drawable.ic_oui3_settings,
112112
R.drawable.ic_oui3_settings_2,

app/src/main/java/de/dlyt/yanndroid/oneuiexample/tabs/ViewsTab.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
import java.util.ArrayList;
1818
import java.util.List;
1919

20+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslDatePicker;
21+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslDatePickerSpinnerLayout;
22+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslNumberPicker;
23+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslSpinningDatePickerSpinner;
24+
import de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslTimePicker;
2025
import de.dlyt.yanndroid.oneui.widget.ProgressBar;
2126
import de.dlyt.yanndroid.oneui.widget.SeekBar;
2227
import de.dlyt.yanndroid.oneui.widget.SwitchBar;
@@ -101,6 +106,26 @@ public void onStopTrackingTouch(SeekBar seslSeekBar) {
101106
dataAdapter.setDropDownViewResource(R.layout.sesl_simple_spinner_dropdown_item);
102107
spinner.setAdapter(dataAdapter);
103108

109+
//Pickers //todo: selected number not centered on each scroll picker
110+
SeslSpinningDatePickerSpinner ssdps = mRootView.findViewById(R.id.ssdps);
111+
112+
SeslNumberPicker snp = mRootView.findViewById(R.id.snp); //todo: need to find out how dismiss edit-mode when "done" is clicked in keyboard (dismissing keyboard with back key works | on all the other pickers it's working)
113+
snp.setMaxValue(100);
114+
snp.setMinValue(0);
115+
snp.setValue(50);
116+
117+
SeslDatePicker sdp = mRootView.findViewById(R.id.sdp);
118+
sdp.setFirstDayOfWeek(2);
119+
sdp.setMinDate(0);
120+
sdp.setMaxDate(4133966209349L);
121+
122+
SeslTimePicker stp = mRootView.findViewById(R.id.stp);
123+
stp.setIs24HourView(true);
124+
125+
SeslDatePickerSpinnerLayout sdpsl = mRootView.findViewById(R.id.sdpsl);
126+
sdpsl.setMinDate(0);
127+
sdpsl.setMaxDate(4133966209349L);
128+
104129
}
105130

106131
}

app/src/main/res/layout/fragment_views_tab.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,58 @@
391391

392392
</com.google.android.material.card.MaterialCardView>
393393

394+
<com.google.android.material.textview.MaterialTextView
395+
style="?android:listSeparatorTextViewStyle"
396+
android:text="Number Pickers" />
397+
398+
399+
<com.google.android.material.card.MaterialCardView
400+
android:layout_width="match_parent"
401+
android:layout_height="wrap_content">
402+
403+
<LinearLayout
404+
android:layout_width="match_parent"
405+
android:layout_height="wrap_content"
406+
android:orientation="vertical">
407+
408+
<com.google.android.material.button.MaterialButton
409+
style="@style/ButtonStyle.Colored"
410+
android:layout_width="200dp"
411+
android:layout_height="wrap_content"
412+
android:layout_gravity="center"
413+
android:layout_marginVertical="10dp"
414+
android:onClick="datePickerDialog"
415+
android:text="Dialog" />
416+
417+
<de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslSpinningDatePickerSpinner
418+
android:id="@+id/ssdps"
419+
android:layout_width="match_parent"
420+
android:layout_height="wrap_content" />
421+
422+
<de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslNumberPicker
423+
android:id="@+id/snp"
424+
android:layout_width="wrap_content"
425+
android:layout_height="wrap_content" />
426+
427+
<de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslDatePicker
428+
android:id="@+id/sdp"
429+
android:layout_width="match_parent"
430+
android:layout_height="wrap_content" />
431+
432+
<de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslTimePicker
433+
android:id="@+id/stp"
434+
android:layout_width="match_parent"
435+
android:layout_height="wrap_content" />
436+
437+
<de.dlyt.yanndroid.oneui.sesl.picker.widget.SeslDatePickerSpinnerLayout
438+
android:id="@+id/sdpsl"
439+
android:layout_width="match_parent"
440+
android:layout_height="wrap_content" />
441+
442+
</LinearLayout>
443+
444+
</com.google.android.material.card.MaterialCardView>
445+
394446
<View
395447
android:layout_width="match_parent"
396448
android:layout_height="@dimen/sesl_list_subheader_min_height"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package androidx.reflect;
2+
3+
import android.util.Log;
4+
5+
import java.lang.reflect.Field;
6+
import java.lang.reflect.Method;
7+
8+
import dalvik.system.PathClassLoader;
9+
10+
public class SeslPathClassReflector {
11+
public static Class<?> getClass(PathClassLoader pathClassLoader, String str) {
12+
try {
13+
return Class.forName(str, true, pathClassLoader);
14+
} catch (ClassNotFoundException e) {
15+
Log.e("SeslPathClassReflector", "Fail to get class", e);
16+
return null;
17+
}
18+
}
19+
20+
public static Method getMethod(PathClassLoader pathClassLoader, String str, String str2, Class<?>... clsArr) {
21+
Class<?> cls = getClass(pathClassLoader, str);
22+
if (cls == null) {
23+
return null;
24+
}
25+
try {
26+
return cls.getMethod(str2, clsArr);
27+
} catch (NoSuchMethodException e) {
28+
Log.e("SeslPathClassReflector", str2 + " NoSuchMethodException", e);
29+
return null;
30+
}
31+
}
32+
33+
public static Field getField(PathClassLoader pathClassLoader, String str, String str2) {
34+
Class<?> cls = getClass(pathClassLoader, str);
35+
if (cls == null) {
36+
return null;
37+
}
38+
try {
39+
return cls.getField(str2);
40+
} catch (NoSuchFieldException e) {
41+
Log.e("SeslPathClassReflector", str2 + " NoSuchMethodException", e);
42+
return null;
43+
}
44+
}
45+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package androidx.reflect.content.res;
2+
3+
import android.content.res.Resources;
4+
5+
import androidx.reflect.SeslBaseReflector;
6+
7+
import java.lang.reflect.Field;
8+
9+
public class SeslCompatibilityInfoReflector {
10+
public static float getField_applicationScale(Resources resources) {
11+
Field field;
12+
Object compatibilityInfo = SeslResourcesReflector.getCompatibilityInfo(resources);
13+
if (compatibilityInfo == null || (field = SeslBaseReflector.getField("android.content.res.CompatibilityInfo", "applicationScale")) == null) {
14+
return 1.0f;
15+
}
16+
Object obj = SeslBaseReflector.get(compatibilityInfo, field);
17+
if (obj instanceof Integer) {
18+
return (float) ((Integer) obj).intValue();
19+
}
20+
return 1.0f;
21+
}
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package androidx.reflect.content.res;
2+
3+
import android.content.res.Resources;
4+
5+
import androidx.reflect.SeslBaseReflector;
6+
7+
import java.lang.reflect.Method;
8+
9+
public class SeslResourcesReflector {
10+
public static final Class<?> mClass = Resources.class;
11+
12+
public static Object getCompatibilityInfo(Resources resources) {
13+
Method method = SeslBaseReflector.getMethod(mClass, "getCompatibilityInfo", new Class[0]);
14+
if (method == null) {
15+
return null;
16+
}
17+
Object invoke = SeslBaseReflector.invoke(resources, method, new Object[0]);
18+
if (invoke.getClass().getName().equals("android.content.res.CompatibilityInfo")) {
19+
return invoke;
20+
}
21+
return null;
22+
}
23+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package androidx.reflect.feature;
2+
3+
import android.os.Build;
4+
5+
import androidx.reflect.SeslBaseReflector;
6+
7+
import java.lang.reflect.Method;
8+
9+
public class SeslCscFeatureReflector {
10+
public static String mClassName;
11+
12+
static {
13+
int i = Build.VERSION.SDK_INT;
14+
if (i >= 29) {
15+
mClassName = "com.samsung.sesl.feature.SemCscFeature";
16+
} else if (i >= 24) {
17+
mClassName = "com.samsung.android.feature.SemCscFeature";
18+
} else {
19+
mClassName = "com.sec.android.app.CscFeature";
20+
}
21+
}
22+
23+
public static Object getInstance() {
24+
Method method = SeslBaseReflector.getMethod(mClassName, "getInstance", new Class[0]);
25+
if (method != null) {
26+
Object invoke = SeslBaseReflector.invoke(null, method, new Object[0]);
27+
if (invoke.getClass().getName().equals(mClassName)) {
28+
return invoke;
29+
}
30+
}
31+
return null;
32+
}
33+
34+
public static String getString(String str, String str2) {
35+
Object obj = null;
36+
if (Build.VERSION.SDK_INT >= 29) {
37+
obj = SeslBaseReflector.invoke(null, SeslBaseReflector.getDeclaredMethod(mClassName, "hidden_getString", String.class, String.class), str, str2);
38+
} else {
39+
Object instance = getInstance();
40+
if (instance != null) {
41+
obj = SeslBaseReflector.invoke(instance, SeslBaseReflector.getMethod(mClassName, "getString", String.class, String.class), str, str2);
42+
}
43+
}
44+
return obj instanceof String ? (String) obj : str2;
45+
}
46+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package androidx.reflect.feature;
2+
3+
import android.os.Build;
4+
5+
import androidx.reflect.SeslBaseReflector;
6+
7+
import java.lang.reflect.Method;
8+
9+
public class SeslFloatingFeatureReflector {
10+
public static String mClassName;
11+
12+
static {
13+
int i = Build.VERSION.SDK_INT;
14+
if (i >= 29) {
15+
mClassName = "com.samsung.sesl.feature.SemFloatingFeature";
16+
} else if (i >= 24) {
17+
mClassName = "com.samsung.android.feature.SemFloatingFeature";
18+
} else {
19+
mClassName = "com.samsung.android.feature.FloatingFeature";
20+
}
21+
}
22+
23+
public static Object getInstance() {
24+
Method method = SeslBaseReflector.getMethod(mClassName, "getInstance", new Class[0]);
25+
if (method == null) {
26+
return null;
27+
}
28+
Object invoke = SeslBaseReflector.invoke(null, method, new Object[0]);
29+
if (invoke.getClass().getName().equals(mClassName)) {
30+
return invoke;
31+
}
32+
return null;
33+
}
34+
35+
public static String getString(String str, String str2) {
36+
Object obj = null;
37+
if (Build.VERSION.SDK_INT >= 29) {
38+
obj = SeslBaseReflector.invoke(null, SeslBaseReflector.getDeclaredMethod(mClassName, "hidden_getString", String.class, String.class), str, str2);
39+
} else {
40+
Object instance = getInstance();
41+
if (instance != null) {
42+
obj = SeslBaseReflector.invoke(instance, SeslBaseReflector.getMethod(mClassName, "getString", String.class, String.class), str, str2);
43+
}
44+
}
45+
return obj instanceof String ? (String) obj : str2;
46+
}
47+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package androidx.reflect.graphics;
2+
3+
import android.graphics.Paint;
4+
5+
import androidx.reflect.SeslBaseReflector;
6+
7+
import java.lang.reflect.Method;
8+
9+
public class SeslPaintReflector {
10+
public static final Class<?> mClass = Paint.class;
11+
12+
public static float getHCTStrokeWidth(Paint paint) {
13+
Method method = SeslBaseReflector.getMethod(mClass, "getHCTStrokeWidth", new Class[0]);
14+
if (method == null) {
15+
return 0.0f;
16+
}
17+
Object invoke = SeslBaseReflector.invoke(paint, method, new Object[0]);
18+
if (invoke instanceof Float) {
19+
return ((Float) invoke).floatValue();
20+
}
21+
return 0.0f;
22+
}
23+
}

0 commit comments

Comments
 (0)