This file contains hidden or 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
FATAL EXCEPTION: main | |
Process: com.playlistmaker, PID: 23451 | |
java.lang.RuntimeException: Unable to pause activity {com.playlistmaker/com.playlistmaker.presentation.ui.activities.ActivityPlayerB}: java.lang.IllegalStateException: LifecycleOwner com.playlistmaker.presentation.ui.activities.ActivityPlayerB@c926e1e is attempting to register while current state is STARTED. LifecycleOwners must call register before they are STARTED. | |
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5779) | |
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5730) | |
This file contains hidden or 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
package com.oleg.servicetestapp | |
import android.app.Notification | |
import android.app.NotificationChannel | |
import android.app.NotificationManager | |
import android.app.Service | |
import android.content.Context | |
import android.content.Intent | |
import android.media.MediaPlayer | |
import android.os.Build |
This file contains hidden or 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
E loadDistrictList 40 | |
2023-11-08 12:17:28.455 5676-5676 LOG ru.practicum.android.diploma E screen loading 40 | |
2023-11-08 12:17:28.460 5676-5767 OkHttp ru.practicum.android.diploma D --> GET https://api.hh.ru/areas/40 | |
2023-11-08 12:17:28.460 5676-5767 OkHttp ru.practicum.android.diploma D Authorization: Bearer | |
2023-11-08 12:17:28.461 5676-5767 OkHttp ru.practicum.android.diploma D HH-User-Agent: JobPulse/1.0(yep4yep@gmail.com) | |
2023-11-08 12:17:28.461 5676-5767 OkHttp ru.practicum.android.diploma D --> END GET | |
2023-11-08 12:17:28.475 5676-5676 AutofillManager ru.practicum.android.diploma D notifyViewEnteredForFillDialog:1073741864 | |
2023-11-08 12:17:28.482 5676-5705 EGL_emulation ru.practicum.android.diploma D app_time_stats: avg=483.90ms min=9.45ms max=3295.83ms count=7 | |
2023-11-08 12:17:28.497 5676-5767 OkHttp r |
This file contains hidden or 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
// У нас есть один seald класс ответ от сервака | |
sealed class DataStatus<out T>(val code: Int = DEFAULT_NETWORK_RESPONSE, val data: T? = null) { | |
class Loading() : DataStatus<Nothing>() | |
class Content<T>(networkData: T) : DataStatus<T>(data = networkData) | |
class Error(newResponseCode: Int) : DataStatus<Nothing>(code = newResponseCode) | |
} | |
// и есть seald класс уже для отображения инфы | |
sealed class DistrictScreenState { | |
data class ContentCountry(val data: List<Country>): DistrictScreenState() |
This file contains hidden or 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
package ru.practicum.android.diploma | |
import android.content.Context | |
import android.os.Bundle | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.activity.OnBackPressedCallback | |
import androidx.fragment.app.Fragment | |
import androidx.viewbinding.ViewBinding |
This file contains hidden or 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
fun <T> debounce(delayMillis: Long, | |
coroutineScope: CoroutineScope, | |
useLastParam: Boolean, | |
action: (T) -> Unit): (T) -> Unit { | |
var debounceJob: Job? = null | |
return { param: T -> | |
if (useLastParam) { | |
debounceJob?.cancel() | |
} | |
if (debounceJob?.isCompleted != false || useLastParam) { |
This file contains hidden or 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
fun preparePlayer(songUrl: String) { | |
// Если в songUrl передана всякая фигня или например пустая строка | |
// Первый catch отрабатывает нормально | |
try { | |
mediaPlayer.setDataSource(songUrl) | |
} catch (e: IOException) { | |
Toast.makeText(App.instance,"${e.message}",Toast.LENGTH_SHORT).show() | |
} |
This file contains hidden or 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
// Как загрузить изображение сразу в кнопку materialButton ?? | |
// ПРомежуточный image для передачи в конпку | |
val drawableImage = ImageView(binding.root.context) | |
// Здесь гружу изображение в промежуточный ImageView | |
Glide.with(binding.root.context) | |
.load(iconString) | |
.placeholder(R.drawable.search_off_opsz48) | |
.centerCrop() | |
.into(drawableImage) |
This file contains hidden or 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
private val layOutHiddenInfo: LinearLayout = item.findViewById(R.id.hidden_weather_info) | |
val cardView = findViewById<CardView>(R.id.card_view) | |
private fun expand(){ | |
TransitionManager.beginDelayedTransition(card, TransitionSet().apply { | |
addTransition(ChangeBounds()) | |
addTransition(Fade()) | |
duration=500 | |
}) |
This file contains hidden or 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 Gismeteo { | |
val baseUrl = "https://api.gismeteo.net/" | |
val token = "56b30cb255.3443075" | |
lateinit var retrofit: Retrofit | |
fun start() { | |
retrofit = | |
Retrofit.Builder() | |
.baseUrl(baseUrl) |
NewerOlder