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

Commit b12434b

Browse files
authored
app: OneUI 4 Dialogs (#76)
Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com>
1 parent 80841b4 commit b12434b

File tree

56 files changed

+1496
-1406
lines changed

Some content is hidden

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

56 files changed

+1496
-1406
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package androidx.reflect.widget;
2+
3+
import android.os.Build;
4+
import android.widget.AdapterView;
5+
6+
import androidx.reflect.SeslBaseReflector;
7+
8+
import java.lang.reflect.Field;
9+
import java.lang.reflect.Method;
10+
11+
public class SeslAdapterViewReflector {
12+
private static final Class<?> mClass = AdapterView.class;
13+
14+
private SeslAdapterViewReflector() {
15+
}
16+
17+
public static void semSetBottomColor(AdapterView adapterView, int i) {
18+
String str;
19+
if (Build.VERSION.SDK_INT >= 29) {
20+
str = "hidden_semSetBottomColor";
21+
} else {
22+
str = Build.VERSION.SDK_INT >= 28 ? "semSetBottomColor" : null;
23+
}
24+
Method declaredMethod = SeslBaseReflector.getDeclaredMethod(mClass, str, Integer.TYPE);
25+
if (declaredMethod != null) {
26+
SeslBaseReflector.invoke(adapterView, declaredMethod, Integer.valueOf(i));
27+
}
28+
}
29+
30+
public static int getField_mSelectedPosition(AdapterView adapterView) {
31+
Field declaredField = SeslBaseReflector.getDeclaredField(mClass, "mSelectedPosition");
32+
if (declaredField == null) {
33+
return -1;
34+
}
35+
Object obj = SeslBaseReflector.get(adapterView, declaredField);
36+
if (obj instanceof Integer) {
37+
return ((Integer) obj).intValue();
38+
}
39+
return -1;
40+
}
41+
}

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
import androidx.annotation.Nullable;
2323
import androidx.annotation.StringRes;
2424
import androidx.annotation.StyleRes;
25+
import androidx.appcompat.R;
2526
import androidx.appcompat.app.AppCompatDialog;
2627

27-
import de.dlyt.yanndroid.oneui.R;
2828
import de.dlyt.yanndroid.oneui.sesl.dialog.SamsungAlertController;
2929

3030
public class AlertDialog extends AppCompatDialog implements DialogInterface {
31-
static final int LAYOUT_HINT_NONE = 0;
32-
static final int LAYOUT_HINT_SIDE = 1;
31+
public static final int LAYOUT_HINT_NONE = 0;
32+
public static final int LAYOUT_HINT_SIDE = 1;
3333
final SamsungAlertController mAlert;
3434

3535
protected AlertDialog(@NonNull Context context) {
@@ -48,8 +48,7 @@ protected AlertDialog(@NonNull Context context, boolean cancelable, @Nullable On
4848
}
4949

5050
static int resolveDialogTheme(@NonNull Context context, @StyleRes int resid) {
51-
// Check to see if this resourceId has a valid package ID.
52-
if (((resid >>> 24) & 0x000000ff) >= 0x00000001) { // start of real resource IDs.
51+
if (((resid >>> 24) & 0x000000ff) >= 0x00000001) {
5352
return resid;
5453
} else {
5554
TypedValue outValue = new TypedValue();
@@ -101,7 +100,7 @@ public void setButton(int whichButton, CharSequence text, OnClickListener listen
101100
}
102101

103102
public void setButton(int whichButton, CharSequence text, Drawable icon, OnClickListener listener) {
104-
mAlert.setButton(whichButton, text, listener, null, icon);
103+
mAlert.setButton(whichButton, text, listener, null, icon);
105104
}
106105

107106
public void setIcon(int resId) {
@@ -296,15 +295,17 @@ public Builder setCursor(final Cursor cursor, final OnClickListener listener, St
296295
return this;
297296
}
298297

299-
public Builder setMultiChoiceItems(@ArrayRes int itemsId, boolean[] checkedItems, final OnMultiChoiceClickListener listener) {
298+
public Builder setMultiChoiceItems(@ArrayRes int itemsId, boolean[] checkedItems,
299+
final OnMultiChoiceClickListener listener) {
300300
P.mItems = P.mContext.getResources().getTextArray(itemsId);
301301
P.mOnCheckboxClickListener = listener;
302302
P.mCheckedItems = checkedItems;
303303
P.mIsMultiChoice = true;
304304
return this;
305305
}
306306

307-
public Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, final OnMultiChoiceClickListener listener) {
307+
public Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems,
308+
final OnMultiChoiceClickListener listener) {
308309
P.mItems = items;
309310
P.mOnCheckboxClickListener = listener;
310311
P.mCheckedItems = checkedItems;
@@ -396,11 +397,8 @@ public Builder setRecycleOnMeasureEnabled(boolean enabled) {
396397
return this;
397398
}
398399

399-
400400
@NonNull
401401
public AlertDialog create() {
402-
// We can't use Dialog's 3-arg constructor with the createThemeContextWrapper param,
403-
// so we always have to re-set the theme
404402
final AlertDialog dialog = new AlertDialog(P.mContext, mTheme);
405403
P.apply(dialog.mAlert);
406404
dialog.setCancelable(P.mCancelable);
@@ -422,4 +420,4 @@ public AlertDialog show() {
422420
}
423421
}
424422

425-
}
423+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private void initView() {
385385
frameLayout.addView(this.mPickerLayout, new ViewGroup.LayoutParams(getPickerLayoutWidth(), -2));
386386
this.cancelTextView = this.mParentLayout.findViewById(R.id.color_picker_button_cancel);
387387
this.doneTextView = this.mParentLayout.findViewById(R.id.color_picker_button_done);
388-
SpenSettingUtilText.applyUpToLargeLevel(this.mContext, 16.0f, this.cancelTextView, this.doneTextView);
388+
SpenSettingUtilText.applyUpToLargeLevel(this.mContext, mIsOneUI4 ? 18.0f : 16.0f, this.cancelTextView, this.doneTextView);
389389
SpenShowButtonShapeText spenShowButtonShapeText = this.cancelTextView;
390390
spenShowButtonShapeText.setContentDescription(this.mContext.getResources().getString(R.string.sesl_cancel) + " " + this.mContext.getResources().getString(R.string.sesl_button));
391391
SpenShowButtonShapeText spenShowButtonShapeText2 = this.doneTextView;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void handleMessage(Message msg) {
130130
mProgressPercent = (TextView) view.findViewById(R.id.progress_percent);
131131
setView(view);
132132
} else {
133-
View view = inflater.inflate(a.getResourceId(R.styleable.SamsungAlertDialog_progressLayout, R.layout.sesl_progress_dialog_circle), null);
133+
View view = inflater.inflate(a.getResourceId(R.styleable.SamsungAlertDialog_progressLayout, mIsOneUI4 ? R.layout.sesl4_progress_dialog_circle : R.layout.sesl_progress_dialog_circle), null);
134134
mProgress = (ProgressBar) view.findViewById(R.id.progress);
135135
mMessageView = (TextView) view.findViewById(R.id.message);
136136
setView(view);

0 commit comments

Comments
 (0)