From ca52cec700be736960fd5742def20b51e15586de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BC=D1=86=D0=BE=D0=B2=D0=B0=20=D0=9D=D0=B0=D0=B4?= =?UTF-8?q?=D0=B5=D0=B6=D0=B4=D0=B0?= Date: Mon, 28 Apr 2025 19:05:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D1=81=20=D1=82=D0=B0?= =?UTF-8?q?=D0=B9=D0=BC=D0=B5=D1=80=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 + .idea/AndroidProjectSystem.xml | 6 + .idea/compiler.xml | 6 + .idea/deploymentTargetSelector.xml | 10 ++ .idea/gradle.xml | 19 +++ .idea/kotlinc.xml | 6 + .idea/migrations.xml | 10 ++ .idea/misc.xml | 10 ++ .idea/render.experimental.xml | 6 + .idea/runConfigurations.xml | 17 +++ .idea/vcs.xml | 6 + app/src/main/AndroidManifest.xml | 3 + .../java/com/example/timert/MainActivity.kt | 9 ++ app/src/main/java/com/example/timert/timer.kt | 62 ++++++++ app/src/main/res/drawable/blue_gradient.xml | 9 ++ app/src/main/res/drawable/gradient_pink.xml | 9 ++ app/src/main/res/drawable/green_gradient.xml | 9 ++ app/src/main/res/drawable/icon_pause.xml | 10 ++ app/src/main/res/drawable/icon_play.xml | 10 ++ app/src/main/res/drawable/icon_stop.xml | 10 ++ app/src/main/res/drawable/pink_gradient.xml | 9 ++ app/src/main/res/layout/activity_main.xml | 22 +-- app/src/main/res/layout/activity_timer.xml | 137 ++++++++++++++++++ app/src/main/res/values/colors.xml | 10 ++ 24 files changed, 399 insertions(+), 9 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/AndroidProjectSystem.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/deploymentTargetSelector.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/kotlinc.xml create mode 100644 .idea/migrations.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/render.experimental.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/vcs.xml create mode 100644 app/src/main/java/com/example/timert/timer.kt create mode 100644 app/src/main/res/drawable/blue_gradient.xml create mode 100644 app/src/main/res/drawable/gradient_pink.xml create mode 100644 app/src/main/res/drawable/green_gradient.xml create mode 100644 app/src/main/res/drawable/icon_pause.xml create mode 100644 app/src/main/res/drawable/icon_play.xml create mode 100644 app/src/main/res/drawable/icon_stop.xml create mode 100644 app/src/main/res/drawable/pink_gradient.xml create mode 100644 app/src/main/res/layout/activity_timer.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b86273d --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..639c779 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..c224ad5 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..74dd639 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml new file mode 100644 index 0000000..8ec256a --- /dev/null +++ b/.idea/render.experimental.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1fbfd72..94a7c18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -12,6 +12,9 @@ android:supportsRtl="true" android:theme="@style/Theme.TimerT" tools:targetApi="31"> + diff --git a/app/src/main/java/com/example/timert/MainActivity.kt b/app/src/main/java/com/example/timert/MainActivity.kt index 5de3e5b..64aa7df 100644 --- a/app/src/main/java/com/example/timert/MainActivity.kt +++ b/app/src/main/java/com/example/timert/MainActivity.kt @@ -1,6 +1,8 @@ package com.example.timert +import android.content.Intent import android.os.Bundle +import android.widget.Button import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat @@ -16,5 +18,12 @@ class MainActivity : AppCompatActivity() { v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) insets } + var button: Button = findViewById(R.id.button2) + + button.setOnClickListener{ + val intent = Intent(this,timer::class.java) + startActivity(intent) + } } + } \ No newline at end of file diff --git a/app/src/main/java/com/example/timert/timer.kt b/app/src/main/java/com/example/timert/timer.kt new file mode 100644 index 0000000..b056dd2 --- /dev/null +++ b/app/src/main/java/com/example/timert/timer.kt @@ -0,0 +1,62 @@ +package com.example.timert + +import android.app.AlertDialog +import android.content.Intent +import android.media.Image +import android.os.Bundle +import android.widget.Button +import android.widget.ImageButton +import androidx.activity.enableEdgeToEdge +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowInsetsCompat + +class timer : AppCompatActivity() { + private var isPlay = false + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContentView(R.layout.activity_timer) + ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> + val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) + insets + } + val button: ImageButton = findViewById(R.id.stop) + button.setOnClickListener { + AlertDialog.Builder(this) + .setTitle("Сброс таймера") + .setMessage("Закрыть таймер и перейти на главную страницу?") + .setPositiveButton("Да") { _, _ -> + + val intent = Intent(this, MainActivity::class.java) + startActivity(intent) + } + .setNegativeButton("Нет") { dialog, _ -> + dialog.dismiss() + } + .show() + } + + + + val pauseButton: ImageButton = findViewById(R.id.play) + + pauseButton.setOnClickListener { + if (isPlay) { + + pauseButton.setImageResource(R.drawable.icon_play) + // здесь ещё можно возобновить таймер + } else { + + pauseButton.setImageResource(R.drawable.icon_pause) + // здесь можно остановить таймер + } + isPlay = !isPlay + } + + + + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/blue_gradient.xml b/app/src/main/res/drawable/blue_gradient.xml new file mode 100644 index 0000000..c8a862e --- /dev/null +++ b/app/src/main/res/drawable/blue_gradient.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/gradient_pink.xml b/app/src/main/res/drawable/gradient_pink.xml new file mode 100644 index 0000000..a037506 --- /dev/null +++ b/app/src/main/res/drawable/gradient_pink.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/green_gradient.xml b/app/src/main/res/drawable/green_gradient.xml new file mode 100644 index 0000000..692f367 --- /dev/null +++ b/app/src/main/res/drawable/green_gradient.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_pause.xml b/app/src/main/res/drawable/icon_pause.xml new file mode 100644 index 0000000..57477a9 --- /dev/null +++ b/app/src/main/res/drawable/icon_pause.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_play.xml b/app/src/main/res/drawable/icon_play.xml new file mode 100644 index 0000000..13c137a --- /dev/null +++ b/app/src/main/res/drawable/icon_play.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/icon_stop.xml b/app/src/main/res/drawable/icon_stop.xml new file mode 100644 index 0000000..34bd28f --- /dev/null +++ b/app/src/main/res/drawable/icon_stop.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/pink_gradient.xml b/app/src/main/res/drawable/pink_gradient.xml new file mode 100644 index 0000000..a037506 --- /dev/null +++ b/app/src/main/res/drawable/pink_gradient.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 86a5d97..667c9ae 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,13 +7,17 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - + + +