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

footerの実装 #43

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
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 android.widget.ListView
import kotlinx.android.synthetic.main.activity_shoppinglist.*

Expand Down Expand Up @@ -31,7 +33,38 @@ class ShoppingListActivity : AppCompatActivity(), FragmentCallInterface{
// val intent = Intent(application, FoodAdditionActivity::class.java)
startActivity(intent)
}
//footerの実装
shoppingListTabLayout.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
var position = shoppingListTabLayout.selectedTabPosition
when (position) {
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)
}
}
}

override fun onTabUnselected(tab: TabLayout.Tab) {}

override fun onTabReselected(tab: TabLayout.Tab) {
var position = shoppingListTabLayout.selectedTabPosition
when (position) {
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)
}
}
}
})
//listにテストデータを追加
ListView = findViewById(R.id.shoppingListView)

Expand Down