File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 55import android .view .ViewGroup ;
66import androidx .annotation .NonNull ;
77import androidx .recyclerview .widget .RecyclerView ;
8+
9+ import java .util .ArrayList ;
810import java .util .List ;
911import it .ezzie .smartalarm .Entity .AlarmEntity ;
1012import it .ezzie .smartalarm .databinding .AdapterAlarmBinding ;
1113
1214public class AlarmAdapter extends RecyclerView .Adapter <AlarmAdapter .AlarmViewHolder > {
1315 private Context context ;
1416 private List <AlarmEntity > alarmList ;
17+
1518 public AlarmAdapter (Context context , List <AlarmEntity > alarmList ){
1619 this .context = context ;
1720 this .alarmList = alarmList ;
1821 }
19-
2022
2123 public class AlarmViewHolder extends RecyclerView .ViewHolder {
2224 private AdapterAlarmBinding binding ;
@@ -45,5 +47,4 @@ public int getItemCount() {
4547 return alarmList .size ();
4648 }
4749
48-
4950}
Original file line number Diff line number Diff line change @@ -28,15 +28,15 @@ protected void onCreate(Bundle savedInstanceState) {
2828 EdgeToEdge .enable (this );
2929 binding = ActivityMainBinding .inflate (getLayoutInflater ());
3030 setContentView (binding .getRoot ());
31- initUI ();
3231 initDatabase ();
32+ initUI ();
3333 }
3434
3535 private void initDatabase () {
3636 var db = AppDatabase .getInstance (this );
3737 alarmDAO = db .alarmDAO ();
3838 alarmDAO .createAlarm (new AlarmEntity ("4:00" ,"Wake UP" ));
39- // alarmList = alarmDAO.getAllAlarms();
39+ alarmList = alarmDAO .getAllAlarms ();
4040 }
4141 private void initUI (){
4242 alarmAdapter = new AlarmAdapter (this ,alarmList );
Original file line number Diff line number Diff line change 22<shape xmlns : android =" http://schemas.android.com/apk/res/android"
33 android : shape =" rectangle" >
44 <solid android : color =" @color/white" />
5- <corners android : bottomLeftRadius =" 30dp " android : bottomRightRadius =" 30dp" />
5+ <corners android : bottomLeftRadius =" 20dp " android : bottomRightRadius =" 30dp" />
66
77</shape >
You can’t perform that action at this time.
0 commit comments