From 9c875980d7eeb57967c038f2a1b81ae725742ae5 Mon Sep 17 00:00:00 2001 From: Shinbo-Rina Date: Sun, 12 Jan 2020 06:51:42 +0900 Subject: [PATCH 1/4] =?UTF-8?q?footer=E3=81=AB=E3=82=88=E3=82=8B=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E9=81=B7=E7=A7=BB=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kanazawaapp_2019/ShoppingListActivity.kt | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt index 253ca38..0a97290 100644 --- a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt +++ b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt @@ -3,6 +3,7 @@ package com.example.kanazawaapp_2019 import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import com.google.android.material.tabs.TabLayout import kotlinx.android.synthetic.main.activity_shoppinglist.* class ShoppingListActivity : AppCompatActivity() { @@ -17,5 +18,30 @@ class ShoppingListActivity : AppCompatActivity() { startActivity(intent) } + //footerの実装 + shoppingListTabLayout.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener { + override fun onTabSelected(tab: TabLayout.Tab) { + var position = shoppingListTabLayout.selectedTabPosition + if (position == 0) { + val intent = Intent(application, PreservedFoodsListActivity::class.java) + startActivities(arrayOf(intent)) + }else { + shoppingListView.setSelection(0) + } + } + + override fun onTabUnselected(tab: TabLayout.Tab) {} + + override fun onTabReselected(tab: TabLayout.Tab) { + var position = shoppingListTabLayout.selectedTabPosition + if (position == 0) { + val intent = Intent(application, PreservedFoodsListActivity::class.java) + startActivities(arrayOf(intent)) + }else { + shoppingListView.setSelection(0) + } + } + }) + } } \ No newline at end of file From a66ebe6a78acc9d42924f4ebfcae32fce02231ea Mon Sep 17 00:00:00 2001 From: Shinbo-Rina Date: Tue, 21 Jan 2020 19:16:21 +0900 Subject: [PATCH 2/4] =?UTF-8?q?if=E6=96=87=E3=81=8B=E3=82=89while=E6=96=87?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kanazawaapp_2019/ShoppingListActivity.kt | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt index 0a97290..c99b352 100644 --- a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt +++ b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt @@ -22,11 +22,14 @@ class ShoppingListActivity : AppCompatActivity() { shoppingListTabLayout.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { var position = shoppingListTabLayout.selectedTabPosition - if (position == 0) { - val intent = Intent(application, PreservedFoodsListActivity::class.java) - startActivities(arrayOf(intent)) - }else { - shoppingListView.setSelection(0) + when (position) { + 0 -> { + val intent = Intent(application, PreservedFoodsListActivity::class.java) + startActivities(arrayOf(intent)) + } + else -> { + shoppingListView.setSelection(0) + } } } @@ -34,11 +37,13 @@ class ShoppingListActivity : AppCompatActivity() { override fun onTabReselected(tab: TabLayout.Tab) { var position = shoppingListTabLayout.selectedTabPosition - if (position == 0) { - val intent = Intent(application, PreservedFoodsListActivity::class.java) + when (position) { + 0 -> {val intent = Intent(application, PreservedFoodsListActivity::class.java) startActivities(arrayOf(intent)) - }else { + } + else -> { shoppingListView.setSelection(0) + } } } }) From 6cf9ca85181ba87ffe14be77f5d4cf12c3bef5a8 Mon Sep 17 00:00:00 2001 From: KanaiYuta Date: Sun, 2 Feb 2020 19:26:20 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E9=81=B7=E7=A7=BB=E5=85=88=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/kanazawaapp_2019/ShoppingListActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt index c99b352..6b94921 100644 --- a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt +++ b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt @@ -24,7 +24,7 @@ class ShoppingListActivity : AppCompatActivity() { var position = shoppingListTabLayout.selectedTabPosition when (position) { 0 -> { - val intent = Intent(application, PreservedFoodsListActivity::class.java) + val intent = Intent(application, PreservedFoodListActivity::class.java) startActivities(arrayOf(intent)) } else -> { @@ -38,7 +38,7 @@ class ShoppingListActivity : AppCompatActivity() { override fun onTabReselected(tab: TabLayout.Tab) { var position = shoppingListTabLayout.selectedTabPosition when (position) { - 0 -> {val intent = Intent(application, PreservedFoodsListActivity::class.java) + 0 -> {val intent = Intent(application, PreservedFoodListActivity::class.java) startActivities(arrayOf(intent)) } else -> { From eabcc91fbcdfb87478e48cf7c069587fbe8ad311 Mon Sep 17 00:00:00 2001 From: Shinbo-Rina Date: Thu, 6 Feb 2020 16:39:27 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B2=B7=E3=81=84=E7=89=A9=E3=83=AA?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=8B=E3=82=89=E4=BF=9D=E5=AD=98=E9=A3=9F?= =?UTF-8?q?=E4=B8=80=E8=A6=A7=E3=81=AB=E7=94=BB=E9=9D=A2=E9=81=B7=E7=A7=BB?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AB=E3=82=B9=E3=83=A9?= =?UTF-8?q?=E3=82=A4=E3=83=89=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 12 +++++++----- .../example/kanazawaapp_2019/ShoppingListActivity.kt | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2431601..a1b5399 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,10 +18,7 @@ android:theme="@style/Theme.AppCompat.Light.NoActionBar"> - - - - + @@ -37,7 +34,12 @@ - + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt index c99b352..b240cbc 100644 --- a/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt +++ b/app/src/main/java/com/example/kanazawaapp_2019/ShoppingListActivity.kt @@ -24,8 +24,9 @@ class ShoppingListActivity : AppCompatActivity() { var position = shoppingListTabLayout.selectedTabPosition when (position) { 0 -> { - val intent = Intent(application, PreservedFoodsListActivity::class.java) + val intent = Intent(application, PreservedFoodListActivity::class.java) startActivities(arrayOf(intent)) + overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right) } else -> { shoppingListView.setSelection(0) @@ -38,8 +39,10 @@ class ShoppingListActivity : AppCompatActivity() { override fun onTabReselected(tab: TabLayout.Tab) { var position = shoppingListTabLayout.selectedTabPosition when (position) { - 0 -> {val intent = Intent(application, PreservedFoodsListActivity::class.java) - startActivities(arrayOf(intent)) + 0 -> { + val intent = Intent(application, PreservedFoodListActivity::class.java) + startActivities(arrayOf(intent)) + overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right) } else -> { shoppingListView.setSelection(0)