Skip to content

Commit

Permalink
Lockscreen Clocks - TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed May 5, 2024
1 parent 6b42915 commit 378d913
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package it.dhd.oxygencustomizer.ui.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextClock;

public class HalfTextView extends TextClock {
/* renamed from: A */
public final float f19753A;

/* renamed from: x */
public final Paint f19754x;

/* renamed from: y */
public final Rect f19755y;

/* renamed from: z */
public final boolean f19756z;

public HalfTextView(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0);
this.f19754x = new Paint();
this.f19755y = new Rect();
//TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C0190y.f469O);
this.f19756z = false;//obtainStyledAttributes.getBoolean(1, false);
this.f19753A = 0.0f;//obtainStyledAttributes.getDimension(0, 0.0f);
//obtainStyledAttributes.recycle();
}

@Override
public final void onDraw(Canvas canvas) {
String m5689v = m5689v();
Rect rect = this.f19755y;
int i = rect.left;
int i2 = rect.bottom;
boolean z = this.f19756z;
float f = this.f19753A;
float height = z ? (rect.height() / 2.0f) + f : -f;
rect.offset(-rect.left, -rect.top);
Paint paint = this.f19754x;
paint.setAntiAlias(true);
paint.setDither(true);
paint.setColor(getCurrentTextColor());
paint.setTypeface(getTypeface());
canvas.drawText(m5689v, -i, (rect.bottom - i2) - height, paint);
}

@Override
public final void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
m5689v();
Rect rect = this.f19755y;
setMeasuredDimension(rect.width(), (int) (rect.height() / 2.0f));
}

/* renamed from: v */
public final String m5689v() {
String charSequence = getText().toString();
int length = charSequence.length();
Paint paint = this.f19754x;
paint.setTextSize(getTextSize());
paint.setTypeface(getTypeface());
Rect rect = this.f19755y;
paint.getTextBounds(charSequence, 0, length, rect);
if (length == 0) {
rect.right = rect.left;
}
return charSequence;
}

}
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/half_arc_progress.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M32,4
A 28,28 0 1,1 32,60"
android:strokeWidth="7"
android:strokeAlpha="0.5"
android:strokeColor="@android:color/white"
android:strokeLineCap="round" />
<path
android:pathData="M32,4
A 28,28 0 1,1 32,60"
android:strokeWidth="7"
android:strokeColor="@android:color/system_accent1_300"
android:strokeLineCap="round"/>
</vector>
Binary file added app/src/main/res/font/incopins_clusters.ttf
Binary file not shown.
185 changes: 185 additions & 0 deletions app/src/main/res/layout/preview_lockscreen_clock_99.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|top"
android:gravity="start|top"
android:orientation="horizontal">

<LinearLayout
android:id="@+id/timeLayout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="start"
android:orientation="vertical">

<TextClock
android:id="@+id/textClock2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:format12Hour="hh:mm"
android:format24Hour="HH:mm"
android:textSize="40sp"
android:tag="text1"
android:textColor="#FFFFFF"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:fontFamily="@font/incopins_clusters"/>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="20dp"
android:layout_marginTop="40dp">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<View
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tag="accent1"
android:background="@drawable/circle_shape" />
<TextClock
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format12Hour="dd MMM"
android:format24Hour="dd MMM"
android:textSize="20sp"
android:tag="text2"
android:textColor="#FFFFFF"
android:layout_marginStart="12dp"
android:layout_gravity="center_vertical"/>

</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">

<View
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tag="accent1"
android:background="@drawable/circle_shape" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="35% Volume"
android:textSize="20sp"
android:tag="text2"
android:textColor="#FFFFFF"
android:layout_marginStart="12dp"
android:layout_gravity="center_vertical"/>

</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">

<View
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tag="accent1"
android:background="@drawable/circle_shape" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5.20GB RAM"
android:textSize="20sp"
android:tag="text2"
android:textColor="#FFFFFF"
android:layout_marginStart="12dp"
android:layout_gravity="center_vertical"/>

</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">

<View
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:tag="accent1"
android:background="@drawable/circle_shape" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="50% Battery"
android:textSize="20sp"
android:tag="text2"
android:textColor="#FFFFFF"
android:layout_marginStart="12dp"
android:layout_gravity="center_vertical"/>

</LinearLayout>

</LinearLayout>

</LinearLayout>

<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="2">

<ImageView
android:id="@+id/dateProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arc_progress"
android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="@+id/volumeProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arc_progress"
android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="@+id/ramProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arc_progress"
android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="@+id/batteryProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arc_progress"
android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"/>

</GridLayout>


</LinearLayout>

0 comments on commit 378d913

Please sign in to comment.