Bookinfo界面完善,开始做阅读界面
@ -50,6 +50,7 @@
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<activity android:name=".SendSpecificActivity"></activity>
|
||||
<activity android:name=".BookIntroActivity"/>
|
||||
<activity android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation" />
|
||||
|
@ -9,20 +9,27 @@ import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Adapter.GoodsuibiAdapter
|
||||
import com.zjgsu.jianshu.Adapter.GoodperceptionAdapter
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
import kotlinx.android.synthetic.main.bookinfo_title.*
|
||||
|
||||
|
||||
class BookInformationActivity : AppCompatActivity() {
|
||||
private lateinit var adapter: GoodperceptionAdapter
|
||||
private val perceptionList = ArrayList<Perception>()
|
||||
private var isCommented = false
|
||||
private lateinit var bookName: String
|
||||
@ -30,11 +37,16 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
private lateinit var userId:String
|
||||
private lateinit var picurl:String
|
||||
private var sourceActivityClass: Class<*>? = null
|
||||
private lateinit var bookInfoTextView: TextView
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_book_info)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")
|
||||
bookinfo_swipeRefresh.setOnRefreshListener {
|
||||
loadBookInfo() //下拉刷新
|
||||
}
|
||||
bookName = intent.getStringExtra("Book_name") ?: ""
|
||||
bookInfoTextView = findViewById(R.id.bookinfo_introduce)
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
sourceActivityClass = intent.getSerializableExtra("Source_Activity") as? Class<*>
|
||||
loadPerceptions()
|
||||
@ -42,16 +54,18 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
loadBookInfo()
|
||||
judgeInBookshelf()
|
||||
setClickListeners()
|
||||
judgeComment()
|
||||
}
|
||||
|
||||
private fun loadPerceptions() {
|
||||
val queryPerception = BmobQuery<Perception_bmob>()
|
||||
queryPerception.addWhereEqualTo("b_name", bookName)
|
||||
queryPerception.addWhereEqualTo("b_name", bookName) //查询指定书名的精彩点评
|
||||
queryPerception.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
bookinfo_swipeRefresh.isRefreshing = false
|
||||
list.forEach { perceptionList.add(Perception(it.objectId)) }
|
||||
bookinfo_recyclerView.adapter?.notifyDataSetChanged()
|
||||
adapter.notifyDataSetChanged()
|
||||
} else {
|
||||
Log.e("BookInfo", "Error loading perceptions: ${e.message}")
|
||||
}
|
||||
@ -60,9 +74,10 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
val layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)
|
||||
val layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
bookinfo_recyclerView.layoutManager = layoutManager
|
||||
bookinfo_recyclerView.adapter = GoodsuibiAdapter(perceptionList)
|
||||
adapter=GoodperceptionAdapter(perceptionList)
|
||||
bookinfo_recyclerView.adapter = adapter
|
||||
}
|
||||
|
||||
private fun loadBookInfo() {
|
||||
@ -71,6 +86,7 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(books: MutableList<Book_info_bmob>?, e: BmobException?) {
|
||||
if (e == null && books != null && books.isNotEmpty()) {
|
||||
bookinfo_swipeRefresh.isRefreshing = false
|
||||
val book = books[0]
|
||||
loadBookCover(book.picture.url)
|
||||
picurl=book.picture.url
|
||||
@ -87,9 +103,11 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
textView10.text = "简书推荐值 " + str + "%"
|
||||
}
|
||||
updateBookRankings(book)
|
||||
Book_name_View.text = book.name
|
||||
book_authorname.text = book.author_name
|
||||
bookinfo_bookname.text = book.name
|
||||
bookinfo_authorname.text = book.author_name
|
||||
bookinfo_introduce.text=book.introduce
|
||||
authorName = book.author_name
|
||||
bookInfoTextView.text=book.introduce
|
||||
} else {
|
||||
Log.e("BookInfo", "Error loading book info: ${e?.message}")
|
||||
}
|
||||
@ -105,13 +123,25 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
override fun done(bookshelfItems: MutableList<BookShelf>?, e: BmobException?) {
|
||||
if (e == null && bookshelfItems != null && bookshelfItems.isNotEmpty()) {
|
||||
bookinfo_addBook.setImageResource(R.drawable.alreadyin)
|
||||
bookinfo_mess.text="已加入"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun showBookIntroDialog(bookIntroContent: String) {
|
||||
val builder = AlertDialog.Builder(this)
|
||||
val dialogView = layoutInflater.inflate(R.layout.bookintro_dialog, null)
|
||||
builder.setView(dialogView)
|
||||
val dialog = builder.create()
|
||||
dialogView.findViewById<TextView>(R.id.book_intro_content)?.text = bookIntroContent
|
||||
dialogView.findViewById<Button>(R.id.book_intro_close)?.setOnClickListener {
|
||||
dialog.dismiss()
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun setClickListeners() {
|
||||
book_authorname.setOnClickListener {
|
||||
bookinfo_authorname.setOnClickListener {
|
||||
val intent = Intent(this, Author_introductionActivity::class.java)
|
||||
intent.putExtra("author_name", authorName)
|
||||
intent.putExtra("book_name",bookName)
|
||||
@ -130,12 +160,14 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
addBook2.setOnClickListener {
|
||||
addBookToBookshelf()
|
||||
}
|
||||
bookinfo_addBook.setOnClickListener {
|
||||
addBookToBookshelf()
|
||||
}
|
||||
|
||||
book_imageview.setOnClickListener {
|
||||
//TODO:BookIntroActivity要删
|
||||
bookinfo_img.setOnClickListener {
|
||||
val intent = Intent(this, BookIntroActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
startActivity(intent)
|
||||
@ -144,8 +176,15 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
setCommentClickListeners()
|
||||
bookinfo_introduce.setOnClickListener{
|
||||
showBookIntroDialog(bookInfoTextView.text.toString())
|
||||
}
|
||||
startToRead.setOnClickListener {
|
||||
val intent = Intent(this, BookIntroActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
//TODO:以后可以考虑再次点击这个“已加入的按钮”后,弹出一个对话框:是否将该书移除,然后将该书从书架中移除。而不是弹:该书已在您的书架中
|
||||
private fun addBookToBookshelf() {
|
||||
@ -163,6 +202,7 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
override fun done(objectId: String?, saveException: BmobException?) {
|
||||
if (saveException == null) {
|
||||
bookinfo_addBook.setImageResource(R.drawable.alreadyin)
|
||||
bookinfo_mess.text="已加入"
|
||||
Toast.makeText(
|
||||
this@BookInformationActivity,
|
||||
"添加成功",
|
||||
@ -185,33 +225,48 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun setCommentClickListeners() {
|
||||
b_henhao.setOnClickListener { updateBookComment(true) }
|
||||
b_yiban.setOnClickListener { updateBookComment(false) }
|
||||
b_buxing.setOnClickListener { updateBookComment(false) }
|
||||
if (!isCommented) {
|
||||
val commentClickListener = View.OnClickListener {
|
||||
val intent = Intent(this, SendSpecificActivity::class.java)
|
||||
intent.putExtra("bookname", bookName)
|
||||
when (it.id) {
|
||||
R.id.b_henhao -> intent.putExtra("comment_rank", 1)
|
||||
R.id.b_yiban -> intent.putExtra("comment_rank", 2)
|
||||
R.id.b_buxing -> intent.putExtra("comment_rank", 3)
|
||||
}
|
||||
ContextCompat.startActivity(this, intent, null)
|
||||
}
|
||||
b_henhao.setOnClickListener(commentClickListener)
|
||||
b_yiban.setOnClickListener(commentClickListener)
|
||||
b_buxing.setOnClickListener(commentClickListener)
|
||||
} else {
|
||||
Toast.makeText(this, "你已点评过该书!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateBookComment(isRecommended: Boolean) {
|
||||
if (!isCommented) {
|
||||
isCommented = true
|
||||
val queryBook = BmobQuery<Book_info_bmob>()
|
||||
queryBook.addWhereEqualTo("name", bookName)
|
||||
queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(books: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (book in books) {
|
||||
updateBookRankings(book, isRecommended)
|
||||
}
|
||||
Toast.makeText(this@BookInformationActivity, "评价成功!", Toast.LENGTH_LONG)
|
||||
.show()
|
||||
} else {
|
||||
Log.e("BookInfo", "Error updating book comment: ${e.message}")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
// private fun updateBookComment(isRecommended: Boolean) {
|
||||
// if (!isCommented) {
|
||||
// isCommented = true
|
||||
// val queryBook = BmobQuery<Book_info_bmob>()
|
||||
// queryBook.addWhereEqualTo("name", bookName)
|
||||
// queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
// override fun done(books: List<Book_info_bmob>, e: BmobException?) {
|
||||
// if (e == null) {
|
||||
// for (book in books) {
|
||||
// updateBookRankings(book, isRecommended)
|
||||
// b_henhao.setImageResource(R.drawable.recommend2)
|
||||
// }
|
||||
// Toast.makeText(this@BookInformationActivity, "评价成功!", Toast.LENGTH_LONG)
|
||||
// .show()
|
||||
// } else {
|
||||
// Log.e("BookInfo", "Error updating book comment: ${e.message}")
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun updateBookRankings(book: Book_info_bmob, isRecommended: Boolean = false) {
|
||||
if (isRecommended) {
|
||||
@ -228,11 +283,34 @@ class BookInformationActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun judgeComment(){
|
||||
val query=BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("userid",userId)
|
||||
query.addWhereEqualTo("b_name",bookName)
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(lists: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
if(lists.isNotEmpty()) {
|
||||
isCommented=true
|
||||
val Myperception = lists[0]
|
||||
if (Myperception.evaluation == 1)
|
||||
b_henhao.setImageResource(R.drawable.recommend2)
|
||||
else if (Myperception.evaluation == 2)
|
||||
b_yiban.setImageResource(R.drawable.normal2)
|
||||
else if (Myperception.evaluation == 3)
|
||||
b_buxing.setImageResource(R.drawable.bad2)
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun loadBookCover(coverUrl: String) {
|
||||
Glide.with(this) // 传入 Context
|
||||
.load(coverUrl) // 加载图片的 URL
|
||||
.placeholder(R.drawable.pre_load) // 设置占位图
|
||||
.error(R.drawable.fail_load) // 设置加载失败时显示的图片
|
||||
.into(book_imageview) // 将图片加载到指定的 ImageView 中
|
||||
.into(bookinfo_img) // 将图片加载到指定的 ImageView 中
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
||||
import com.zjgsu.jianshu.Adapter.GoodperceptionAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_perception.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
@ -19,25 +20,20 @@ import kotlin.concurrent.thread
|
||||
|
||||
class PerceptionActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
private lateinit var adapter: PerceptionAdapter
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_perception)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager=LinearLayoutManager(this)
|
||||
adapter =PerceptionAdapter(PerceptionList)
|
||||
perception_recyclerView.layoutManager = layoutManager
|
||||
val adapter =PerceptionAdapter(PerceptionList)
|
||||
|
||||
perception_recyclerView.adapter = adapter
|
||||
inits()
|
||||
perception_swipeRefresh.setOnRefreshListener {
|
||||
refreshPerception(adapter)
|
||||
}
|
||||
|
||||
Log.d("myLog",perception_recyclerView.adapter.toString())
|
||||
fab.setOnClickListener {
|
||||
val intent=Intent(this,sendPerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
inits()
|
||||
}
|
||||
setClickListeners()
|
||||
setupBottomNavigation()
|
||||
}
|
||||
private fun inits() {
|
||||
@ -45,6 +41,7 @@ class PerceptionActivity : AppCompatActivity() {
|
||||
bmobQuery.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
perception_swipeRefresh.isRefreshing = false
|
||||
for (i in list){
|
||||
PerceptionList.add(Perception(i.objectId))
|
||||
val adapter =PerceptionAdapter(PerceptionList)
|
||||
@ -56,15 +53,10 @@ class PerceptionActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshPerception(adapter: PerceptionAdapter) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
inits()
|
||||
adapter.notifyDataSetChanged()
|
||||
perception_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
private fun setClickListeners(){
|
||||
fab.setOnClickListener {
|
||||
val intent=Intent(this,sendPerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
private fun setupBottomNavigation() {
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Book_Shelf
|
||||
import com.zjgsu.jianshu.R
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
|
||||
class SendSpecificActivity: AppCompatActivity() {
|
||||
lateinit var userId:String
|
||||
lateinit var bookname:String
|
||||
var comment_rank: Int? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_sendspecific)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
sendspecific_content.requestFocus()
|
||||
// 弹出软键盘
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(sendspecific_content, InputMethodManager.SHOW_IMPLICIT)
|
||||
// 防止自动弹出软键盘时页面被顶起
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
||||
comment_rank = intent.getIntExtra("comment_rank",0)
|
||||
bookname = intent.getStringExtra("bookname")?: ""
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
sendspecific_title.text="点评《"+bookname+"》"
|
||||
judgeComment()
|
||||
setClickListeners()
|
||||
}
|
||||
private fun judgeComment(){
|
||||
if(comment_rank==1)
|
||||
sendspecific_henhao.setImageResource(R.drawable.recommend2)
|
||||
else if(comment_rank==2)
|
||||
sendspecific_yiban.setImageResource(R.drawable.normal2)
|
||||
else if(comment_rank==3)
|
||||
sendspecific_buxing.setImageResource(R.drawable.bad2)
|
||||
}
|
||||
private fun setClickListeners(){
|
||||
sendspecific_cancel.setOnClickListener {
|
||||
val intent = Intent(this, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", bookname)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
sendspecific_submit.setOnClickListener {
|
||||
val perception=Perception_bmob()
|
||||
perception.b_name=bookname
|
||||
perception.userid=userId
|
||||
perception.perception=sendspecific_content.text.toString()
|
||||
perception.evaluation= comment_rank!!
|
||||
perception.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
// 保存成功
|
||||
Toast.makeText(
|
||||
this@SendSpecificActivity,
|
||||
"点评成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
Log.d("sendspecific", "Perception_bmob saved successfully. objectId: $objectId")
|
||||
val intent = Intent(this@SendSpecificActivity, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", bookname)
|
||||
startActivity(intent)
|
||||
} else {
|
||||
// 保存失败
|
||||
Log.e("sendspecific", "Failed to save Perception_bmob: ${e.message}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
@ -22,6 +24,7 @@ import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_sendperception.*
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
@ -35,6 +38,12 @@ class sendPerceptionActivity:AppCompatActivity() {
|
||||
setContentView(R.layout.activity_sendperception)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
mycontent.requestFocus()
|
||||
// 弹出软键盘
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.showSoftInput(mycontent, InputMethodManager.SHOW_IMPLICIT)
|
||||
// 防止自动弹出软键盘时页面被顶起
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
||||
adapter = send_perceptionAdapter(bookList)
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||
|
@ -47,9 +47,18 @@ class BookAdapter2(val bookList: List<Book>,val categoryId:Int) : RecyclerView.A
|
||||
.placeholder(R.drawable.pre_load) // 可以设置一个占位图
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.bookList_Image)
|
||||
holder.outerLinearLayout.setOnClickListener{
|
||||
holder.outerLinearLayout.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
val sourceActivity = when (categoryId) {
|
||||
1 -> LiteratureActivity::class.java
|
||||
2 -> ManagementActivity::class.java
|
||||
3 -> PsychologyActivity::class.java
|
||||
4 -> ScienceActivity::class.java
|
||||
5 -> PhilosophyActivity::class.java
|
||||
else -> null
|
||||
}
|
||||
intent.putExtra("Source_Activity", sourceActivity)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import com.zjgsu.jianshu.Perception
|
||||
import com.zjgsu.jianshu.R
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class GoodperceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<GoodperceptionAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val user_Image: ImageView = view.findViewById(R.id.goodperception_avatar)
|
||||
val user_name: TextView = view.findViewById(R.id.user_Name)
|
||||
val perception: TextView = view.findViewById(R.id.goodContent)
|
||||
val evaluation_state:ImageView=view.findViewById(R.id.evaluation_state)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.goodperception_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val perception = perceptionList[position]
|
||||
// 从 Perception_bmob 表中查找与 perception 对应的数据
|
||||
BmobQuery<Perception_bmob>()
|
||||
.addWhereEqualTo("objectId", perception.perceptionid)
|
||||
.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(perceptionList: MutableList<Perception_bmob>?, exception: BmobException?) {
|
||||
if (exception == null && perceptionList != null && perceptionList.isNotEmpty()) {
|
||||
val perceptionData = perceptionList.first()
|
||||
holder.perception.text = perceptionData.perception
|
||||
if (perceptionData.evaluation == 1)
|
||||
holder.evaluation_state.setImageResource(R.drawable.recommend1)
|
||||
else if (perceptionData.evaluation == 2)
|
||||
holder.evaluation_state.setImageResource(R.drawable.normal1)
|
||||
else if (perceptionData.evaluation == 3)
|
||||
holder.evaluation_state.setImageResource(R.drawable.bad1)
|
||||
// 从 User_bmob 表中查找与 perceptionData.userid 对应的数据
|
||||
BmobQuery<User_bmob>()
|
||||
.addWhereEqualTo("objectId", perceptionData.userid)
|
||||
.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(userList: MutableList<User_bmob>?, userException: BmobException?) {
|
||||
if (userException == null && userList != null && userList.isNotEmpty()) {
|
||||
val userData = userList.first()
|
||||
holder.user_name.text = userData.nickName
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(userData.face.url)
|
||||
.placeholder(R.drawable.pre_load)
|
||||
.error(R.drawable.fail_load)
|
||||
.into(holder.user_Image)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
override fun getItemCount() =perceptionList.size
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import com.zjgsu.jianshu.Perception
|
||||
import com.zjgsu.jianshu.R
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class GoodsuibiAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<GoodsuibiAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val user_Image: ImageView = view.findViewById(R.id.user_Image)
|
||||
val user_name: TextView = view.findViewById(R.id.user_Name)
|
||||
val perception: TextView = view.findViewById(R.id.goodContent)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.goodsuibi_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val perception = perceptionList[position]
|
||||
val query = BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("objectId",perception.perceptionid)
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
holder.perception.text = p.perception
|
||||
// holder.user_Image.setImageResource(R.drawable.touxiang)
|
||||
val bmob=BmobQuery<User_bmob>()
|
||||
bmob.addWhereEqualTo("objectId",p.userid)
|
||||
bmob.findObjects(object :FindListener<User_bmob>(){
|
||||
override fun done(p2: MutableList<User_bmob>?, p3: BmobException?) {
|
||||
if(p3==null){
|
||||
if(p2!=null&&p2.size>0){
|
||||
for(i in p2){
|
||||
holder.user_name.text=i.nickName
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.user_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
override fun getItemCount() =perceptionList.size
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Activity.Perception_informationActivity
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
@ -23,74 +24,82 @@ import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class PerceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<PerceptionAdapter.ViewHolder>() {
|
||||
class PerceptionAdapter(val perceptionList: List<Perception>) :
|
||||
RecyclerView.Adapter<PerceptionAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val perceptionList_perception: TextView = view.findViewById(R.id.textView_perception)
|
||||
val perception_perception: TextView = view.findViewById(R.id.perception_content)
|
||||
|
||||
//用户头像
|
||||
val perceptionList_userIcon: ImageView = view.findViewById(R.id.user_icon)
|
||||
val perceptionList_posetPerson: TextView = view.findViewById(R.id.postPersonName)
|
||||
val perception_userIcon: ImageView = view.findViewById(R.id.perception_avatar)
|
||||
val perception_posetPerson: TextView = view.findViewById(R.id.perception_username)
|
||||
|
||||
//书籍封面
|
||||
val perceptionList_bookPic: ImageView = view.findViewById(R.id.book_pic)
|
||||
val perceptionList_bookName: TextView = view.findViewById(R.id.bookName)
|
||||
val perceptionList_bookAuthor: TextView = view.findViewById(R.id.bookAuthor)
|
||||
val perceptionList_bookInf: View = view.findViewById(R.id.bookInf)
|
||||
val comment:ImageView=view.findViewById(R.id.gotocomment)
|
||||
lateinit var perceptionid:String
|
||||
|
||||
|
||||
val perception_bookPic: ImageView = view.findViewById(R.id.perception_bookpic)
|
||||
val perception_bookName: TextView = view.findViewById(R.id.perception_bookName)
|
||||
val perception_bookAuthor: TextView = view.findViewById(R.id.perception_bookAuthor)
|
||||
val perception_bookInf: View = view.findViewById(R.id.perception_bookInf)
|
||||
lateinit var perceptionid: String
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.perception_item, parent, false)
|
||||
val view =
|
||||
LayoutInflater.from(parent.context).inflate(R.layout.perception_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
var bookName:String=""
|
||||
var bookName: String = ""
|
||||
val perception = perceptionList[position]
|
||||
//设置text
|
||||
holder.perceptionid=perception.perceptionid
|
||||
holder.perceptionid = perception.perceptionid
|
||||
val query = BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("objectId",perception.perceptionid)
|
||||
query.addWhereEqualTo("objectId", perception.perceptionid)
|
||||
//加载用户头像
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
Log.d("myLog123", p.post_person)
|
||||
bookName = p.b_name
|
||||
//找发布用户
|
||||
holder.perceptionList_perception.text=p.perception
|
||||
holder.perception_perception.text = p.perception
|
||||
val queryUser = BmobQuery<User_bmob>()
|
||||
queryUser.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.userid.equals(i.objectId)) {
|
||||
holder.perceptionList_posetPerson.setText(i.nickName)
|
||||
holder.perception_posetPerson.text = i.nickName
|
||||
// flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
Log.d("perception", "find sucessflly")
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.perceptionList_userIcon.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(i.face.url) // 确保你的Book对象有正确的图片URL
|
||||
.placeholder(R.drawable.pre_load) // 可以设置一个占位图
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.perception_userIcon)
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
||||
} else {
|
||||
Log.d("perception", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
val queryBook = BmobQuery<Book_info_bmob>()
|
||||
queryBook.addWhereEqualTo("name", bookName)
|
||||
queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
holder.perception_bookName.text=bookName
|
||||
holder.perception_bookAuthor.text=i.author_name
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(i.picture.url) // 确保你的Book对象有正确的图片URL
|
||||
.placeholder(R.drawable.pre_load) // 可以设置一个占位图
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.perception_bookPic)
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
@ -102,69 +111,69 @@ class PerceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Ada
|
||||
}
|
||||
})
|
||||
//加载书籍封面
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
Log.d("myLog", p.b_name)
|
||||
bookName=p.b_name
|
||||
holder.perceptionList_bookName.text=bookName
|
||||
val queryBook = BmobQuery<Book_info_bmob>()
|
||||
queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.b_name.equals(i.name)) {
|
||||
holder.perceptionList_bookAuthor.text=i.author_name
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.picture?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.perceptionList_bookPic.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
// query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
// override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
// if (p1 == null) {
|
||||
// if (p0 != null && p0.size > 0) {
|
||||
// for (p in p0) {
|
||||
// Log.d("myLog", p.b_name)
|
||||
// bookName=p.b_name
|
||||
// holder.perceptionList_bookName.text=bookName
|
||||
// val queryBook = BmobQuery<Book_info_bmob>()
|
||||
// queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
// override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
// if (e == null) {
|
||||
// for (i in list) {
|
||||
// if (p.b_name.equals(i.name)) {
|
||||
// holder.perceptionList_bookAuthor.text=i.author_name
|
||||
// //加载图片
|
||||
// object : Thread() {
|
||||
// override fun run() {
|
||||
// try {
|
||||
// val url = URL(i!!.picture?.url)
|
||||
// val connection: HttpURLConnection =
|
||||
// url.openConnection() as HttpURLConnection
|
||||
// connection.setRequestMethod("GET")
|
||||
// connection.setConnectTimeout(3000)
|
||||
// val `in`: InputStream = connection.getInputStream()
|
||||
// val bitmap: Bitmap =
|
||||
// BitmapFactory.decodeStream(`in`)
|
||||
// holder.perceptionList_bookPic.setImageBitmap(bitmap)
|
||||
// } catch (e: Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// Log.d("myLog", "error")
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
holder.perceptionList_bookInf.setOnClickListener(){
|
||||
val intent= Intent(holder.itemView.context,BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name",bookName)
|
||||
holder.perception_bookInf.setOnClickListener() {
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
holder.perceptionList_perception.setOnClickListener {
|
||||
val intent= Intent(holder.itemView.context,Perception_informationActivity::class.java)
|
||||
intent.putExtra("PerceptionId",holder.perceptionid)
|
||||
holder.perception_perception.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, Perception_informationActivity::class.java)
|
||||
intent.putExtra("PerceptionId", holder.perceptionid)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
//给评论图标设置点击事件
|
||||
//给评论图标设置点击事件
|
||||
holder.comment.setOnClickListener(View.OnClickListener { showPopupcomment() })
|
||||
// holder.comment.setOnClickListener(View.OnClickListener { showPopupcomment() })
|
||||
}
|
||||
|
||||
override fun getItemCount() =perceptionList.size
|
||||
override fun getItemCount() = perceptionList.size
|
||||
|
||||
}
|
||||
|
@ -6,4 +6,5 @@ class Perception_bmob:BmobObject() {
|
||||
var b_name: String = ""
|
||||
var post_person: String = ""
|
||||
var userid: String = ""
|
||||
var evaluation:Int=0
|
||||
}
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable/bad2.png
Normal file
After Width: | Height: | Size: 23 KiB |
4
app/src/main/res/drawable/blue_button_bg.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#87CEFA" /> <!-- 设置为浅蓝色 -->
|
||||
<corners android:radius="4dp" /> <!-- 可选:设置圆角边角半径 -->
|
||||
</shape>
|
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 545 B |
BIN
app/src/main/res/drawable/like2.png
Normal file
After Width: | Height: | Size: 471 B |
@ -1,4 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#219ebc"/>
|
||||
<solid android:color="#CCCCCC"/>
|
||||
</shape>
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable/normal2.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
app/src/main/res/drawable/recommend1.jpg
Normal file
After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
@ -1,9 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/bookinfo_swipeRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -11,39 +15,68 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
<include layout="@layout/bookinfo_title"/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/bookinfo_title" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_height="180dp"
|
||||
android:background="#FFFAFA"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/book_imageview"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="300dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_gravity="center" />
|
||||
android:id="@+id/bookinfo_img"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bookItem_innerLinearLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Book_name_View"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:gravity="center"
|
||||
android:textSize="23dp"
|
||||
android:textStyle="bold"
|
||||
android:text="TextView" />
|
||||
android:id="@+id/bookinfo_bookname"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="qdeww"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/book_authorname"
|
||||
android:id="@+id/bookinfo_authorname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="#00BFFF"
|
||||
android:textSize="15dp"
|
||||
android:text="TextView" />
|
||||
</LinearLayout>
|
||||
android:text="作者"
|
||||
android:textSize="15dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookinfo_introduce"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="3" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#CCCCCC"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -53,8 +86,9 @@
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="简书推荐值 "
|
||||
android:textSize="18dp" />
|
||||
android:textSize="16dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -64,17 +98,19 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
android:text="推荐" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_henhao"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="7"
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/main_pb_bg" />
|
||||
</LinearLayout>
|
||||
@ -87,17 +123,19 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="40dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
android:text="一般" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_yiban"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="7"
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/main_pb_bg" />
|
||||
|
||||
@ -111,15 +149,17 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14dp"
|
||||
android:text="不行" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_buxing"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="7"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
@ -134,45 +174,87 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_henhao"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/henhao" />
|
||||
app:srcCompat="@drawable/recommend1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_yiban"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/yiban" />
|
||||
app:srcCompat="@drawable/normal1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_buxing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/buxing" />
|
||||
app:srcCompat="@drawable/bad1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#CCCCCC"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="精彩随笔"
|
||||
android:textSize="20dp"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Book_name_View" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/bookinfo_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/bookinfo_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@android:color/white"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/addBook2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
android:text="加入书架"
|
||||
android:background="#EEEEEE"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/startToRead"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="14sp"
|
||||
android:text="阅读"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="#87CEFA"
|
||||
android:textColor="#FFFFFF" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -19,8 +19,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/categoryPage_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:src="@drawable/return1" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -33,9 +33,7 @@
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="文学"
|
||||
android:textSize="30dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textStyle="bold"
|
||||
android:textSize="25dp"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/categoryPage_swipeRefresh"
|
||||
@ -48,7 +46,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="70dp">
|
||||
android:layout_marginTop="50dp">
|
||||
|
||||
<!-- SwipeRefreshLayout 包裹的 RecyclerView -->
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
|
@ -144,7 +144,7 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:src="@drawable/comment" />
|
||||
android:src="@drawable/comment1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/my_comments"
|
||||
@ -228,7 +228,7 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:src="@drawable/comment" />
|
||||
android:src="@drawable/comment1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -5,7 +5,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/send_return"
|
||||
android:layout_width="35dp"
|
||||
@ -17,8 +20,11 @@
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="120dp"
|
||||
android:text="新建随笔"
|
||||
android:textSize="20dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/send_recyclerview"
|
||||
@ -49,7 +55,7 @@
|
||||
<EditText
|
||||
android:id="@+id/mycontent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_height="190dp"
|
||||
android:gravity="top"
|
||||
android:hint="独处,但并不孤独..." />
|
||||
</LinearLayout>
|
||||
|
91
app/src/main/res/layout/activity_sendspecific.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sendspecific_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="点评xx"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sendspecific_henhao"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/recommend1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sendspecific_yiban"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/normal1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sendspecific_buxing"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/bad1" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#CCCCCC"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
<EditText
|
||||
android:id="@+id/sendspecific_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="350dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:gravity="top"
|
||||
android:hint="独处,但并不孤独..." />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sendspecific_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:textSize="16sp"
|
||||
android:text="取消">
|
||||
</TextView>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sendspecific_submit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#00BFFF"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:text="发表">
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
214
app/src/main/res/layout/book_info.xml
Normal file
@ -0,0 +1,214 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/bookinfo_title" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:background="#FFFAFA"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/book_Image"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bookItem_innerLinearLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookinfo_bookname"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="qdeww"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookinfo_authorname"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="qdeww"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/book_Introduce"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="4" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#CCCCCC"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="简书推荐值 "
|
||||
android:textSize="18dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="推荐" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_henhao"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/main_pb_bg" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView12"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="一般" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_yiban"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/main_pb_bg" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView13"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="不行" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar_buxing"
|
||||
style="@style/mProgressBarStyle"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:max="100"
|
||||
android:progressDrawable="@drawable/main_pb_bg" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_henhao"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/recommend1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_yiban"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/normal1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/b_buxing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:srcCompat="@drawable/bad1" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#CCCCCC"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="10dp" />
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="精彩随笔"
|
||||
android:textSize="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Book_name_View" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/bookinfo_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -11,10 +11,10 @@
|
||||
android:src="@drawable/return1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:id="@+id/bookinfo_mess"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="200dp"
|
||||
android:layout_marginLeft="220dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="15dp"
|
||||
@ -35,11 +35,5 @@
|
||||
android:layout_margin="5dp"
|
||||
app:srcCompat="@drawable/bookshelf1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView7"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@drawable/menu3" />
|
||||
|
||||
</LinearLayout>
|
37
app/src/main/res/layout/bookintro_dialog.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="书本简介"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/book_intro_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="这里显示书本的具体介绍信息。"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/book_intro_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="关闭"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
103
app/src/main/res/layout/goodperception_item.xml
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/mybookinfback"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/goodperception_avatar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_Name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="张三" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/evaluation_state"
|
||||
android:layout_width="99dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/recommend1" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/goodContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:text="如果有人钟爱着一朵独一无二的盛开在浩瀚星海里的花。那么,当他抬头仰望繁星时,便会心满意足。
|
||||
他会告诉自己:“我心爱的花在那里,在那颗遥远的星星上。”可是,如果羊把花吃掉了。那么,对他来说,所有的星光变
|
||||
会在刹那间暗淡无光!而你却认为这并不重要!" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#CCCCCC" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:src="@drawable/like1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="点赞数" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:src="@drawable/comment1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="50dp"
|
||||
android:text="评论数" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/mybookinfback"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_Image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_Name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="张三" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/goodContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="如果有人钟爱着一朵独一无二的盛开在浩瀚星海里的花。那么,当他抬头仰望繁星时,便会心满意足。
|
||||
他会告诉自己:“我心爱的花在那里,在那颗遥远的星星上。”可是,如果羊把花吃掉了。那么,对他来说,所有的星光变
|
||||
会在刹那间暗淡无光!而你却认为这并不重要!" />
|
||||
|
||||
</LinearLayout>
|
@ -1,113 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/mygrey"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_margin="8dp"
|
||||
android:background="@drawable/mybookinfback"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/head"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginTop="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:id="@+id/perception_avatar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/perception_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingRight="5dp"
|
||||
android:src="@drawable/touxiang" />
|
||||
android:gravity="center_vertical"
|
||||
android:text="张三" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/postPersonName"
|
||||
android:layout_width="156dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="35dp"
|
||||
android:layout_marginEnd="177dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_toEndOf="@+id/user_icon"
|
||||
android:textColor="@color/white"
|
||||
android:text="百利甜斤鱼子" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_perception"
|
||||
android:layout_width="380dp"
|
||||
android:id="@+id/perception_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="多边形裁剪用于裁剪掉被裁剪多边形(又称为实体多边形,后文用S表示)位于窗口(又称为裁剪多边形,后文用C表示)之外的部分。裁剪的结果多边形是由实体多边形位于裁剪多边形内的边界和裁剪多边形位于实体多边形内的边界组成的。"
|
||||
app:layout_constraintTop_toBottomOf="@+id/head"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="1"
|
||||
android:lines="3"
|
||||
android:ellipsize="end"/>
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/perception_pics"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="130dp"-->
|
||||
<!-- android:layout_marginLeft="20dp"-->
|
||||
<!-- android:orientation="horizontal"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/textView_perception">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:id="@+id/image1"-->
|
||||
<!-- android:layout_width="130dp"-->
|
||||
<!-- android:layout_height="120dp"-->
|
||||
<!-- tools:srcCompat="@tools:sample/avatars" />-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:id="@+id/image2"-->
|
||||
<!-- android:layout_width="130dp"-->
|
||||
<!-- android:layout_height="120dp"-->
|
||||
<!-- tools:srcCompat="@tools:sample/avatars" />-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:id="@+id/image3"-->
|
||||
<!-- android:layout_width="130dp"-->
|
||||
<!-- android:layout_height="120dp"-->
|
||||
<!-- tools:srcCompat="@tools:sample/avatars" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
android:ellipsize="end"
|
||||
android:text="如果有人钟爱着一朵独一无二的盛开在浩瀚星海里的花。那么,当他抬头仰望繁星时,便会心满意足。
|
||||
他会告诉自己:“我心爱的花在那里,在那颗遥远的星星上。”可是,如果羊把花吃掉了。那么,对他来说,所有的星光变
|
||||
会在刹那间暗淡无光!而你却认为这并不重要!" />
|
||||
<LinearLayout
|
||||
android:id="@+id/bookInf"
|
||||
android:id="@+id/perception_bookInf"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/mydimgrey"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView_perception"
|
||||
>
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/book_pic"
|
||||
android:layout_width="130dp"
|
||||
android:id="@+id/perception_bookpic"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="89dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
tools:srcCompat="@tools:sample/avatars" />
|
||||
app:srcCompat="@drawable/pre_load" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -115,33 +72,31 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="75dp"
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookAuthor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="钱钟书"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bookName"
|
||||
android:id="@+id/perception_bookName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="围城"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
<TextView
|
||||
android:id="@+id/perception_bookAuthor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="钱钟书"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
@ -150,37 +105,56 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/wanttosee"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="#CCCCCC" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:src="@drawable/like1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="240dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bookInf">
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/like"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/gotocomment"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/comment"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/mark" />
|
||||
android:text="点赞数" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:src="@drawable/comment1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="50dp"
|
||||
android:text="评论数" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|