Showing
14 changed files
with
506 additions
and
16 deletions
| ... | @@ -40,6 +40,7 @@ dependencies { | ... | @@ -40,6 +40,7 @@ dependencies { |
| 40 | implementation 'com.google.firebase:firebase-messaging:20.0.0' | 40 | implementation 'com.google.firebase:firebase-messaging:20.0.0' |
| 41 | 41 | ||
| 42 | implementation 'com.google.firebase:firebase-database:17.0.0' | 42 | implementation 'com.google.firebase:firebase-database:17.0.0' |
| 43 | + implementation 'androidx.legacy:legacy-support-v4:1.0.0' | ||
| 43 | testImplementation 'junit:junit:4.12' | 44 | testImplementation 'junit:junit:4.12' |
| 44 | androidTestImplementation 'androidx.test:runner:1.2.0' | 45 | androidTestImplementation 'androidx.test:runner:1.2.0' |
| 45 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | 46 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ... | ... |
| 1 | +package com.example.vip | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.content.Context | ||
| 5 | +import android.content.SharedPreferences | ||
| 6 | +import android.os.Bundle | ||
| 7 | +import androidx.fragment.app.Fragment | ||
| 8 | +import android.view.LayoutInflater | ||
| 9 | +import android.view.View | ||
| 10 | +import android.view.ViewGroup | ||
| 11 | +import android.widget.Toast | ||
| 12 | +import androidx.core.content.ContextCompat | ||
| 13 | +import com.google.firebase.database.DataSnapshot | ||
| 14 | +import com.google.firebase.database.DatabaseError | ||
| 15 | +import com.google.firebase.database.FirebaseDatabase | ||
| 16 | +import com.google.firebase.database.ValueEventListener | ||
| 17 | +import kotlinx.android.synthetic.main.fragment_a.* | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +class AFragment : Fragment() { | ||
| 21 | + | ||
| 22 | + override fun onCreateView( | ||
| 23 | + inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
| 24 | + // Inflate the layout for this fragment | ||
| 25 | + return inflater.inflate(R.layout.fragment_a, container, false) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
| 29 | + super.onActivityCreated(savedInstanceState) | ||
| 30 | + | ||
| 31 | + val policyList = ArrayList<PolicyItem>() | ||
| 32 | + var recomdatabase = FirebaseDatabase.getInstance().reference | ||
| 33 | + | ||
| 34 | + recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : | ||
| 35 | + ValueEventListener { | ||
| 36 | + override fun onCancelled(p0: DatabaseError) { | ||
| 37 | + //Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show() | ||
| 38 | + } | ||
| 39 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
| 40 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 41 | + val memo = memoSnapshot.getValue(MemoItemRecom::class.java) | ||
| 42 | + | ||
| 43 | + policyList.add( | ||
| 44 | + PolicyItem( | ||
| 45 | + ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, | ||
| 46 | + memo!!.Policy, | ||
| 47 | + memo!!.Content, | ||
| 48 | + memo!!.Link, | ||
| 49 | + memo!!.View, | ||
| 50 | + memo!!.Keyword, | ||
| 51 | + memo!!.Date, | ||
| 52 | + memo!!.Review, | ||
| 53 | + memo!!.Score, | ||
| 54 | + memo!!.Category1, | ||
| 55 | + memo!!.Category2, | ||
| 56 | + memo!!.Category3, | ||
| 57 | + memo!!.Category4, | ||
| 58 | + memo!!.Category5, | ||
| 59 | + memo!!.Category6, | ||
| 60 | + memo!!.Category7, | ||
| 61 | + memo!!.Category8, | ||
| 62 | + memo!!.Category9, | ||
| 63 | + memo!!.Category10, | ||
| 64 | + memo!!.Category11, | ||
| 65 | + memo!!.Category12, | ||
| 66 | + memo!!.Category13, | ||
| 67 | + memo!!.Category14, | ||
| 68 | + memo!!.Category15, | ||
| 69 | + memo!!.Category16, | ||
| 70 | + memo!!.Value, | ||
| 71 | + memo!!.D_day | ||
| 72 | + ) | ||
| 73 | + ) | ||
| 74 | + } | ||
| 75 | + val adapter = PolicyAdapter(policyList) | ||
| 76 | + policyRecyclerView.adapter = adapter | ||
| 77 | + } | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +package com.example.vip | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.os.Bundle | ||
| 5 | +import androidx.fragment.app.Fragment | ||
| 6 | +import android.view.LayoutInflater | ||
| 7 | +import android.view.View | ||
| 8 | +import android.view.ViewGroup | ||
| 9 | +import androidx.core.content.ContextCompat | ||
| 10 | +import com.google.firebase.database.DataSnapshot | ||
| 11 | +import com.google.firebase.database.DatabaseError | ||
| 12 | +import com.google.firebase.database.FirebaseDatabase | ||
| 13 | +import com.google.firebase.database.ValueEventListener | ||
| 14 | +import kotlinx.android.synthetic.main.fragment_a.* | ||
| 15 | + | ||
| 16 | +class BFragment : Fragment() { | ||
| 17 | + | ||
| 18 | + override fun onCreateView( | ||
| 19 | + inflater: LayoutInflater, container: ViewGroup?, | ||
| 20 | + savedInstanceState: Bundle? | ||
| 21 | + ): View? { | ||
| 22 | + // Inflate the layout for this fragment | ||
| 23 | + return inflater.inflate(R.layout.fragment_a, container, false) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
| 27 | + super.onActivityCreated(savedInstanceState) | ||
| 28 | + val policyList = ArrayList<PolicyItem>() | ||
| 29 | + var recomdatabase = FirebaseDatabase.getInstance().reference | ||
| 30 | + | ||
| 31 | + recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : | ||
| 32 | + ValueEventListener { | ||
| 33 | + override fun onCancelled(p0: DatabaseError) { | ||
| 34 | + //Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show() | ||
| 35 | + } | ||
| 36 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
| 37 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 38 | + val memo = memoSnapshot.getValue(MemoItemRecom::class.java) | ||
| 39 | + | ||
| 40 | + policyList.add( | ||
| 41 | + PolicyItem( | ||
| 42 | + ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, | ||
| 43 | + memo!!.Policy, | ||
| 44 | + memo!!.Content, | ||
| 45 | + memo!!.Link, | ||
| 46 | + memo!!.View, | ||
| 47 | + memo!!.Keyword, | ||
| 48 | + memo!!.Date, | ||
| 49 | + memo!!.Review, | ||
| 50 | + memo!!.Score, | ||
| 51 | + memo!!.Category1, | ||
| 52 | + memo!!.Category2, | ||
| 53 | + memo!!.Category3, | ||
| 54 | + memo!!.Category4, | ||
| 55 | + memo!!.Category5, | ||
| 56 | + memo!!.Category6, | ||
| 57 | + memo!!.Category7, | ||
| 58 | + memo!!.Category8, | ||
| 59 | + memo!!.Category9, | ||
| 60 | + memo!!.Category10, | ||
| 61 | + memo!!.Category11, | ||
| 62 | + memo!!.Category12, | ||
| 63 | + memo!!.Category13, | ||
| 64 | + memo!!.Category14, | ||
| 65 | + memo!!.Category15, | ||
| 66 | + memo!!.Category16, | ||
| 67 | + memo!!.Value, | ||
| 68 | + memo!!.D_day | ||
| 69 | + ) | ||
| 70 | + ) | ||
| 71 | + } | ||
| 72 | + val adapter = PolicyAdapter(policyList) | ||
| 73 | + policyRecyclerView.adapter = adapter | ||
| 74 | + } | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +package com.example.vip | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.os.Bundle | ||
| 5 | +import androidx.fragment.app.Fragment | ||
| 6 | +import android.view.LayoutInflater | ||
| 7 | +import android.view.View | ||
| 8 | +import android.view.ViewGroup | ||
| 9 | +import androidx.core.content.ContextCompat | ||
| 10 | +import com.google.firebase.database.DataSnapshot | ||
| 11 | +import com.google.firebase.database.DatabaseError | ||
| 12 | +import com.google.firebase.database.FirebaseDatabase | ||
| 13 | +import com.google.firebase.database.ValueEventListener | ||
| 14 | +import kotlinx.android.synthetic.main.fragment_a.* | ||
| 15 | + | ||
| 16 | +class CFragment : Fragment() { | ||
| 17 | + | ||
| 18 | + override fun onCreateView( | ||
| 19 | + inflater: LayoutInflater, container: ViewGroup?, | ||
| 20 | + savedInstanceState: Bundle? | ||
| 21 | + ): View? { | ||
| 22 | + // Inflate the layout for this fragment | ||
| 23 | + return inflater.inflate(R.layout.fragment_a, container, false) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
| 27 | + super.onActivityCreated(savedInstanceState) | ||
| 28 | + val policyList = ArrayList<PolicyItem>() | ||
| 29 | + var recomdatabase = FirebaseDatabase.getInstance().reference | ||
| 30 | + | ||
| 31 | + recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : | ||
| 32 | + ValueEventListener { | ||
| 33 | + override fun onCancelled(p0: DatabaseError) { | ||
| 34 | + //Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show() | ||
| 35 | + } | ||
| 36 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
| 37 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 38 | + val memo = memoSnapshot.getValue(MemoItemRecom::class.java) | ||
| 39 | + | ||
| 40 | + policyList.add( | ||
| 41 | + PolicyItem( | ||
| 42 | + ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, | ||
| 43 | + memo!!.Policy, | ||
| 44 | + memo!!.Content, | ||
| 45 | + memo!!.Link, | ||
| 46 | + memo!!.View, | ||
| 47 | + memo!!.Keyword, | ||
| 48 | + memo!!.Date, | ||
| 49 | + memo!!.Review, | ||
| 50 | + memo!!.Score, | ||
| 51 | + memo!!.Category1, | ||
| 52 | + memo!!.Category2, | ||
| 53 | + memo!!.Category3, | ||
| 54 | + memo!!.Category4, | ||
| 55 | + memo!!.Category5, | ||
| 56 | + memo!!.Category6, | ||
| 57 | + memo!!.Category7, | ||
| 58 | + memo!!.Category8, | ||
| 59 | + memo!!.Category9, | ||
| 60 | + memo!!.Category10, | ||
| 61 | + memo!!.Category11, | ||
| 62 | + memo!!.Category12, | ||
| 63 | + memo!!.Category13, | ||
| 64 | + memo!!.Category14, | ||
| 65 | + memo!!.Category15, | ||
| 66 | + memo!!.Category16, | ||
| 67 | + memo!!.Value, | ||
| 68 | + memo!!.D_day | ||
| 69 | + ) | ||
| 70 | + ) | ||
| 71 | + } | ||
| 72 | + val adapter = PolicyAdapter(policyList) | ||
| 73 | + policyRecyclerView.adapter = adapter | ||
| 74 | + } | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +package com.example.vip | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.os.Bundle | ||
| 5 | +import androidx.fragment.app.Fragment | ||
| 6 | +import android.view.LayoutInflater | ||
| 7 | +import android.view.View | ||
| 8 | +import android.view.ViewGroup | ||
| 9 | +import androidx.core.content.ContextCompat | ||
| 10 | +import com.google.firebase.database.DataSnapshot | ||
| 11 | +import com.google.firebase.database.DatabaseError | ||
| 12 | +import com.google.firebase.database.FirebaseDatabase | ||
| 13 | +import com.google.firebase.database.ValueEventListener | ||
| 14 | +import kotlinx.android.synthetic.main.fragment_a.* | ||
| 15 | + | ||
| 16 | +class DFragment : Fragment() { | ||
| 17 | + | ||
| 18 | + override fun onCreateView( | ||
| 19 | + inflater: LayoutInflater, container: ViewGroup?, | ||
| 20 | + savedInstanceState: Bundle? | ||
| 21 | + ): View? { | ||
| 22 | + // Inflate the layout for this fragment | ||
| 23 | + return inflater.inflate(R.layout.fragment_a, container, false) | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
| 27 | + super.onActivityCreated(savedInstanceState) | ||
| 28 | + val policyList = ArrayList<PolicyItem>() | ||
| 29 | + var recomdatabase = FirebaseDatabase.getInstance().reference | ||
| 30 | + | ||
| 31 | + recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : | ||
| 32 | + ValueEventListener { | ||
| 33 | + override fun onCancelled(p0: DatabaseError) { | ||
| 34 | + //Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show() | ||
| 35 | + } | ||
| 36 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
| 37 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 38 | + val memo = memoSnapshot.getValue(MemoItemRecom::class.java) | ||
| 39 | + | ||
| 40 | + policyList.add( | ||
| 41 | + PolicyItem( | ||
| 42 | + ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, | ||
| 43 | + memo!!.Policy, | ||
| 44 | + memo!!.Content, | ||
| 45 | + memo!!.Link, | ||
| 46 | + memo!!.View, | ||
| 47 | + memo!!.Keyword, | ||
| 48 | + memo!!.Date, | ||
| 49 | + memo!!.Review, | ||
| 50 | + memo!!.Score, | ||
| 51 | + memo!!.Category1, | ||
| 52 | + memo!!.Category2, | ||
| 53 | + memo!!.Category3, | ||
| 54 | + memo!!.Category4, | ||
| 55 | + memo!!.Category5, | ||
| 56 | + memo!!.Category6, | ||
| 57 | + memo!!.Category7, | ||
| 58 | + memo!!.Category8, | ||
| 59 | + memo!!.Category9, | ||
| 60 | + memo!!.Category10, | ||
| 61 | + memo!!.Category11, | ||
| 62 | + memo!!.Category12, | ||
| 63 | + memo!!.Category13, | ||
| 64 | + memo!!.Category14, | ||
| 65 | + memo!!.Category15, | ||
| 66 | + memo!!.Category16, | ||
| 67 | + memo!!.Value, | ||
| 68 | + memo!!.D_day | ||
| 69 | + ) | ||
| 70 | + ) | ||
| 71 | + } | ||
| 72 | + val adapter = PolicyAdapter(policyList) | ||
| 73 | + policyRecyclerView.adapter = adapter | ||
| 74 | + } | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +package com.example.vip | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.os.Bundle | ||
| 5 | +import androidx.fragment.app.Fragment | ||
| 6 | +import android.view.LayoutInflater | ||
| 7 | +import android.view.View | ||
| 8 | +import android.view.ViewGroup | ||
| 9 | +import androidx.core.content.ContextCompat | ||
| 10 | +import com.google.firebase.database.DataSnapshot | ||
| 11 | +import com.google.firebase.database.DatabaseError | ||
| 12 | +import com.google.firebase.database.FirebaseDatabase | ||
| 13 | +import com.google.firebase.database.ValueEventListener | ||
| 14 | +import kotlinx.android.synthetic.main.fragment_a.* | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +class EFragment : Fragment() { | ||
| 18 | + | ||
| 19 | + override fun onCreateView( | ||
| 20 | + inflater: LayoutInflater, container: ViewGroup?, | ||
| 21 | + savedInstanceState: Bundle? | ||
| 22 | + ): View? { | ||
| 23 | + // Inflate the layout for this fragment | ||
| 24 | + return inflater.inflate(R.layout.fragment_a, container, false) | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + override fun onActivityCreated(savedInstanceState: Bundle?) { | ||
| 28 | + super.onActivityCreated(savedInstanceState) | ||
| 29 | + val policyList = ArrayList<PolicyItem>() | ||
| 30 | + var recomdatabase = FirebaseDatabase.getInstance().reference | ||
| 31 | + | ||
| 32 | + recomdatabase.orderByChild("View").addListenerForSingleValueEvent(object : | ||
| 33 | + ValueEventListener { | ||
| 34 | + override fun onCancelled(p0: DatabaseError) { | ||
| 35 | + //Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show() | ||
| 36 | + } | ||
| 37 | + override fun onDataChange(dataSnapshot: DataSnapshot) { | ||
| 38 | + for (memoSnapshot in dataSnapshot.children){ | ||
| 39 | + val memo = memoSnapshot.getValue(MemoItemRecom::class.java) | ||
| 40 | + | ||
| 41 | + policyList.add( | ||
| 42 | + PolicyItem( | ||
| 43 | + ContextCompat.getDrawable(context!!.applicationContext, R.drawable.recommend_default_blue)!!, | ||
| 44 | + memo!!.Policy, | ||
| 45 | + memo!!.Content, | ||
| 46 | + memo!!.Link, | ||
| 47 | + memo!!.View, | ||
| 48 | + memo!!.Keyword, | ||
| 49 | + memo!!.Date, | ||
| 50 | + memo!!.Review, | ||
| 51 | + memo!!.Score, | ||
| 52 | + memo!!.Category1, | ||
| 53 | + memo!!.Category2, | ||
| 54 | + memo!!.Category3, | ||
| 55 | + memo!!.Category4, | ||
| 56 | + memo!!.Category5, | ||
| 57 | + memo!!.Category6, | ||
| 58 | + memo!!.Category7, | ||
| 59 | + memo!!.Category8, | ||
| 60 | + memo!!.Category9, | ||
| 61 | + memo!!.Category10, | ||
| 62 | + memo!!.Category11, | ||
| 63 | + memo!!.Category12, | ||
| 64 | + memo!!.Category13, | ||
| 65 | + memo!!.Category14, | ||
| 66 | + memo!!.Category15, | ||
| 67 | + memo!!.Category16, | ||
| 68 | + memo!!.Value, | ||
| 69 | + memo!!.D_day | ||
| 70 | + ) | ||
| 71 | + ) | ||
| 72 | + } | ||
| 73 | + val adapter = PolicyAdapter(policyList) | ||
| 74 | + policyRecyclerView.adapter = adapter | ||
| 75 | + } | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | +} |
| ... | @@ -19,7 +19,7 @@ import com.google.firebase.database.FirebaseDatabase | ... | @@ -19,7 +19,7 @@ import com.google.firebase.database.FirebaseDatabase |
| 19 | import com.google.firebase.database.ValueEventListener | 19 | import com.google.firebase.database.ValueEventListener |
| 20 | import kotlinx.android.synthetic.main.activity_favorites.* | 20 | import kotlinx.android.synthetic.main.activity_favorites.* |
| 21 | import kotlinx.android.synthetic.main.activity_recommend.* | 21 | import kotlinx.android.synthetic.main.activity_recommend.* |
| 22 | -import kotlinx.android.synthetic.main.activity_recommend.policyRecyclerView | 22 | +//import kotlinx.android.synthetic.main.activity_recommend.policyRecyclerView |
| 23 | import kotlinx.android.synthetic.main.activity_recommend.toolbar | 23 | import kotlinx.android.synthetic.main.activity_recommend.toolbar |
| 24 | import kotlinx.android.synthetic.main.activity_signin.* | 24 | import kotlinx.android.synthetic.main.activity_signin.* |
| 25 | 25 | ||
| ... | @@ -57,6 +57,7 @@ class FavoritesActivity : AppCompatActivity() { | ... | @@ -57,6 +57,7 @@ class FavoritesActivity : AppCompatActivity() { |
| 57 | ////bottom navigation view operation start 1 | 57 | ////bottom navigation view operation start 1 |
| 58 | lateinit var bottomBar: ActionBar | 58 | lateinit var bottomBar: ActionBar |
| 59 | ////bottom navigation view operation end 1 | 59 | ////bottom navigation view operation end 1 |
| 60 | + | ||
| 60 | override fun onCreate(savedInstanceState: Bundle?) { | 61 | override fun onCreate(savedInstanceState: Bundle?) { |
| 61 | super.onCreate(savedInstanceState) | 62 | super.onCreate(savedInstanceState) |
| 62 | setContentView(R.layout.activity_favorites) | 63 | setContentView(R.layout.activity_favorites) | ... | ... |
| 1 | +package com.example.vip | ||
| 2 | +import android.view.ViewGroup | ||
| 3 | +import androidx.fragment.app.Fragment | ||
| 4 | +import androidx.fragment.app.FragmentManager | ||
| 5 | +import androidx.fragment.app.FragmentStatePagerAdapter | ||
| 6 | + | ||
| 7 | +class MainAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { | ||
| 8 | + private val fragmentTitleList = mutableListOf("전체", "교육", "고용","주거","건강") | ||
| 9 | + | ||
| 10 | + override fun getItem(position: Int): Fragment { | ||
| 11 | + | ||
| 12 | + return when (position) { | ||
| 13 | + | ||
| 14 | + 0 -> AFragment() | ||
| 15 | + | ||
| 16 | + 1 -> BFragment() | ||
| 17 | + | ||
| 18 | + 2 -> CFragment() | ||
| 19 | + | ||
| 20 | + 3 -> DFragment() | ||
| 21 | + | ||
| 22 | + 4 -> EFragment() | ||
| 23 | + | ||
| 24 | + else -> null!! | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + // 생성 할 Fragment 의 개수 | ||
| 30 | + override fun getCount() = 5 | ||
| 31 | + | ||
| 32 | + override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { | ||
| 33 | + super.destroyItem(container, position, `object`) | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + //Log.e("FragmentPagerAdapter", "destroyItem position : $position") | ||
| 37 | + } | ||
| 38 | + override fun getPageTitle(position: Int): CharSequence? { | ||
| 39 | + return fragmentTitleList[position] | ||
| 40 | + } | ||
| 41 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -62,8 +62,11 @@ data class MemoItemRecom( | ... | @@ -62,8 +62,11 @@ data class MemoItemRecom( |
| 62 | val D_day : String = "" | 62 | val D_day : String = "" |
| 63 | ) | 63 | ) |
| 64 | 64 | ||
| 65 | + | ||
| 65 | class RecommendActivity : AppCompatActivity() { | 66 | class RecommendActivity : AppCompatActivity() { |
| 66 | 67 | ||
| 68 | + private val adapter by lazy { MainAdapter(supportFragmentManager) } | ||
| 69 | + | ||
| 67 | var recomdatabase = FirebaseDatabase.getInstance().reference | 70 | var recomdatabase = FirebaseDatabase.getInstance().reference |
| 68 | 71 | ||
| 69 | ////bottom navigation view operation start 1 | 72 | ////bottom navigation view operation start 1 |
| ... | @@ -73,11 +76,18 @@ class RecommendActivity : AppCompatActivity() { | ... | @@ -73,11 +76,18 @@ class RecommendActivity : AppCompatActivity() { |
| 73 | super.onCreate(savedInstanceState) | 76 | super.onCreate(savedInstanceState) |
| 74 | setContentView(R.layout.activity_recommend) | 77 | setContentView(R.layout.activity_recommend) |
| 75 | 78 | ||
| 79 | + // 뷰페이저 어댑터 연결 | ||
| 80 | + vpMainActivity.adapter = RecommendActivity@adapter | ||
| 81 | + // 탭 레이아웃에 뷰페이저 연결 | ||
| 82 | + tabLayout.setupWithViewPager(vpMainActivity) | ||
| 83 | + | ||
| 84 | + | ||
| 76 | // 네비게이션 뷰 포커스 맞추는 코드 | 85 | // 네비게이션 뷰 포커스 맞추는 코드 |
| 77 | val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottomNavigation2) as BottomNavigationView | 86 | val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottomNavigation2) as BottomNavigationView |
| 78 | bottomNavigationView.selectedItemId = R.id.bottomRecommend | 87 | bottomNavigationView.selectedItemId = R.id.bottomRecommend |
| 79 | bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) | 88 | bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) |
| 80 | 89 | ||
| 90 | +/* | ||
| 81 | val policyList = ArrayList<PolicyItem>() | 91 | val policyList = ArrayList<PolicyItem>() |
| 82 | 92 | ||
| 83 | if (intent.hasExtra("key")) { | 93 | if (intent.hasExtra("key")) { |
| ... | @@ -124,8 +134,8 @@ class RecommendActivity : AppCompatActivity() { | ... | @@ -124,8 +134,8 @@ class RecommendActivity : AppCompatActivity() { |
| 124 | ) | 134 | ) |
| 125 | ) | 135 | ) |
| 126 | } | 136 | } |
| 127 | - val adapter = PolicyAdapter(policyList) | 137 | + //val adapter = PolicyAdapter(policyList) |
| 128 | - policyRecyclerView.adapter = adapter | 138 | + //policyRecyclerView.adapter = adapter |
| 129 | } | 139 | } |
| 130 | }) | 140 | }) |
| 131 | 141 | ||
| ... | @@ -173,11 +183,13 @@ class RecommendActivity : AppCompatActivity() { | ... | @@ -173,11 +183,13 @@ class RecommendActivity : AppCompatActivity() { |
| 173 | ) | 183 | ) |
| 174 | ) | 184 | ) |
| 175 | } | 185 | } |
| 176 | - val adapter = PolicyAdapter(policyList) | 186 | + //val adapter = PolicyAdapter(policyList) |
| 177 | - policyRecyclerView.adapter = adapter | 187 | + //policyRecyclerView.adapter = adapter |
| 178 | } | 188 | } |
| 179 | }) | 189 | }) |
| 180 | } | 190 | } |
| 191 | +*/ | ||
| 192 | + | ||
| 181 | // 1. 툴바 사용 설정 | 193 | // 1. 툴바 사용 설정 |
| 182 | setSupportActionBar(toolbar) | 194 | setSupportActionBar(toolbar) |
| 183 | // 2. 툴바 왼쪽 버튼 설정 | 195 | // 2. 툴바 왼쪽 버튼 설정 | ... | ... |
| ... | @@ -108,8 +108,7 @@ | ... | @@ -108,8 +108,7 @@ |
| 108 | <WebView | 108 | <WebView |
| 109 | android:id="@+id/policy_context" | 109 | android:id="@+id/policy_context" |
| 110 | android:layout_width="match_parent" | 110 | android:layout_width="match_parent" |
| 111 | - android:layout_height="wrap_content" | 111 | + android:layout_height="wrap_content" /> |
| 112 | - android:layout_weight="1" /> | ||
| 113 | </LinearLayout> | 112 | </LinearLayout> |
| 114 | </LinearLayout> | 113 | </LinearLayout> |
| 115 | </ScrollView> | 114 | </ScrollView> | ... | ... |
| ... | @@ -21,7 +21,6 @@ | ... | @@ -21,7 +21,6 @@ |
| 21 | android:id="@+id/toolbar" | 21 | android:id="@+id/toolbar" |
| 22 | android:layout_width="fill_parent" | 22 | android:layout_width="fill_parent" |
| 23 | android:layout_height="wrap_content" | 23 | android:layout_height="wrap_content" |
| 24 | - android:layout_marginBottom="11dp" | ||
| 25 | android:background="#FFF" | 24 | android:background="#FFF" |
| 26 | android:elevation="5dp" | 25 | android:elevation="5dp" |
| 27 | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" | 26 | android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" |
| ... | @@ -34,14 +33,28 @@ | ... | @@ -34,14 +33,28 @@ |
| 34 | android:src="@drawable/toolbar_logo" /> | 33 | android:src="@drawable/toolbar_logo" /> |
| 35 | </androidx.appcompat.widget.Toolbar> | 34 | </androidx.appcompat.widget.Toolbar> |
| 36 | 35 | ||
| 36 | + <com.google.android.material.appbar.AppBarLayout | ||
| 37 | + android:layout_width="match_parent" | ||
| 38 | + android:layout_height="wrap_content"> | ||
| 37 | 39 | ||
| 38 | - <androidx.recyclerview.widget.RecyclerView | 40 | + </com.google.android.material.appbar.AppBarLayout> |
| 39 | - android:id="@+id/policyRecyclerView" | 41 | + <com.google.android.material.tabs.TabLayout |
| 42 | + android:id="@+id/tabLayout" | ||
| 40 | android:layout_width="match_parent" | 43 | android:layout_width="match_parent" |
| 41 | - android:layout_height="500dp" | 44 | + android:layout_height="wrap_content" |
| 42 | - android:layout_weight="1" | 45 | + android:layout_marginBottom="11dp" |
| 43 | - app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | 46 | + android:background="#FFF" |
| 44 | - tools:listitem="@layout/item_policy" /> | 47 | + android:elevation="5dp" |
| 48 | + app:tabSelectedTextColor="#29ABE2" | ||
| 49 | + app:tabTextAppearance="@style/MyTabLayoutTextAppearance" | ||
| 50 | + app:tabTextColor="#000" /> | ||
| 51 | + | ||
| 52 | + <androidx.viewpager.widget.ViewPager | ||
| 53 | + android:id="@+id/vpMainActivity" | ||
| 54 | + android:layout_width="match_parent" | ||
| 55 | + android:layout_height="50dp" | ||
| 56 | + android:layout_weight="1" /> | ||
| 57 | + | ||
| 45 | 58 | ||
| 46 | <FrameLayout | 59 | <FrameLayout |
| 47 | android:layout_width="match_parent" | 60 | android:layout_width="match_parent" |
| ... | @@ -61,8 +74,6 @@ | ... | @@ -61,8 +74,6 @@ |
| 61 | app:labelVisibilityMode="labeled" | 74 | app:labelVisibilityMode="labeled" |
| 62 | app:menu="@menu/bottom_nav_menu" /> | 75 | app:menu="@menu/bottom_nav_menu" /> |
| 63 | </FrameLayout> | 76 | </FrameLayout> |
| 64 | - | ||
| 65 | </LinearLayout> | 77 | </LinearLayout> |
| 66 | - | ||
| 67 | </androidx.constraintlayout.widget.ConstraintLayout> | 78 | </androidx.constraintlayout.widget.ConstraintLayout> |
| 68 | 79 | ... | ... |
vip/app/src/main/res/layout/fragment_a.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 4 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + tools:context=".AFragment"> | ||
| 8 | + | ||
| 9 | + <!-- TODO: Update blank fragment layout --> | ||
| 10 | + <LinearLayout | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="match_parent" | ||
| 13 | + android:orientation="vertical"> | ||
| 14 | + | ||
| 15 | + <androidx.recyclerview.widget.RecyclerView | ||
| 16 | + android:id="@+id/policyRecyclerView" | ||
| 17 | + android:layout_width="match_parent" | ||
| 18 | + android:layout_height="50dp" | ||
| 19 | + android:layout_weight="1" | ||
| 20 | + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | ||
| 21 | + tools:listitem="@layout/item_policy"> | ||
| 22 | + | ||
| 23 | + </androidx.recyclerview.widget.RecyclerView> | ||
| 24 | + | ||
| 25 | + </LinearLayout> | ||
| 26 | +</FrameLayout> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -21,4 +21,7 @@ | ... | @@ -21,4 +21,7 @@ |
| 21 | <string name="msg_subscribed" translatable="false">success!</string> | 21 | <string name="msg_subscribed" translatable="false">success!</string> |
| 22 | <string name="msg_subscribe_failed" translatable="false">fail!</string> | 22 | <string name="msg_subscribe_failed" translatable="false">fail!</string> |
| 23 | 23 | ||
| 24 | + <!-- TODO: Remove or change this placeholder text --> | ||
| 25 | + <string name="hello_blank_fragment">Hello blank fragment</string> | ||
| 26 | + | ||
| 24 | </resources> | 27 | </resources> | ... | ... |
| ... | @@ -22,4 +22,11 @@ | ... | @@ -22,4 +22,11 @@ |
| 22 | <item name="android:colorControlNormal">#29ABE2</item> | 22 | <item name="android:colorControlNormal">#29ABE2</item> |
| 23 | </style> | 23 | </style> |
| 24 | 24 | ||
| 25 | + | ||
| 26 | + <style name="MyTabLayoutTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse"> | ||
| 27 | + <item name="android:textSize">14dp</item> | ||
| 28 | + <item name="android:textColorPrimary">#FFF</item> <!-- 탭바 선택된 텍스트 --> | ||
| 29 | + <item name="android:textColorSecondary">#000</item> <!-- 탭바 텍스트 --> | ||
| 30 | + </style> | ||
| 31 | + | ||
| 25 | </resources> | 32 | </resources> | ... | ... |
-
Please register or login to post a comment