mirror of
https://github.com/FossifyOrg/Clock.git
synced 2026-06-11 15:58:57 -04:00
Added placeholders for alarms and timers (#124)
This commit is contained in:
@@ -19,6 +19,7 @@ import org.fossify.clock.helpers.TOMORROW_BIT
|
||||
import org.fossify.clock.helpers.getCurrentDayMinutes
|
||||
import org.fossify.clock.interfaces.ToggleAlarmInterface
|
||||
import org.fossify.clock.models.Alarm
|
||||
import org.fossify.clock.models.AlarmEvent
|
||||
import org.fossify.commons.adapters.MyRecyclerViewAdapter
|
||||
import org.fossify.commons.dialogs.ConfirmationDialog
|
||||
import org.fossify.commons.extensions.applyColorFilter
|
||||
@@ -29,6 +30,7 @@ import org.fossify.commons.interfaces.ItemMoveCallback
|
||||
import org.fossify.commons.interfaces.ItemTouchHelperContract
|
||||
import org.fossify.commons.interfaces.StartReorderDragListener
|
||||
import org.fossify.commons.views.MyRecyclerView
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class AlarmsAdapter(
|
||||
activity: SimpleActivity,
|
||||
@@ -123,6 +125,7 @@ class AlarmsAdapter(
|
||||
alarms.removeAll(alarmsToRemove)
|
||||
removeSelectedItems(positions)
|
||||
activity.dbHelper.deleteAlarms(alarmsToRemove)
|
||||
EventBus.getDefault().post(AlarmEvent.Refresh)
|
||||
}
|
||||
|
||||
private fun getSelectedItems(): ArrayList<Alarm> {
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.fossify.clock.helpers.getTomorrowBit
|
||||
import org.fossify.clock.interfaces.ToggleAlarmInterface
|
||||
import org.fossify.clock.models.Alarm
|
||||
import org.fossify.clock.models.AlarmEvent
|
||||
import org.fossify.commons.extensions.beVisibleIf
|
||||
import org.fossify.commons.extensions.getProperBackgroundColor
|
||||
import org.fossify.commons.extensions.getProperTextColor
|
||||
import org.fossify.commons.extensions.toast
|
||||
@@ -159,6 +160,7 @@ class AlarmFragment : Fragment(), ToggleAlarmInterface {
|
||||
updateItems(alarms)
|
||||
}
|
||||
}
|
||||
binding.alarmsPlaceholder.beVisibleIf(alarms.isEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.fossify.clock.helpers.DisabledItemChangeAnimator
|
||||
import org.fossify.clock.helpers.SORT_BY_TIMER_DURATION
|
||||
import org.fossify.clock.models.Timer
|
||||
import org.fossify.clock.models.TimerEvent
|
||||
import org.fossify.commons.extensions.beVisibleIf
|
||||
import org.fossify.commons.extensions.getProperBackgroundColor
|
||||
import org.fossify.commons.extensions.getProperTextColor
|
||||
import org.fossify.commons.extensions.hideKeyboard
|
||||
@@ -161,6 +162,7 @@ class TimerFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.timersPlaceholder.beVisibleIf(timers.isEmpty())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,22 @@
|
||||
app:layoutManager="org.fossify.commons.views.MyLinearLayoutManager"
|
||||
tools:listitem="@layout/item_alarm" />
|
||||
|
||||
<org.fossify.commons.views.MyTextView
|
||||
android:id="@+id/alarms_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/small_margin"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_alarms_found"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.fossify.commons.views.MyFloatingActionButton
|
||||
|
||||
@@ -6,19 +6,42 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.fossify.commons.views.MyRecyclerView
|
||||
android:id="@+id/timers_list"
|
||||
<RelativeLayout
|
||||
android:id="@+id/timer_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/fab_list_bottom_padding"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_timer" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.fossify.commons.views.MyRecyclerView
|
||||
android:id="@+id/timers_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="@dimen/fab_list_bottom_padding"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/item_timer" />
|
||||
|
||||
<org.fossify.commons.views.MyTextView
|
||||
android:id="@+id/timers_placeholder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/small_margin"
|
||||
android:alpha="0.8"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:text="@string/no_timers_found"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.fossify.commons.views.MyFloatingActionButton
|
||||
android:id="@+id/timer_add"
|
||||
|
||||
Reference in New Issue
Block a user