This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Ref, useCallback, useLayoutEffect, useMemo, useRef } from 'react' | |
import { FlatList, StyleSheet, View, type ViewToken } from 'react-native' | |
import { useLayout } from '@react-native-community/hooks' | |
import Label from 'components/atoms/Label' | |
import DateView, { ITEM_WIDTH } from 'components/molecules/DateView' | |
import { type DateWithName } from 'components/organisms/SelectIntervalModal' | |
const ITEM_INTER = 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useMemo } from 'react' | |
import { Text } from 'react-native' | |
type LabelProps = { | |
children: string | number, | |
size: 'small' | 'normal' | 'medium' | 'large' | 'xlarge' | 'xxlarge', | |
weight: 'light' | 'regular' | 'medium' | 'bold', | |
color: 'primary' | 'secondary' | 'disabled', | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Alert } from 'react-native' | |
import notifee, { | |
TriggerType, | |
RepeatFrequency, | |
AuthorizationStatus, | |
EventType, | |
type TimestampTrigger, | |
type Notification, | |
type Event, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity(R.layout.activity_main), | |
MainCallbackAdapter, OnInterceptTouchEventListener, OnRowMoveListener { | |
private val viewModel by viewModels<MainViewModel>() | |
private val controller = MainController(this) | |
private var touchHelper: ItemTouchHelper? = null | |
private var touchedPosition = -1 | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainSimpleOnItemTouchListener( | |
private val listener: OnInterceptTouchEventListener | |
) : RecyclerView.SimpleOnItemTouchListener() { | |
interface OnInterceptTouchEventListener { | |
fun onInterceptTouchEvent(touchedPosition: Int) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainEpoxyTouchCallback( | |
controller: MainController, | |
private val listener: OnRowMoveListener | |
) : EpoxyModelTouchCallback<RowEpoxyModel>(controller, RowEpoxyModel::class.java) { | |
interface OnRowMoveListener { | |
fun onMoved(movingRowId: String, shiftingRowId: String) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainController( | |
private val callbackAdapter: MainCallbackAdapter | |
) : EpoxyController() { | |
private var firstRows = emptyList<Row>() | |
private var secondRows = emptyList<Row>() | |
override fun buildModels() { | |
header { | |
id("header", "1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface MainCallbackAdapter { | |
fun onDragStart() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EpoxyModelClass(layout = R.layout.item_model_row) | |
abstract class RowEpoxyModel : EpoxyModelWithHolder<RowViewHolder>() { | |
@EpoxyAttribute lateinit var rowId: String | |
@EpoxyAttribute lateinit var title: String | |
@EpoxyAttribute(DoNotHash) var onDragHandleTouchListener: OnTouchListener? = null | |
@SuppressLint("ClickableViewAccessibility") | |
override fun bind(holder: RowViewHolder) { | |
with(holder) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EpoxyModelClass(layout = R.layout.item_model_header) | |
abstract class HeaderEpoxyModel : EpoxyModelWithHolder<HeaderViewHolder>() { | |
@EpoxyAttribute @StringRes var titleRes = 0 | |
override fun bind(holder: HeaderViewHolder) { | |
holder.tvTitle.setText(titleRes) | |
} | |
class HeaderViewHolder : KotlinEpoxyHolder() { |
NewerOlder