Skip to content

Commit 09c41d6

Browse files
Smart Alarm
1 parent 59fa1f1 commit 09c41d6

File tree

8 files changed

+102
-16
lines changed

8 files changed

+102
-16
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
tools:targetApi="31">
1515
<activity
1616
android:name=".EditAlarm"
17-
android:exported="false" />
17+
android:exported="true" />
1818
<activity
1919
android:name=".MainActivity"
2020
android:exported="true">

app/src/main/java/it/ezzie/smartalarm/AlarmAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
5454
calendar.set(Calendar.HOUR_OF_DAY,hourOfDay);
5555
calendar.set(Calendar.MINUTE,minute);
5656
var formattedTime = new SimpleDateFormat("HH:mm").format(calendar.getTime());
57-
var formattedUnit = new SimpleDateFormat("aa").format(calendar.getTime());
57+
var formattedUnit = new SimpleDateFormat("a").format(calendar.getTime());
5858
holder.binding.alarmTime.setText(formattedTime);
59-
holder.binding.alarmUnit.setText(formattedUnit);
59+
holder.binding.alarmUnit.setText(formattedUnit.toUpperCase());
6060
}
6161
};
6262
new TimePickerDialog(context,timepick, calendar.get(Calendar.HOUR_OF_DAY),calendar.get(Calendar.MINUTE),false).show();

app/src/main/java/it/ezzie/smartalarm/EditAlarm.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88
import androidx.core.view.ViewCompat;
99
import androidx.core.view.WindowInsetsCompat;
1010

11-
public class EditAlarm extends AppCompatActivity {
11+
import it.ezzie.smartalarm.databinding.ActivityEditAlarmBinding;
1212

13+
public class EditAlarm extends AppCompatActivity {
14+
private ActivityEditAlarmBinding binding;
1315
@Override
1416
protected void onCreate(Bundle savedInstanceState) {
1517
super.onCreate(savedInstanceState);
1618
EdgeToEdge.enable(this);
17-
setContentView(R.layout.activity_edit_alarm);
18-
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
19-
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
20-
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
21-
return insets;
22-
});
19+
binding = ActivityEditAlarmBinding.inflate(getLayoutInflater());
20+
setContentView(binding.getRoot());
21+
2322
}
2423
}

app/src/main/java/it/ezzie/smartalarm/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private void initUI(){
5252
}
5353
private void initListener(){
5454
binding.floatingBtn.setOnClickListener(v -> {
55-
Intent intent = new Intent(this,)
55+
// Intent intent = new Intent(this,)
5656
});
5757
}
5858

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:alpha="0.9" android:height="24dp" android:tint="#2D322C" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
2+
3+
<path android:fillColor="@android:color/white" android:pathData="M12.01,12c0,-3.57 2.2,-6.62 5.31,-7.87 0.89,-0.36 0.75,-1.69 -0.19,-1.9 -1.1,-0.24 -2.27,-0.3 -3.48,-0.14 -4.51,0.6 -8.12,4.31 -8.59,8.83C4.44,16.93 9.13,22 15.01,22c0.73,0 1.43,-0.08 2.12,-0.23 0.95,-0.21 1.1,-1.53 0.2,-1.9 -3.22,-1.29 -5.33,-4.41 -5.32,-7.87z"/>
4+
5+
</vector>

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

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,90 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/main"
6+
android:background="@color/white"
67
android:layout_width="match_parent"
78
android:layout_height="match_parent"
89
tools:context=".EditAlarm">
910

11+
<TextView
12+
android:id="@+id/edittxt"
13+
android:layout_width="wrap_content"
14+
android:layout_height="wrap_content"
15+
app:layout_constraintTop_toTopOf="parent"
16+
app:layout_constraintStart_toStartOf="parent"
17+
app:layout_constraintEnd_toEndOf="parent"
18+
android:text="Select Alarm"
19+
android:fontFamily="@font/mulish_regular"
20+
android:textStyle="bold"
21+
android:textSize="20dp"
22+
android:layout_marginTop="10dp"/>
23+
24+
25+
<LinearLayout
26+
android:id="@+id/linearAlarm"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
app:layout_constraintTop_toBottomOf="@id/edittxt"
30+
android:orientation="horizontal"
31+
android:layout_marginTop="15dp"
32+
android:gravity="center_horizontal">
33+
34+
<TextView
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:text="Your alarm will ring in "
38+
android:fontFamily="@font/mulish_regular"
39+
android:textSize="16dp"/>
40+
41+
<TextView
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:text="9"
45+
android:fontFamily="@font/mulish_regular"
46+
android:textSize="16dp"/>
47+
48+
<TextView
49+
android:layout_width="wrap_content"
50+
android:layout_height="wrap_content"
51+
android:text=" hr "
52+
android:fontFamily="@font/mulish_regular"
53+
android:textSize="16dp"/>
54+
55+
<TextView
56+
android:layout_width="wrap_content"
57+
android:layout_height="wrap_content"
58+
android:text="16"
59+
android:fontFamily="@font/mulish_regular"
60+
android:textSize="16dp"/>
61+
62+
<TextView
63+
android:layout_width="wrap_content"
64+
android:layout_height="wrap_content"
65+
android:text=" min"
66+
android:fontFamily="@font/mulish_regular"
67+
android:textSize="16dp"/>
68+
69+
70+
</LinearLayout>
71+
72+
<TimePicker
73+
android:layout_width="wrap_content"
74+
android:layout_height="wrap_content"
75+
app:layout_constraintTop_toBottomOf="@id/linearAlarm"
76+
android:layout_marginTop="20dp"
77+
android:timePickerMode="spinner"
78+
app:layout_constraintStart_toStartOf="parent"
79+
app:layout_constraintEnd_toEndOf="parent"/>
80+
81+
<LinearLayout
82+
android:layout_width="wrap_content"
83+
android:layout_height="wrap_content">
84+
85+
<com.google.android.material.button.MaterialButton
86+
android:layout_width="wrap_content"
87+
android:layout_height="wrap_content"
88+
89+
</LinearLayout>
90+
91+
1092
</androidx.constraintlayout.widget.ConstraintLayout>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:id="@+id/main"
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
8-
android:background="@color/antiWhite"
8+
android:background="#e6e9e0"
99
tools:context=".MainActivity">
1010

1111
<TextView
@@ -52,7 +52,7 @@
5252
app:layout_constraintBottom_toBottomOf="parent"
5353
app:layout_constraintStart_toStartOf="parent"
5454
app:layout_constraintEnd_toEndOf="parent"
55-
android:backgroundTint="#d5e8cf"
55+
android:backgroundTint="#bbf0b5"
5656
android:src="@drawable/ic_add"
5757
android:layout_marginBottom="50dp"/>
5858

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
app:layout_constraintTop_toTopOf="parent"
14-
app:layout_constraintBottom_toBottomOf="parent"
1514
app:layout_constraintStart_toStartOf="parent"
1615
android:text="01:00"
17-
android:textSize="50dp"
16+
android:textSize="40dp"
1817
android:fontFamily="@font/mulish_regular"
1918
android:gravity="center_vertical"
20-
android:layout_marginStart="40dp"/>
19+
android:layout_marginStart="40dp"
20+
android:layout_marginTop="30dp"/>
2121

2222
<TextView
2323
android:id="@+id/alarmLabel"

0 commit comments

Comments
 (0)