Уроки по Kotlin Android Studio

Weather app #7 – ViewPager, TabLayout

MainFragment import android.Manifestimport android.os.Bundleimport androidx.fragment.app.Fragmentimport android.view.LayoutInflaterimport android.view.Viewimport android.view.ViewGroupimport android.widget.Toastimport androidx.activity.result.ActivityResultLauncherimport androidx.activity.result.contract.ActivityResultContractsimport androidx.fragment.app.FragmentActivityimport com.google.android.material.tabs.TabLayoutMediatorimport com.meter_alc_rgb.weatherappcursey.Rimport com.meter_alc_rgb.weatherappcursey.adapters.VpAdapterimport com.meter_alc_rgb.weatherappcursey.databinding.FragmentMainBindingclass MainFragment : Fragment() { private val fList = listOf(… Подробнее »Weather app #7 – ViewPager, TabLayout

Weather App #6

fragment_main.xml <?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.MainFragment"> <ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.5" android:scaleType="fitXY" android:src="@drawable/weather_bg" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <androidx.cardview.widget.CardView android:id="@+id/cardView" android:layout_width="match_parent"… Подробнее »Weather App #6

Weather App #5 – Fine location permission

https://youtu.be/46sUJmPqhR4 MainFragment import android.Manifestimport android.os.Bundleimport androidx.fragment.app.Fragmentimport android.view.LayoutInflaterimport android.view.Viewimport android.view.ViewGroupimport android.widget.Toastimport androidx.activity.result.ActivityResultLauncherimport androidx.activity.result.contract.ActivityResultContractsimport com.meter_alc_rgb.weatherappcursey.Rimport com.meter_alc_rgb.weatherappcursey.databinding.FragmentMainBindingclass MainFragment : Fragment() { private lateinit var pLauncher: ActivityResultLauncher<String> private lateinit… Подробнее »Weather App #5 – Fine location permission

Weather App Jetpack Compose #2

Разрешение в манифесте Добавить разрешение в файл AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET"/> Зависимость Coil Добавить зависимость в файл build.gradle (Module) implementation("io.coil-kt:coil-compose:2.0.0-rc01") MainActivity import android.os.Bundleimport androidx.activity.ComponentActivityimport androidx.activity.compose.setContentimport androidx.compose.foundation.layout.fillMaxSizeimport… Подробнее »Weather App Jetpack Compose #2

WeatherApp #2 – MainFragment, ViewBinding

MainActivity.kt import androidx.appcompat.app.AppCompatActivityimport android.os.Bundleimport com.meter_alc_rgb.weatherappcursey.fragments.MainFragmentclass MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) supportFragmentManager .beginTransaction() .replace(R.id.placeHolder, MainFragment.newInstance()) .commit() }} MainFragment.kt import android.os.Bundleimport… Подробнее »WeatherApp #2 – MainFragment, ViewBinding

Weather App Jetpack Compose #1

MainActivity import android.content.Contextimport android.os.Bundleimport android.util.Logimport androidx.activity.ComponentActivityimport androidx.activity.compose.setContentimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.*import androidx.compose.material.Buttonimport androidx.compose.material.MaterialThemeimport androidx.compose.material.Surfaceimport androidx.compose.material.Textimport androidx.compose.runtime.Composableimport androidx.compose.runtime.MutableStateimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.tooling.preview.Previewimport androidx.compose.ui.unit.dpimport com.android.volley.Requestimport com.android.volley.toolbox.StringRequestimport com.android.volley.toolbox.Volleyimport… Подробнее »Weather App Jetpack Compose #1

Weather app #1

Разрешение в AndroidManifest <uses-permission android:name="android.permission.INTERNET"/> Зависимость Volley для build.gradle implementation 'com.android.volley:volley:1.2.1' MainActivity import androidx.appcompat.app.AppCompatActivityimport android.os.Bundleimport android.util.Logimport com.android.volley.Requestimport com.android.volley.toolbox.StringRequestimport com.android.volley.toolbox.Volleyimport com.meter_alc_rgb.wetherapp2.databinding.ActivityMainBindingimport org.json.JSONObjectconst val API_KEY = "297ffc1c3e944aefaaf93152221705"class… Подробнее »Weather app #1

CountDownTimer

MainActivity import androidx.appcompat.app.AppCompatActivityimport android.os.Bundleimport android.os.CountDownTimerimport com.qrvvacuna_desarrollo_qrv.countdowntimer.databinding.ActivityMainBindingclass MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding private var timer: CountDownTimer? = null override fun onCreate(savedInstanceState: Bundle?)… Подробнее »CountDownTimer