content: package com.pomodoro.application.activity;
  
  import android.content.ComponentName;
  import android.content.pm.PackageManager;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.WindowManager;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import androidx.recyclerview.widget.LinearLayoutManager;
  import androidx.recyclerview.widget.RecyclerView;
  
  import com.bumptech.glide.Glide;
  import com.pomodoro.application.R;
  import com.pomodoro.application.adapter.TaskAdapter;
  import com.pomodoro.application.bottomSheetFragment.CreateTaskBottomSheetFragment;
  import com.pomodoro.application.bottomSheetFragment.ShowCalendarViewBottomSheet;
  import com.pomodoro.application.broadcastReceiver.AlarmBroadcastReceiver;
  import com.pomodoro.application.broadcastReceiver.database.DatabaseClient;
  import com.pomodoro.application.model.Task;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import butterknife.BindView;
  import butterknife.ButterKnife;
  
  public class MainActivity extends BaseActivity implements CreateTaskBottomSheetFragment.setRefreshListener {
      public static int pomodoro=1;
      @BindView(R.id.taskRecycler)
      RecyclerView taskRecycler;
      @BindView(R.id.addTask)
      TextView addTask;
      TaskAdapter taskAdapter;
      List<Task> tasks = new ArrayList<>();
      @BindView(R.id.calendar)
      ImageView calendar;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          ButterKnife.bind(this);
          setUpAdapter();
          getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          ComponentName receiver = new ComponentName(this, AlarmBroadcastReceiver.class);
          PackageManager pm = getPackageManager();
          pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
          Glide.with(getApplicationContext());
  
          addTask.setOnClickListener(view -> {
              CreateTaskBottomSheetFragment createTaskBottomSheetFragment = new CreateTaskBottomSheetFragment();
              createTaskBottomSheetFragment.setTaskId(0, false, this, MainActivity.this);
              createTaskBottomSheetFragment.show(getSupportFragmentManager(), createTaskBottomSheetFragment.getTag());
          });
  
          getSavedTasks();
  
          calendar.setOnClickListener(view -> {
              ShowCalendarViewBottomSheet showCalendarViewBottomSheet = new ShowCalendarViewBottomSheet();
              showCalendarViewBottomSheet.show(getSupportFragmentManager(), showCalendarViewBottomSheet.getTag());
          });
      }
  
      public void setUpAdapter() {
          taskAdapter = new TaskAdapter(this, tasks, this);
          taskRecycler.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
          taskRecycler.setAdapter(taskAdapter);
      }
  
      private void getSavedTasks() {
  
          class GetSavedTasks extends AsyncTask<Void, Void, List<Task>> {
              @Override
              protected List<Task> doInBackground(Void... voids) {
                  tasks = DatabaseClient
                          .getInstance(getApplicationContext())
                          .getAppDatabase()
                          .dataBaseAction()
                          .getAllTasksList();
                  return tasks;
              }
  
              @Override
              protected void onPostExecute(List<Task> tasks) {
                  super.onPostExecute(tasks);
                  setUpAdapter();
              }
          }
  
          GetSavedTasks savedTasks = new GetSavedTasks();
          savedTasks.execute();
      }
  
      @Override
      public void refresh() {
          getSavedTasks();
      }
  }
  