Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings #9

Open
wants to merge 3 commits into
base: Pagination(spr4)
Choose a base branch
from
Open

Settings #9

wants to merge 3 commits into from

Conversation

NadezhdaSakal
Copy link
Owner

No description provided.

Comment on lines +27 to +28
val name = "LatestChannel"
val descriptionText = "FilmsSearch notification Channel"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хорошо бы в константы

override fun onReceive(context: Context?, intent: Intent?) {
if (intent == null) return
when (intent.action) {
Intent.ACTION_BATTERY_LOW -> Toast.makeText(context, "Батарея разряжена", Toast.LENGTH_SHORT).show()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Текст для UI нужно хранить в R.string

class SettingsFragment : Fragment() {
private lateinit var binding: FragmentSettingsBinding
private val viewModel by lazy {
ViewModelProvider.NewInstanceFactory().create(SettingsFragmentViewModel::class.java)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Таким образом нет связи с ЖЦ, так можно, но лучше использовать:

private val viewModel: ViewModelClass by lazy { 
        ViewModelProvider(this).get(ViewModelClass::class.java)
    } 


override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
AnimationHelper.performFragmentCircularRevealAnimation(binding.settingsFragmentRoot, requireActivity(), 5)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number🧙‍

val pendingIntent =
PendingIntent.getActivity(context, 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT)

val builder = NotificationCompat.Builder(context!!, NotificationConstants.CHANNEL_ID).apply {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем !! ?

android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:minHeight="60dp"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Размеры в R.dimen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants