@@ -41,7 +41,6 @@ protected void onCreate(Bundle savedInstanceState) {
4141 setContentView (binding .getRoot ());
4242 initDatabase ();
4343 initUI ();
44- // initDialog();
4544 initListener ();
4645 }
4746
@@ -66,47 +65,9 @@ private void initUI(){
6665 binding .recyclerView .setAdapter (alarmAdapter );
6766 binding .recyclerView .setLayoutManager (new LinearLayoutManager (this ));
6867 }
69- // private void initDialog(){
70- // //Floating Btn
71- // var dialogBinding = ActivityEditAlarmBinding.inflate(getLayoutInflater());
72- // binding.floatingBtn.setOnClickListener(v -> {
73- // AlertDialog.Builder builder = new AlertDialog.Builder(this);
74- // alertDialog = builder.setView(dialogBinding.getRoot())
75- // .setCancelable(false)
76- // .create();
77- // alertDialog.setOnShowListener(dialog -> {
78- // alertDialog.getWindow().setBackgroundDrawableResource(R.drawable.bg_dialog);
79- // });
80- // alertDialog.show();
81- // });
82- //
83- // dialogBinding.timePicker.setOnTimeChangedListener((view, hourOfDay, minute) -> {
84- // calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);
85- // calendar.set(Calendar.MINUTE,minute);
86- //
87- // int currentHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
88- // int currentMinute = Calendar.getInstance().get(Calendar.MINUTE);
89- // int totalCurrentMinute = currentHour * 60 + currentMinute;
90- // int totalSelectedMinute = hourOfDay * 60 + minute;
91- // int totalResultMinute = totalSelectedMinute - totalCurrentMinute;
92- // int resultHour = totalResultMinute / 60;
93- // int resultMinute = totalResultMinute % 60;
94- // if(totalResultMinute < 0){
95- // resultHour = -resultHour;
96- // resultMinute = -resultMinute;
97- // }
98- // dialogBinding.hour.setText(String.valueOf(resultHour));
99- // dialogBinding.minute.setText(String.format("%02d",resultMinute));
100- // });
101- //
102- // }
103- // private void initListener(){
104- // dialogBinding.btnCancel.setOnClickListener(v -> {
105- // alertDialog.cancel();
106- // });
107- // }
10868 private void initListener (){
10969 binding .floatingBtn .setOnClickListener (v -> {
70+ refreshView ();
11071 Intent intent = new Intent (this , EditAlarm .class );
11172 startActivityForResult (intent ,CREATE_REQUEST_CODE );
11273 });
0 commit comments