Skip to content

Commit

Permalink
Fix AOD Clock 14.
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Oct 11, 2024
1 parent 8f8666c commit 2c094b0
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ public static final class SoundPrefs {

// Resource names
public static final String LOCKSCREEN_CLOCK_LAYOUT = "preview_lockscreen_clock_";
public static final String AOD_CLOCK_LAYOUT = "preview_aod_clock_";
public static final String HEADER_CLOCK_LAYOUT = "preview_header_clock_";

public static final String CLOCK_TAG = "clock";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static de.robv.android.xposed.XposedBridge.hookAllMethods;
import static de.robv.android.xposed.XposedHelpers.findClass;
import static de.robv.android.xposed.XposedHelpers.getObjectField;
import static it.dhd.oxygencustomizer.utils.Constants.AOD_CLOCK_LAYOUT;
import static it.dhd.oxygencustomizer.utils.Constants.LOCKSCREEN_CLOCK_LAYOUT;
import static it.dhd.oxygencustomizer.utils.Constants.Preferences.AodClock.AOD_CLOCK_COLOR_CODE_ACCENT1;
import static it.dhd.oxygencustomizer.utils.Constants.Preferences.AodClock.AOD_CLOCK_COLOR_CODE_ACCENT2;
Expand Down Expand Up @@ -325,16 +326,24 @@ private View getClockView() {
if (appContext == null) return null;
LayoutInflater inflater = LayoutInflater.from(appContext);

View v = inflater.inflate(
appContext
.getResources()
.getIdentifier(
LOCKSCREEN_CLOCK_LAYOUT + mAodClockStyle,
"layout",
BuildConfig.APPLICATION_ID
),
null
);
int resId = appContext
.getResources()
.getIdentifier(
AOD_CLOCK_LAYOUT + mAodClockStyle,
"layout",
BuildConfig.APPLICATION_ID
);
if (resId == 0) {
resId = appContext
.getResources()
.getIdentifier(
LOCKSCREEN_CLOCK_LAYOUT + mAodClockStyle,
"layout",
BuildConfig.APPLICATION_ID
);
}

View v = inflater.inflate(resId, null);

loadLottieAnimationView(
appContext,
Expand Down
79 changes: 79 additions & 0 deletions app/src/main/res/layout/preview_aod_clock_14.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">

<!-- Overlapping Text Modules -->
<LinearLayout
android:id="@+id/overlap_layer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="24dp"
android:foregroundGravity="center"
android:orientation="vertical">

<!-- Text for Date -->
<TextClock
android:id="@+id/text_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="@font/br_sc"
android:format12Hour="dd"
android:format24Hour="dd"
android:tag="text1|nolineheight"
android:textColor="@android:color/white"
android:textSize="200sp" />

<!-- Text for Day -->
<TextClock
android:id="@+id/text_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-120dp"
android:fontFamily="@font/fontsfree_net_carthart"
android:format12Hour="EEE"
android:format24Hour="EEE"
android:gravity="center"
android:tag="accent1|nolineheight"
android:textColor="@android:color/system_accent1_400"
android:textSize="140sp" />

<!-- Stack Layer for Time and Separator -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="-10dp"
android:orientation="vertical">

<!-- Text for Time -->
<TextClock
android:id="@+id/text_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="8dp"
android:fontFamily="@font/sans_bold"
android:format12Hour="hh:mm a"
android:format24Hour="HH:mm"
android:tag="text1"
android:textAllCaps="true"
android:textColor="@android:color/white"
android:textSize="27sp"
android:textStyle="bold" />

<!-- Shape for Separator -->
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:background="@android:color/system_accent1_400"
android:tag="accent1" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

0 comments on commit 2c094b0

Please sign in to comment.