third_submit
This commit is contained in:
parent
255b76c1bd
commit
7f5c6d6459
@ -28,8 +28,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Jianshu"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".GoodBookActivity"/>
|
||||
<activity android:name=".HotBookActivity"/>
|
||||
<activity android:name=".Book_informationActivity" />
|
||||
<activity android:name=".BookInformationActivity" />
|
||||
<activity android:name=".PerceptionActivity" />
|
||||
<activity android:name=".FindpwdActivity"/>
|
||||
<activity android:name=".LiteratureActivity"/>
|
||||
@ -49,8 +50,8 @@
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<activity android:name=".Activity.BookIntro"/>
|
||||
<activity android:name=".LoginActivity"
|
||||
<activity android:name=".BookIntroActivity"/>
|
||||
<activity android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
||||
android:windowSoftInputMode="adjustPan|stateVisible"/>
|
||||
<activity android:name=".RegisterActivity" />
|
||||
@ -68,7 +69,7 @@
|
||||
<activity android:name=".Activity.AccountManagerActivity"/>
|
||||
<activity android:name=".ReAddressActivity"/>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".LoginActivity"
|
||||
android:exported="true"
|
||||
android:label="Jianshu">
|
||||
<intent-filter>
|
||||
|
@ -0,0 +1,221 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
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.UpdateListener
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
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.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.bookinfo_title.*
|
||||
|
||||
|
||||
class BookInformationActivity : AppCompatActivity() {
|
||||
private val perceptionList = ArrayList<Perception>()
|
||||
private var isCommented = false
|
||||
private lateinit var bookName: String
|
||||
private lateinit var authorName: String
|
||||
private lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_book_info)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")
|
||||
bookName = intent.getStringExtra("Book_name") ?: ""
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
loadPerceptions()
|
||||
setupRecyclerView()
|
||||
loadBookInfo()
|
||||
judgeInBookshelf()
|
||||
setClickListeners()
|
||||
}
|
||||
|
||||
private fun loadPerceptions() {
|
||||
val queryPerception = BmobQuery<Perception_bmob>()
|
||||
queryPerception.addWhereEqualTo("b_name", bookName)
|
||||
queryPerception.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
list.forEach { perceptionList.add(Perception(it.objectId)) }
|
||||
bookinfo_recyclerView.adapter?.notifyDataSetChanged()
|
||||
} else {
|
||||
Log.e("BookInfo", "Error loading perceptions: ${e.message}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
val layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)
|
||||
bookinfo_recyclerView.layoutManager = layoutManager
|
||||
bookinfo_recyclerView.adapter = GoodsuibiAdapter(perceptionList)
|
||||
}
|
||||
|
||||
private fun loadBookInfo() {
|
||||
val queryBook = BmobQuery<Book_info_bmob>()
|
||||
queryBook.addWhereEqualTo("name", bookName)
|
||||
queryBook.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(books: MutableList<Book_info_bmob>?, e: BmobException?) {
|
||||
if (e == null && books != null && books.isNotEmpty()) {
|
||||
val book = books[0]
|
||||
loadBookCover(book.picture.url)
|
||||
if (book.buxing + book.tuijian + book.buxing != 0) {
|
||||
var tuijian_res: Double = 0.0
|
||||
tuijian_res = (book.tuijian) * 100.0 / (book.buxing + book.tuijian + book.yiban)
|
||||
progressBar_henhao.progress =
|
||||
book.tuijian * 100 / (book.buxing + book.tuijian + book.yiban)
|
||||
progressBar_yiban.progress =
|
||||
book.yiban * 100 / (book.buxing + book.tuijian + book.yiban)
|
||||
progressBar_buxing.progress =
|
||||
book.buxing * 100 / (book.buxing + book.tuijian + book.yiban)
|
||||
val str: String = String.format("%.2f", tuijian_res)
|
||||
textView10.text = "简书推荐值 " + str + "%"
|
||||
}
|
||||
updateBookRankings(book)
|
||||
Book_name_View.text = book.name
|
||||
book_authorname.text = book.author_name
|
||||
authorName = book.author_name
|
||||
} else {
|
||||
Log.e("BookInfo", "Error loading book info: ${e?.message}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun judgeInBookshelf() {
|
||||
val queryBookshelf = BmobQuery<BookShelf>()
|
||||
queryBookshelf.addWhereEqualTo("userid", userId)
|
||||
queryBookshelf.addWhereEqualTo("b_name", bookName)
|
||||
queryBookshelf.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(bookshelfItems: MutableList<BookShelf>?, e: BmobException?) {
|
||||
if (e == null && bookshelfItems != null && bookshelfItems.isNotEmpty()) {
|
||||
bookinfo_addBook.setImageResource(R.drawable.bookshelf2)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun setClickListeners() {
|
||||
book_authorname.setOnClickListener {
|
||||
val intent = Intent(this, author_introductionActivity::class.java)
|
||||
intent.putExtra("author_name", authorName)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
bookinfo_return.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
bookinfo_addBook.setOnClickListener {
|
||||
addBookToBookshelf()
|
||||
}
|
||||
|
||||
book_imageview.setOnClickListener {
|
||||
val intent = Intent(this, BookIntroActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
setCommentClickListeners()
|
||||
}
|
||||
|
||||
private fun addBookToBookshelf() {
|
||||
val queryBookshelf = BmobQuery<BookShelf>()
|
||||
queryBookshelf.addWhereEqualTo("userid", userId)
|
||||
queryBookshelf.addWhereEqualTo("b_name", bookName)
|
||||
queryBookshelf.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(bookshelfItems: MutableList<BookShelf>?, e: BmobException?) {
|
||||
if (e == null && (bookshelfItems == null || bookshelfItems.isEmpty())) {
|
||||
val bookshelfRecord = BookShelf()
|
||||
bookshelfRecord.setb_name(bookName)
|
||||
bookshelfRecord.setuserid(userId)
|
||||
bookshelfRecord.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, saveException: BmobException?) {
|
||||
if (saveException == null) {
|
||||
bookinfo_addBook.setImageResource(R.drawable.bookshelf2)
|
||||
Toast.makeText(
|
||||
this@BookInformationActivity,
|
||||
"添加成功",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
Log.e(
|
||||
"BookInfo",
|
||||
"Error adding book to bookshelf: ${saveException.message}"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Toast.makeText(this@BookInformationActivity, "书本已在您的书架中!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun setCommentClickListeners() {
|
||||
b_henhao.setOnClickListener { updateBookComment(true) }
|
||||
b_yiban.setOnClickListener { updateBookComment(false) }
|
||||
b_buxing.setOnClickListener { updateBookComment(false) }
|
||||
}
|
||||
|
||||
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 updateBookRankings(book: Book_info_bmob, isRecommended: Boolean = false) {
|
||||
if (isRecommended) {
|
||||
book.settuijian(book.tuijian + 1)
|
||||
} else {
|
||||
book.setyiban(book.yiban + 1)
|
||||
book.setbuxing(book.buxing + 1)
|
||||
}
|
||||
book.update(book.objectId, object : UpdateListener() {
|
||||
override fun done(e: BmobException?) {
|
||||
if (e != null) {
|
||||
Log.e("BookInfo", "Error updating book rankings: ${e.message}")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
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 中
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
package com.zjgsu.jianshu
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
@ -9,14 +8,13 @@ import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Book_informationActivity
|
||||
import com.zjgsu.jianshu.R
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_bookintro.*
|
||||
import kotlinx.android.synthetic.main.expandable3.*
|
||||
import kotlinx.android.synthetic.main.expandable4.*
|
||||
|
||||
class BookIntro:AppCompatActivity() {
|
||||
class BookIntroActivity:AppCompatActivity() {
|
||||
private lateinit var Bookname: String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@ -27,7 +25,7 @@ class BookIntro:AppCompatActivity() {
|
||||
Log.d("zy123","yes")
|
||||
inits()
|
||||
intro_titleback.setOnClickListener {
|
||||
val intent = Intent(this, Book_informationActivity::class.java)
|
||||
val intent = Intent(this, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", Bookname)
|
||||
startActivity(intent)
|
||||
finish()
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
@ -38,10 +39,12 @@ class BookShelfActivity : AppCompatActivity() {
|
||||
val Booklist = ArrayList<Book_Shelf>()
|
||||
val Booklist2 = ArrayList<Book_Shelf>()
|
||||
lateinit var adapter:BookshelfAdapter
|
||||
lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bookshelf)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
inits()
|
||||
val layoutManager=GridLayoutManager(this,3)
|
||||
recyclerView2.layoutManager=layoutManager
|
||||
@ -90,7 +93,7 @@ class BookShelfActivity : AppCompatActivity() {
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<BookShelf>()
|
||||
bmobQuery.addWhereEqualTo("userid", UserId)
|
||||
bmobQuery.addWhereEqualTo("userid", userId)
|
||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
@ -121,7 +124,7 @@ class BookShelfActivity : AppCompatActivity() {
|
||||
private fun initbookshelf(){
|
||||
Booklist.clear()
|
||||
val bmobQuery = BmobQuery<BookShelf>()
|
||||
bmobQuery.addWhereEqualTo("userid", UserId)
|
||||
bmobQuery.addWhereEqualTo("userid", userId)
|
||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
|
@ -1,322 +0,0 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
|
||||
import android.util.Log
|
||||
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.UpdateListener
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Activity.BookIntro
|
||||
import com.zjgsu.jianshu.Adapter.GoodsuibiAdapter
|
||||
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.title.*
|
||||
|
||||
|
||||
class Book_informationActivity : AppCompatActivity() {
|
||||
private var author_name: String = ""
|
||||
private val perceptionList = ArrayList<Perception>()
|
||||
var Mycomment: Boolean = false
|
||||
private lateinit var Bookname: String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_book_info)
|
||||
supportActionBar?.hide()
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
Bookname = intent.getStringExtra("Book_name").toString()
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||
recyclerView3.layoutManager = layoutManager
|
||||
var adapter = GoodsuibiAdapter(perceptionList)
|
||||
recyclerView3.adapter = adapter
|
||||
val query = BmobQuery<Book_info_bmob>()
|
||||
query.addWhereEqualTo("name", Bookname)
|
||||
query.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(p0: MutableList<Book_info_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.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`)
|
||||
book_imageview.setImageBitmap(bitmap)
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
if (p.buxing + p.tuijian + p.buxing != 0) {
|
||||
var tuijian_res: Double = 0.0
|
||||
tuijian_res = (p.tuijian) * 100.0 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_henhao.progress =
|
||||
p.tuijian * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_yiban.progress =
|
||||
p.yiban * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_buxing.progress =
|
||||
p.buxing * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
val str: String = String.format("%.2f", tuijian_res)
|
||||
textView10.text = "简书推荐值 " + str + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// val query1 = BmobQuery<Book_video>()
|
||||
// query1.addWhereEqualTo("objectId", Bookname)
|
||||
// query1.findObjects(object : FindListener<Book_video>() {
|
||||
// override fun done(p0: MutableList<Book_video>?, p1: BmobException?) {
|
||||
// if (p1 == null) {
|
||||
// if (p0 != null && p0.size > 0) {
|
||||
// for (p in p0) {
|
||||
// object : Thread() {
|
||||
// override fun run() {
|
||||
// try {
|
||||
// val url = Uri.parse(p!!.view1.url)
|
||||
// mVideoView1.setVideoURI(url)
|
||||
// mVideoView1.start()
|
||||
//
|
||||
// } catch (e: Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// query1.findObjects(object : FindListener<Book_video>() {
|
||||
// override fun done(p0: MutableList<Book_video>?, p1: BmobException?) {
|
||||
// if (p1 == null) {
|
||||
// if (p0 != null && p0.size > 0) {
|
||||
// for (p in p0) {
|
||||
// object : Thread() {
|
||||
// override fun run() {
|
||||
// try {
|
||||
// val url = Uri.parse(p!!.view2.url)
|
||||
// mVideoView2.setVideoURI(url)
|
||||
// mVideoView2.start()
|
||||
// } catch (e: Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
query.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
Book_name_View.text = i.name
|
||||
book_authorname.text = i.author_name
|
||||
author_name=i.author_name
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
book_authorname.setOnClickListener {
|
||||
val intent = Intent(this, author_introductionActivity::class.java)
|
||||
intent.putExtra("author_name", author_name)
|
||||
startActivity(intent)
|
||||
}
|
||||
b_henhao.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.settuijian(i.tuijian + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
b_yiban.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.setyiban(i.yiban + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
b_buxing.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.setbuxing(i.buxing + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
titleback.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
titleAddBook.setOnClickListener {
|
||||
val query = BmobQuery<BookShelf>()
|
||||
query.addWhereEqualTo("userid", UserId)
|
||||
query.addWhereEqualTo("b_name", Bookname)
|
||||
query.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
Toast.makeText(this@Book_informationActivity, "书本已在您的书架中!", Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
val bookshelf_record = BookShelf()
|
||||
bookshelf_record.settb_name(Bookname)
|
||||
bookshelf_record.setuserid(UserId)
|
||||
bookshelf_record.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
titleAddBook.setImageResource(R.drawable.bookshelf2)
|
||||
Toast.makeText(this@Book_informationActivity,"添加成功",Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
book_imageview.setOnClickListener {
|
||||
val intent = Intent(this, BookIntro::class.java)
|
||||
intent.putExtra("Book_name", Bookname)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun inits() {
|
||||
val myquery = BmobQuery<Perception_bmob>()
|
||||
myquery.addWhereEqualTo("b_name", Bookname)
|
||||
myquery.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
perceptionList.add(Perception(i.objectId))
|
||||
val adapter = GoodsuibiAdapter(perceptionList)
|
||||
recyclerView3.adapter = adapter
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
val myquery2 = BmobQuery<BookShelf>()
|
||||
myquery2.addWhereEqualTo("userid", UserId)
|
||||
myquery2.addWhereEqualTo("b_name", Bookname)
|
||||
myquery2.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
titleAddBook.setImageResource(R.drawable.bookshelf2)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,4 +1,98 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
class GoodBookActivity {
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookRankAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Book_rank
|
||||
import com.zjgsu.jianshu.MainActivity
|
||||
import com.zjgsu.jianshu.NavigationHelper
|
||||
import com.zjgsu.jianshu.R
|
||||
import kotlinx.android.synthetic.main.activity_bookrank.*
|
||||
|
||||
class GoodBookActivity : AppCompatActivity() {
|
||||
private var goodbookList=ArrayList<Book_rank>()
|
||||
lateinit var adapter: BookRankAdapter
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bookrank)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
adapter= BookRankAdapter(goodbookList,false)
|
||||
bookrank_recyclerView.layoutManager=
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
bookrank_recyclerView.adapter=adapter
|
||||
bookrank_swipeRefresh.setOnRefreshListener {
|
||||
loadBookRanks() //下拉刷新
|
||||
}
|
||||
loadBookRanks()
|
||||
bookrank_title.text="一周好评图书榜单"
|
||||
bookrank_subtitle.text="10本・ 9852人关注"
|
||||
returnTOCity()
|
||||
}
|
||||
private fun loadBookRanks(){
|
||||
val queryGoodBooks = BmobQuery<Book_info_bmob>()
|
||||
queryGoodBooks.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(books: List<Book_info_bmob>?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
bookrank_swipeRefresh.isRefreshing = false
|
||||
// 清空之前的书籍列表
|
||||
goodbookList.clear()
|
||||
// 计算每本书的 good 比例,并构建 Book 对象加入列表
|
||||
books?.let {
|
||||
// 对书籍列表按照 good 比例进行排序
|
||||
val sortedBooks = it.sortedByDescending { book ->
|
||||
val total = book.tuijian + book.yiban + book.buxing
|
||||
if (total > 0) {
|
||||
book.tuijian.toDouble() / total.toDouble() // 计算 good 的比例
|
||||
} else {
|
||||
0.0 // 如果总数为 0,比例设为 0
|
||||
}
|
||||
}
|
||||
// 获取前三名书籍
|
||||
val topThreeBooks = sortedBooks.take(10)
|
||||
topThreeBooks.forEach { b ->
|
||||
val tmp = b.tuijian + b.yiban + b.buxing
|
||||
val scorePercentage = if (tmp > 0) {
|
||||
(b.tuijian.toDouble() / tmp.toDouble()) * 100
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
val formattedScore = String.format("%.1f%%", scorePercentage) // 将百分数格式化为带一位小数的字符串
|
||||
val bookRank = Book_rank(
|
||||
name = b.name,
|
||||
picUrl = b.picture.url,
|
||||
score = formattedScore,
|
||||
courtOfReaders = b.countOfReaders,
|
||||
author=b.author_name,
|
||||
intro=b.introduce
|
||||
)
|
||||
goodbookList.add(bookRank)
|
||||
adapter.notifyDataSetChanged() // 确保在这里更新适配器
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 处理错误情况
|
||||
Toast.makeText(
|
||||
this@GoodBookActivity,
|
||||
"Failed to retrieve books: ${e.message}",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun returnTOCity() {
|
||||
bookrank_return.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish() // 结束当前页面
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.zjgsu.jianshu
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.widget.SearchView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -20,23 +22,26 @@ import kotlinx.android.synthetic.main.activity_main.*
|
||||
class HotBookActivity: AppCompatActivity() {
|
||||
private var hotbookList=ArrayList<Book_rank>()
|
||||
lateinit var adapter:BookRankAdapter
|
||||
lateinit var currentPosition: Pair<Int, Int>
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bookrank)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
adapter= BookRankAdapter(hotbookList)
|
||||
adapter= BookRankAdapter(hotbookList,true)
|
||||
bookrank_recyclerView.layoutManager=StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
bookrank_recyclerView.adapter=adapter
|
||||
bookrank_swipeRefresh.setOnRefreshListener {
|
||||
loadBookRanks() //下拉刷新
|
||||
}
|
||||
loadBookRanks()
|
||||
bookrank_title.text="热门图书榜单"
|
||||
bookrank_title.text="一周热门图书榜单"
|
||||
bookrank_subtitle.text="10本・ 8213人关注"
|
||||
returnTOCity()
|
||||
}
|
||||
private fun loadBookRanks(){
|
||||
val queryHotBooks = BmobQuery<Book_info_bmob>()
|
||||
queryHotBooks.order("-countOfReaders") // 根据 countOfReaders 降序排序
|
||||
queryHotBooks.setLimit(10) // 限制查询结果的数量为3
|
||||
queryHotBooks.setLimit(10) // 限制查询结果的数量为10
|
||||
queryHotBooks.findObjects(object : FindListener<Book_info_bmob>() {
|
||||
override fun done(books: List<Book_info_bmob>?, e: BmobException?) {
|
||||
bookrank_swipeRefresh.isRefreshing = false
|
||||
@ -69,9 +74,12 @@ class HotBookActivity: AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun returnTOCity(){
|
||||
bookrank_return.setOnClickListener{
|
||||
NavigationHelper.navigateTo(this, MainActivity::class.java)
|
||||
//TODO:未来添加一个返回到上个页面指定位置的功能
|
||||
private fun returnTOCity() {
|
||||
bookrank_return.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish() // 结束当前页面
|
||||
}
|
||||
}
|
||||
}
|
@ -4,75 +4,71 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.BmobUser
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_login.*
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
// var mBtnLogin:TextView= TextView(this)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
var flag: Boolean = false
|
||||
var done: Boolean = false
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")
|
||||
setClickListeners()
|
||||
}
|
||||
|
||||
private fun setClickListeners() {
|
||||
forget_password.setOnClickListener {
|
||||
val intent = Intent(this, FindpwdActivity::class.java)
|
||||
startActivity(intent)
|
||||
startActivity(Intent(this, FindpwdActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
bt_register.setOnClickListener {
|
||||
val intent = Intent(this, RegisterActivity::class.java)
|
||||
startActivity(intent)
|
||||
startActivity(Intent(this, RegisterActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
bt_login.setOnClickListener {
|
||||
val use_account: String = et_blackOutName.text.toString()
|
||||
val use_pwd: String = et_UserPassword.text.toString()
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (use_account.equals(i.account) && use_pwd.equals(i.password)) {
|
||||
val editor=getSharedPreferences("userinf", Context.MODE_PRIVATE).edit()
|
||||
editor.putString("user_id",i.objectId)
|
||||
editor.apply()
|
||||
flag = true
|
||||
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
||||
intent.putExtra("userid",i.objectId)
|
||||
startActivity(intent)
|
||||
Toast.makeText(this@LoginActivity, "登陆成功!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
break
|
||||
}
|
||||
}
|
||||
done = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if (done) {
|
||||
var a: String = ""
|
||||
if (flag)
|
||||
a = "1"
|
||||
else
|
||||
a = "0"
|
||||
Log.d("zynnnb", a)
|
||||
if (use_account.isEmpty() || use_pwd.isEmpty())
|
||||
Toast.makeText(this, "账号或密码不能为空白", Toast.LENGTH_SHORT).show()
|
||||
else if (flag != true)
|
||||
Toast.makeText(this@LoginActivity, "账号或密码不正确", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
handleLogin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleLogin() {
|
||||
val userAccount = et_blackOutName.text.toString()
|
||||
val userPassword = et_UserPassword.text.toString()
|
||||
|
||||
if (userAccount.isEmpty() || userPassword.isEmpty()) {
|
||||
Toast.makeText(this, "账号或密码不能为空白", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(users: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (user in users) {
|
||||
if (userAccount == user.account && userPassword == user.password) {
|
||||
saveUserInfo(user.objectId)
|
||||
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
|
||||
Toast.makeText(this@LoginActivity, "登陆成功!", Toast.LENGTH_SHORT).show()
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
Toast.makeText(this@LoginActivity, "账号或密码不正确", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(this@LoginActivity, "登录时发生错误: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun saveUserInfo(userId: String) {
|
||||
getSharedPreferences("userinf", Context.MODE_PRIVATE).edit()
|
||||
.putString("user_id", userId)
|
||||
.apply()
|
||||
}
|
||||
}
|
@ -13,15 +13,12 @@ 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.QueryListListener
|
||||
import com.zjgsu.jianshu.Adapter.BillboardAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.book_rank_item.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
|
||||
var UserId: String = ""
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var adapter: BookAdapter
|
||||
private lateinit var billboardAdapter: BillboardAdapter
|
||||
@ -36,6 +33,8 @@ class MainActivity : AppCompatActivity() {
|
||||
supportActionBar?.setHomeAsUpIndicator(R.drawable.menu)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")
|
||||
adapter = BookAdapter(bookList)
|
||||
// val userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "") //全局范围内userid,登录的时候存进来
|
||||
// Log.d("LoginActivity", "User ID: $userId")
|
||||
recyclerView.layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
recyclerView.adapter = adapter
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
@ -24,15 +25,15 @@ class MyActivity : AppCompatActivity() {
|
||||
|
||||
//登录的用户名
|
||||
public val user_account="0509"
|
||||
// public val user="斤鱼"
|
||||
|
||||
lateinit var userId:String
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_my)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
val query = BmobQuery<User_bmob>()
|
||||
query.addWhereEqualTo("objectId", UserId)
|
||||
query.addWhereEqualTo("objectId", userId)
|
||||
query.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(p0: MutableList<User_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
@ -89,7 +90,7 @@ class MyActivity : AppCompatActivity() {
|
||||
|
||||
tuichu.setOnClickListener {
|
||||
val intent= Intent(this,LoginActivity::class.java)
|
||||
UserId=""
|
||||
userId=""
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
@ -15,10 +16,12 @@ import kotlinx.android.synthetic.main.activity_my_post.*
|
||||
|
||||
class MyPostActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_my_post)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
inits()
|
||||
|
||||
val layoutManager=LinearLayoutManager(this)
|
||||
@ -40,7 +43,7 @@ class MyPostActivity : AppCompatActivity() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list){
|
||||
if(i.userid== UserId) {
|
||||
if(i.userid== userId) {
|
||||
PerceptionList.add(Perception(i.objectId))
|
||||
val adapter = PerceptionAdapter(PerceptionList)
|
||||
myPost_recyclerView.adapter = adapter
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
@ -18,10 +19,12 @@ import kotlin.concurrent.thread
|
||||
|
||||
class PerceptionActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_perception)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
inits()
|
||||
val layoutManager=LinearLayoutManager(this)
|
||||
perception_recyclerView.layoutManager = layoutManager
|
||||
@ -39,7 +42,7 @@ class PerceptionActivity : AppCompatActivity() {
|
||||
}
|
||||
fab.setOnClickListener {
|
||||
val intent=Intent(this,sendPerceptionActivity::class.java)
|
||||
intent.putExtra("userid", UserId)
|
||||
intent.putExtra("userid", userId)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
@ -28,10 +29,12 @@ class Perception_informationActivity:AppCompatActivity() {
|
||||
private lateinit var perceptionid:String
|
||||
private lateinit var bookName:String
|
||||
private val commentlist=ArrayList<Comment>()
|
||||
lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_perception_infomation)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
perceptionid = intent.getStringExtra("PerceptionId").toString()
|
||||
Log.d("mytest",perceptionid)
|
||||
inits()
|
||||
@ -44,7 +47,7 @@ class Perception_informationActivity:AppCompatActivity() {
|
||||
val comment=Comment_bmob()
|
||||
comment.text=yourcomment.text.toString()
|
||||
comment.perceptionid=perceptionid
|
||||
comment.comment_personid= UserId
|
||||
comment.comment_personid= userId
|
||||
comment.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
@ -65,7 +68,7 @@ class Perception_informationActivity:AppCompatActivity() {
|
||||
})
|
||||
}
|
||||
inf_bookInf.setOnClickListener{
|
||||
val intent = Intent(this, Book_informationActivity::class.java)
|
||||
val intent = Intent(this, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
@ -25,11 +26,13 @@ import java.net.URL
|
||||
class sendPerceptionActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<BookAuthor>()
|
||||
lateinit var myuserid:String
|
||||
lateinit var userId:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_sendperception)
|
||||
supportActionBar?.hide()
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||
myuserid=intent.getStringExtra("userid").toString()
|
||||
inits()
|
||||
val layoutManager =
|
||||
@ -94,7 +97,7 @@ class sendPerceptionActivity:AppCompatActivity() {
|
||||
override fun done(list:List<User_bmob>,e:BmobException?){
|
||||
if(e==null){
|
||||
for(i in list){
|
||||
if(i.objectId.equals(UserId)) {
|
||||
if(i.objectId.equals(userId)) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
|
@ -40,7 +40,6 @@ class BillboardAdapter(var listOfbookRankList: List<List<Book_rank>>) : Recycler
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val bookRankList = listOfbookRankList[position]
|
||||
Log.d("BillboardAdapter", "Size of bookRankList at position $position")
|
||||
@ -51,6 +50,7 @@ class BillboardAdapter(var listOfbookRankList: List<List<Book_rank>>) : Recycler
|
||||
holder.bookRank_decr3.text = "在读人数:"+bookRankList[2].courtOfReaders.toString()
|
||||
holder.bookRank_backimg.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, HotBookActivity::class.java)
|
||||
// 保存当前页面的滚动位置
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
}
|
||||
@ -59,7 +59,10 @@ class BillboardAdapter(var listOfbookRankList: List<List<Book_rank>>) : Recycler
|
||||
holder.bookRank_decr1.text = "简书推荐值:"+bookRankList[0].score
|
||||
holder.bookRank_decr2.text = "简书推荐值:"+bookRankList[1].score
|
||||
holder.bookRank_decr3.text = "简书推荐值:"+bookRankList[2].score
|
||||
|
||||
holder.bookRank_backimg.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, GoodBookActivity::class.java)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
}
|
||||
holder.bookRank_name1.text = bookRankList[0].name
|
||||
Glide.with(holder.itemView.context)
|
||||
|
@ -43,15 +43,17 @@ inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
holder.bookList_Introduce.text = book.introduce
|
||||
val backgrounds = arrayOf(R.drawable.color_lightpurple, R.drawable.color_lightblue,R.drawable.color_lightgreen, R.drawable.color_flesh)
|
||||
holder.innerLinearLayout.setBackgroundResource(backgrounds[position % backgrounds.size])
|
||||
if (position == 0) { // 假设第一名使用金牌图片
|
||||
holder.rankimg.setImageResource(R.drawable.gold)
|
||||
} else if (position == 1) { // 第二名使用其他图片,以此类推
|
||||
holder.rankimg.setImageResource(R.drawable.silver)
|
||||
}
|
||||
else if(position==2){
|
||||
holder.rankimg.setImageResource(R.drawable.copper)
|
||||
}
|
||||
else holder.rankimg.setImageDrawable(null)
|
||||
|
||||
// //添加金银铜奖牌
|
||||
// if (position == 0) { // 假设第一名使用金牌图片
|
||||
// holder.rankimg.setImageResource(R.drawable.gold)
|
||||
// } else if (position == 1) { // 第二名使用其他图片,以此类推
|
||||
// holder.rankimg.setImageResource(R.drawable.silver)
|
||||
// }
|
||||
// else if(position==2){
|
||||
// holder.rankimg.setImageResource(R.drawable.copper)
|
||||
// }
|
||||
// else holder.rankimg.setImageDrawable(null)
|
||||
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(book.picUrl) // 确保你的Book对象有正确的图片URL
|
||||
@ -59,7 +61,7 @@ inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.bookList_Image)
|
||||
holder.outerLinearLayout.setOnClickListener{
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class BookAdapter2(val bookList: List<Book>) : RecyclerView.Adapter<BookAdapter2
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.bookList_Image)
|
||||
holder.outerLinearLayout.setOnClickListener{
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.*
|
||||
|
||||
class BookRankAdapter(var bookList: List<Book_rank>): RecyclerView.Adapter<BookRankAdapter.ViewHolder>() {
|
||||
class BookRankAdapter(var bookList: List<Book_rank>,val isHotList:Boolean): RecyclerView.Adapter<BookRankAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookrank_pic:ImageView=view.findViewById(R.id.bookrank_pic)
|
||||
val bookrank_intro:TextView=view.findViewById(R.id.bookrank_intro)
|
||||
@ -22,6 +22,7 @@ class BookRankAdapter(var bookList: List<Book_rank>): RecyclerView.Adapter<BookR
|
||||
val innerLinearLayout: LinearLayout = view.findViewById(R.id.bookrank_innerLinearLayout)
|
||||
val outerLinearLayout:LinearLayout=view.findViewById(R.id.bookrank_outerLinearLayout)
|
||||
val bookrank_author:TextView=view.findViewById(R.id.bookrank_author)
|
||||
val bookrank_icon:ImageView=view.findViewById(R.id.bookrank_icon)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
@ -37,17 +38,28 @@ class BookRankAdapter(var bookList: List<Book_rank>): RecyclerView.Adapter<BookR
|
||||
R.drawable.color_lightpurple, R.drawable.color_lightblue,
|
||||
R.drawable.color_lightgreen, R.drawable.color_flesh)
|
||||
holder.innerLinearLayout.setBackgroundResource(backgrounds[position % backgrounds.size])
|
||||
holder.bookrank_desc.text="在读人数:"+book.courtOfReaders
|
||||
if(isHotList)
|
||||
holder.bookrank_desc.text="在读人数:"+book.courtOfReaders
|
||||
else
|
||||
holder.bookrank_desc.text="简书推荐值: "+book.score
|
||||
holder.bookrank_author.text=book.author
|
||||
// if (position == 0) { // 假设第一名使用金牌图片
|
||||
// holder.rankimg.setImageResource(R.drawable.gold)
|
||||
// } else if (position == 1) { // 第二名使用其他图片,以此类推
|
||||
// holder.rankimg.setImageResource(R.drawable.silver)
|
||||
// }
|
||||
// else if(position==2){
|
||||
// holder.rankimg.setImageResource(R.drawable.copper)
|
||||
// }
|
||||
// else holder.rankimg.setImageDrawable(null)
|
||||
when (position) {
|
||||
0 -> {
|
||||
holder.bookrank_icon.setImageResource(R.drawable.gold)
|
||||
holder.bookrank_icon.visibility = View.VISIBLE
|
||||
}
|
||||
1 -> {
|
||||
holder.bookrank_icon.setImageResource(R.drawable.silver)
|
||||
holder.bookrank_icon.visibility = View.VISIBLE
|
||||
}
|
||||
2 -> {
|
||||
holder.bookrank_icon.setImageResource(R.drawable.copper)
|
||||
holder.bookrank_icon.visibility = View.VISIBLE
|
||||
}
|
||||
else -> {
|
||||
holder.bookrank_icon.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
Glide.with(holder.itemView.context)
|
||||
.load(book.picUrl) // 确保你的Book对象有正确的图片URL
|
||||
@ -55,7 +67,7 @@ class BookRankAdapter(var bookList: List<Book_rank>): RecyclerView.Adapter<BookR
|
||||
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||
.into(holder.bookrank_pic)
|
||||
holder.outerLinearLayout.setOnClickListener{
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Book_authorAdapter.ViewHolder>() {
|
||||
lateinit var userId:String
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookList_Image: ImageView = view.findViewById(R.id.book_Image1)
|
||||
val addButton:Button=view.findViewById(R.id.addButton)
|
||||
@ -65,7 +66,7 @@ class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Boo
|
||||
}
|
||||
})
|
||||
val query1=BmobQuery<BookShelf>()
|
||||
query1.addWhereEqualTo("userid", UserId)
|
||||
query1.addWhereEqualTo("userid", userId)
|
||||
query1.addWhereEqualTo("b_name",book.name)
|
||||
query1.findObjects(object :FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
@ -77,7 +78,7 @@ class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Boo
|
||||
}
|
||||
})
|
||||
holder.bookList_Image.setOnClickListener {
|
||||
val intent= Intent(holder.itemView.context,Book_informationActivity::class.java)
|
||||
val intent= Intent(holder.itemView.context,BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name",book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
@ -86,7 +87,7 @@ class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Boo
|
||||
// intent.putExtra("Book_name",book.name)
|
||||
// ContextCompat.startActivity(holder.itemView.context,intent,null)
|
||||
val query= BmobQuery<BookShelf>()
|
||||
query.addWhereEqualTo("userid", UserId)
|
||||
query.addWhereEqualTo("userid", userId)
|
||||
query.addWhereEqualTo("b_name",book.name)
|
||||
query.findObjects(object :FindListener<BookShelf>(){
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
@ -96,8 +97,8 @@ class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Boo
|
||||
}
|
||||
else{
|
||||
val bookshelf_record=BookShelf()
|
||||
bookshelf_record.settb_name(book.name)
|
||||
bookshelf_record.setuserid(UserId)
|
||||
bookshelf_record.setb_name(book.name)
|
||||
bookshelf_record.setuserid(userId)
|
||||
bookshelf_record.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
|
@ -199,7 +199,7 @@ class BookshelfAdapter(val context: Context, val bookshelf: ArrayList<Book_Shelf
|
||||
holder.book_img.setOnClickListener {
|
||||
val res = holder.book_img.getTag()
|
||||
if (res == "0") {
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.bkname)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
} else {
|
||||
|
@ -151,7 +151,7 @@ class PerceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Ada
|
||||
})
|
||||
|
||||
holder.perceptionList_bookInf.setOnClickListener(){
|
||||
val intent= Intent(holder.itemView.context,Book_informationActivity::class.java)
|
||||
val intent= Intent(holder.itemView.context,BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name",bookName)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import cn.bmob.v3.BmobObject
|
||||
class BookShelf:BmobObject(){
|
||||
var b_name:String = ""
|
||||
var userid:String=""
|
||||
fun settb_name(bookname: String){
|
||||
fun setb_name(bookname: String){
|
||||
this.b_name=bookname
|
||||
}
|
||||
fun setuserid(uid: String){
|
||||
|
@ -12,8 +12,8 @@
|
||||
android:radius="5dip"
|
||||
/>
|
||||
<stroke
|
||||
android:width="0.1px"
|
||||
android:color="#E0FFFF"/>
|
||||
android:width="2dp"
|
||||
android:color="#000000"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
7
app/src/main/res/drawable/white_button_bg.xml
Normal file
7
app/src/main/res/drawable/white_button_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
<stroke android:width="2dp" android:color="@color/black" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
@ -12,7 +12,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
<include layout="@layout/title"/>
|
||||
<include layout="@layout/bookinfo_title"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
@ -166,7 +166,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView3"
|
||||
android:id="@+id/bookinfo_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</LinearLayout>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/categoryPage_drawerLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -12,38 +11,55 @@
|
||||
|
||||
<!-- 左侧返回按钮和推荐标题 -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bookrank_return"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/return1" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:id="@+id/bookrank_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="文学"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="10本"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bookrank_return"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/return1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:id="@+id/bookrank_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="文学"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/bookrank_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="10本・ 8213人关注"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="30dp"
|
||||
android:text="+ 关注"
|
||||
android:layout_marginRight="30dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
android:background="@drawable/white_button_bg" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -52,7 +52,6 @@
|
||||
android:id="@+id/et_blackOutName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="请输入账号"
|
||||
android:paddingLeft="2dp"
|
||||
android:textSize="20sp" />
|
||||
@ -78,7 +77,6 @@
|
||||
android:id="@+id/et_UserPassword"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="密码"
|
||||
android:inputType="textPassword"
|
||||
android:paddingLeft="2dp"
|
||||
|
@ -21,12 +21,26 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 图书封面 -->
|
||||
<ImageView
|
||||
android:id="@+id/bookrank_pic"
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="50"
|
||||
android:src="@drawable/pre_load" /> <!-- 替换为实际的封面图片资源 -->
|
||||
android:layout_weight="50">
|
||||
<!-- 图书封面 -->
|
||||
<ImageView
|
||||
android:id="@+id/bookrank_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/pre_load" />
|
||||
|
||||
<!-- 图标 -->
|
||||
<ImageView
|
||||
android:id="@+id/bookrank_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:src="@drawable/gold" />
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/bookrank_innerLinearLayout"
|
||||
android:layout_width="wrap_content"
|
||||
@ -89,7 +103,6 @@
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 喜欢图标和文字 -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -98,16 +111,16 @@
|
||||
android:paddingEnd="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivLikeIcon"
|
||||
android:id="@+id/bookrank_addbook"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/addBook" /> <!-- 替换为实际的喜欢图标资源 -->
|
||||
android:src="@drawable/addbook" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLikeText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="想读"
|
||||
android:text="加入书架"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -4,15 +4,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/titleback"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/return1"
|
||||
android:text="Back"
|
||||
android:textColor="#fff" />
|
||||
<ImageView
|
||||
android:id="@+id/bookinfo_return"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/return1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
@ -25,7 +21,7 @@
|
||||
android:text="添加图书" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/titleAddBook"
|
||||
android:id="@+id/bookinfo_addBook"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
@ -1,16 +0,0 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Jianshu" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Jianshu" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<style name="Theme.Jianshu" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/mydarkbalck</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
|
1
readme.txt
Normal file
1
readme.txt
Normal file
@ -0,0 +1 @@
|
||||
安卓项目是面向用户的,目前数据库设计有点问题,应该“管理员”专门设置一个热门图书表和好评图书表,而不要用户自己来查图片
|
Loading…
x
Reference in New Issue
Block a user