신기성

recommend page list done

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
......
......@@ -6,15 +6,28 @@ import android.os.Bundle
import android.util.Half.toFloat
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.appcompat.app.ActionBar
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.snackbar.Snackbar
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener
import kotlinx.android.synthetic.main.activity_recommend.*
import kotlinx.android.synthetic.main.activity_signin.*
import kotlinx.android.synthetic.main.activity_signin.toolbar
import kotlinx.android.synthetic.main.search.*
data class MemoItemRecom(
val Target : String = "",
val Policy : String = "",
val Content : String = "",
val Link : String = ""
)
class RecommendActivity : AppCompatActivity() {
......@@ -26,21 +39,45 @@ class RecommendActivity : AppCompatActivity() {
setContentView(R.layout.activity_recommend)
val policyList = ArrayList<PolicyItem>()
var recomdatabase = FirebaseDatabase.getInstance().reference
if (intent.hasExtra("key")) {
//textView.text = intent.getStringExtra("key") 텍뷰추가하면 인텐트로 값넘기는거 보임
recomdatabase.orderByChild("Policy").startAt(intent.getStringExtra("key")).endAt(intent.getStringExtra("key")+"\uf8ff").addListenerForSingleValueEvent(object :
ValueEventListener {
override fun onCancelled(p0: DatabaseError) {
Toast.makeText(this@RecommendActivity, "실패부분", Toast.LENGTH_SHORT).show()
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (memoSnapshot in dataSnapshot.children){
val memo = memoSnapshot.getValue(MemoItem::class.java)
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this@RecommendActivity, R.drawable.image01)!!,
memo!!.Policy,
memo!!.Policy,
memo!!.Policy,
4.toFloat(),
"0"
)
)
}
policyList.add(
PolicyItem(
ContextCompat.getDrawable(this, R.drawable.image01)!!,
getString(R.string.title01),
getString(R.string.title01),
getString(R.string.title01),
4.toFloat(),
"0"
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
)
)
}
})
} else {
Toast.makeText(this, "putExtra value not found", Toast.LENGTH_SHORT).show()
}
val adapter = PolicyAdapter(policyList)
policyRecyclerView.adapter = adapter
// 1. 툴바 사용 설정
......
......@@ -38,28 +38,28 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/policyRecyclerView"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_height="500dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="@id/bottomNavigation"
tools:listitem="@layout/item_policy" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/fragmentContainer"
/>
app:layout_constraintBottom_toBottomOf="parent"
>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFF"
app:itemIconTint="#29ABE2"
app:itemTextColor="#29ABE2"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_nav_menu" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#FFF"
app:itemIconTint="#29ABE2"
app:itemTextColor="#29ABE2"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_nav_menu" />
</FrameLayout>
</LinearLayout>
......
......@@ -3,7 +3,7 @@
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"
android:layout_height="100dp"
android:orientation="horizontal">
......