书架功能完善,作者简介功能完善
This commit is contained in:
parent
7f5c6d6459
commit
985582f8de
@ -39,7 +39,7 @@
|
|||||||
<activity android:name=".PhilosophyActivity"/>
|
<activity android:name=".PhilosophyActivity"/>
|
||||||
<!-- <activity android:name=".BookShelfActivity"/>-->
|
<!-- <activity android:name=".BookShelfActivity"/>-->
|
||||||
<activity android:name=".ScienceActivity"/>
|
<activity android:name=".ScienceActivity"/>
|
||||||
<activity android:name=".author_introductionActivity"/>
|
<activity android:name=".Author_introductionActivity"/>
|
||||||
<!-- <activity android:name=".MainActivity"-->
|
<!-- <activity android:name=".MainActivity"-->
|
||||||
<!-- android:exported="true"-->
|
<!-- android:exported="true"-->
|
||||||
<!-- android:label="@string/app_name"-->
|
<!-- android:label="@string/app_name"-->
|
||||||
@ -52,8 +52,7 @@
|
|||||||
<!-- </activity>-->
|
<!-- </activity>-->
|
||||||
<activity android:name=".BookIntroActivity"/>
|
<activity android:name=".BookIntroActivity"/>
|
||||||
<activity android:name=".MainActivity"
|
<activity android:name=".MainActivity"
|
||||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
android:configChanges="orientation|keyboard|keyboardHidden|navigation" />
|
||||||
android:windowSoftInputMode="adjustPan|stateVisible"/>
|
|
||||||
<activity android:name=".RegisterActivity" />
|
<activity android:name=".RegisterActivity" />
|
||||||
<activity android:name=".BookShelfActivity"/>
|
<activity android:name=".BookShelfActivity"/>
|
||||||
<activity android:name=".Activity.Perception_informationActivity"/>
|
<activity android:name=".Activity.Perception_informationActivity"/>
|
||||||
@ -74,7 +73,6 @@
|
|||||||
android:label="Jianshu">
|
android:label="Jianshu">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.zjgsu.jianshu
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
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.bumptech.glide.Glide
|
||||||
|
import com.zjgsu.jianshu.Bmob.Author_bmob
|
||||||
|
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||||
|
import kotlinx.android.synthetic.main.activity_anthor_introduction.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||||
|
|
||||||
|
class Author_introductionActivity : AppCompatActivity() {
|
||||||
|
private var authorworkList = ArrayList<AuthorWork>()
|
||||||
|
private lateinit var userId:String
|
||||||
|
private lateinit var adapter: Book_authorAdapter
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_anthor_introduction)
|
||||||
|
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||||
|
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||||
|
adapter = Book_authorAdapter(authorworkList,userId)
|
||||||
|
val layoutManager =
|
||||||
|
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||||
|
authorwork_recyclerView.layoutManager = layoutManager
|
||||||
|
authorwork_recyclerView.adapter = adapter
|
||||||
|
inits()
|
||||||
|
author_back.setOnClickListener {
|
||||||
|
val bookName=intent.getStringExtra("book_name")
|
||||||
|
val intent = Intent(this, BookInformationActivity::class.java)
|
||||||
|
intent.putExtra("Book_name", bookName)
|
||||||
|
startActivity(intent)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun inits() {
|
||||||
|
val author_name=intent.getStringExtra("author_name")
|
||||||
|
book_authorname1.text = author_name
|
||||||
|
val authorQuery = BmobQuery<Author_bmob>()
|
||||||
|
authorQuery.addWhereEqualTo("author_name",author_name)
|
||||||
|
authorQuery.findObjects(object : FindListener<Author_bmob>() {
|
||||||
|
override fun done(list: List<Author_bmob>, e: BmobException?) {
|
||||||
|
if (e == null) {
|
||||||
|
val author=list[0]
|
||||||
|
author_intro.text=author.author_introduce
|
||||||
|
loadAuthorPic(author.picture.url)
|
||||||
|
val authorworkQuery=BmobQuery<Book_info_bmob>()
|
||||||
|
authorworkQuery.addWhereEqualTo("authorid",author.objectId)
|
||||||
|
authorworkQuery.findObjects(object :FindListener<Book_info_bmob>(){
|
||||||
|
override fun done(books:List<Book_info_bmob>,e:BmobException?){
|
||||||
|
if(e==null){
|
||||||
|
authorworkList.clear()
|
||||||
|
books?.let {
|
||||||
|
authorworkList.addAll(it.map { b ->
|
||||||
|
// 使用安全调用和Elvis操作符提供默认值或进行错误处理
|
||||||
|
val url = b.picture?.url ?: "default_url_or_handling_case"
|
||||||
|
AuthorWork(b.name,author_name.toString(), url)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Log.d("error", "error")
|
||||||
|
}
|
||||||
|
// expand_text_view.text=author_selfintro
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
private fun loadAuthorPic(coverUrl: String) {
|
||||||
|
Glide.with(this) // 传入 Context
|
||||||
|
.load(coverUrl) // 加载图片的 URL
|
||||||
|
.placeholder(R.drawable.pre_load) // 设置占位图
|
||||||
|
.error(R.drawable.fail_load) // 设置加载失败时显示的图片
|
||||||
|
.into(author_img) // 将图片加载到指定的 ImageView 中
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ class BookInformationActivity : AppCompatActivity() {
|
|||||||
private lateinit var bookName: String
|
private lateinit var bookName: String
|
||||||
private lateinit var authorName: String
|
private lateinit var authorName: String
|
||||||
private lateinit var userId:String
|
private lateinit var userId:String
|
||||||
|
private lateinit var picurl:String
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_book_info)
|
setContentView(R.layout.activity_book_info)
|
||||||
@ -70,6 +71,7 @@ class BookInformationActivity : AppCompatActivity() {
|
|||||||
if (e == null && books != null && books.isNotEmpty()) {
|
if (e == null && books != null && books.isNotEmpty()) {
|
||||||
val book = books[0]
|
val book = books[0]
|
||||||
loadBookCover(book.picture.url)
|
loadBookCover(book.picture.url)
|
||||||
|
picurl=book.picture.url
|
||||||
if (book.buxing + book.tuijian + book.buxing != 0) {
|
if (book.buxing + book.tuijian + book.buxing != 0) {
|
||||||
var tuijian_res: Double = 0.0
|
var tuijian_res: Double = 0.0
|
||||||
tuijian_res = (book.tuijian) * 100.0 / (book.buxing + book.tuijian + book.yiban)
|
tuijian_res = (book.tuijian) * 100.0 / (book.buxing + book.tuijian + book.yiban)
|
||||||
@ -108,11 +110,12 @@ class BookInformationActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setClickListeners() {
|
private fun setClickListeners() {
|
||||||
book_authorname.setOnClickListener {
|
book_authorname.setOnClickListener {
|
||||||
val intent = Intent(this, author_introductionActivity::class.java)
|
val intent = Intent(this, Author_introductionActivity::class.java)
|
||||||
intent.putExtra("author_name", authorName)
|
intent.putExtra("author_name", authorName)
|
||||||
|
intent.putExtra("book_name",bookName)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
//TODO:不一定回到MainActivity::class,后面还要在跳转前保存上一个页面
|
||||||
bookinfo_return.setOnClickListener {
|
bookinfo_return.setOnClickListener {
|
||||||
val intent = Intent(this, MainActivity::class.java)
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
@ -142,6 +145,7 @@ class BookInformationActivity : AppCompatActivity() {
|
|||||||
val bookshelfRecord = BookShelf()
|
val bookshelfRecord = BookShelf()
|
||||||
bookshelfRecord.setb_name(bookName)
|
bookshelfRecord.setb_name(bookName)
|
||||||
bookshelfRecord.setuserid(userId)
|
bookshelfRecord.setuserid(userId)
|
||||||
|
bookshelfRecord.setpicurl(picurl)
|
||||||
bookshelfRecord.save(object : SaveListener<String>() {
|
bookshelfRecord.save(object : SaveListener<String>() {
|
||||||
override fun done(objectId: String?, saveException: BmobException?) {
|
override fun done(objectId: String?, saveException: BmobException?) {
|
||||||
if (saveException == null) {
|
if (saveException == null) {
|
||||||
|
@ -33,11 +33,13 @@ import android.widget.TextView
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View.OnTouchListener
|
import android.view.View.OnTouchListener
|
||||||
|
import android.widget.Button
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import cn.bmob.v3.listener.UpdateListener
|
||||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||||
|
|
||||||
class BookShelfActivity : AppCompatActivity() {
|
class BookShelfActivity : AppCompatActivity() {
|
||||||
val Booklist = ArrayList<Book_Shelf>()
|
val booklist = ArrayList<Book_Shelf>()
|
||||||
val Booklist2 = ArrayList<Book_Shelf>()
|
|
||||||
lateinit var adapter:BookshelfAdapter
|
lateinit var adapter:BookshelfAdapter
|
||||||
lateinit var userId:String
|
lateinit var userId:String
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -45,95 +47,34 @@ class BookShelfActivity : AppCompatActivity() {
|
|||||||
setContentView(R.layout.activity_bookshelf)
|
setContentView(R.layout.activity_bookshelf)
|
||||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||||
inits()
|
loadBookshelf()
|
||||||
val layoutManager=GridLayoutManager(this,3)
|
val layoutManager=GridLayoutManager(this,3)
|
||||||
recyclerView2.layoutManager=layoutManager
|
bookshelf_recyclerView.layoutManager=layoutManager
|
||||||
adapter=BookshelfAdapter(this,Booklist)
|
adapter=BookshelfAdapter(this,booklist)
|
||||||
recyclerView2.adapter=adapter
|
bookshelf_recyclerView.adapter=adapter
|
||||||
adapter.setRecyclerViewOnItemClickListener(object : BookshelfAdapter.RecyclerViewOnItemClickListener {
|
bookshelf_swipeRefresh.setOnRefreshListener {
|
||||||
override fun onItemClickListener(view: View?, position: Int) {
|
loadBookshelf()
|
||||||
Log.d("zyzh","12311")
|
|
||||||
adapter.setSelectItem(position)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onItemLongClickListener(view: View?, position: Int): Boolean {
|
|
||||||
Log.d("zy11","123121")
|
|
||||||
adapter.setShowBox()
|
|
||||||
adapter.setSelectItem(position)
|
|
||||||
adapter.notifyDataSetChanged()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
swipeRefresh2.setOnRefreshListener {
|
|
||||||
refreshBookShelf(adapter)
|
|
||||||
}
|
}
|
||||||
setupBottomNavigation()
|
setupBottomNavigation()
|
||||||
|
select()
|
||||||
}
|
}
|
||||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
private fun loadBookshelf(){
|
||||||
menuInflater.inflate(R.menu.nav_bookshelf,menu)
|
booklist.clear()
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
||||||
when(item.getItemId()) {
|
|
||||||
R.id.addBook-> {
|
|
||||||
val intent = Intent(this, MainActivity::class.java)
|
|
||||||
startActivity(intent)
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
R.id.editor->{
|
|
||||||
adapter.initMap()
|
|
||||||
adapter.setShowBox()
|
|
||||||
adapter.notifyDataSetChanged()
|
|
||||||
// bookshelf_checkBox.visibility=View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onContextItemSelected(item);
|
|
||||||
}
|
|
||||||
private fun inits() {
|
|
||||||
val bmobQuery = BmobQuery<BookShelf>()
|
val bmobQuery = BmobQuery<BookShelf>()
|
||||||
bmobQuery.addWhereEqualTo("userid", userId)
|
bmobQuery.addWhereEqualTo("userid", userId)
|
||||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
override fun done(books: List<BookShelf>?, e: BmobException?) {
|
||||||
|
bookshelf_swipeRefresh.isRefreshing = false
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
for (i in list) {
|
booklist.clear()
|
||||||
Booklist.add(Book_Shelf(i.b_name))
|
books?.let {
|
||||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
booklist.addAll(it.map { b ->
|
||||||
recyclerView2.adapter = adapter
|
val url = b.picurl?: "default_url_or_handling_case"
|
||||||
|
Book_Shelf(b.b_name,url)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Booklist.add(Book_Shelf("添加"))
|
booklist.add(Book_Shelf("添加", ""))
|
||||||
Booklist2.add(Book_Shelf("添加"))
|
adapter.notifyDataSetChanged()
|
||||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
|
||||||
recyclerView2.adapter = adapter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
private fun refreshBookShelf(adapter: BookshelfAdapter) {
|
|
||||||
thread {
|
|
||||||
Thread.sleep(2000)
|
|
||||||
runOnUiThread {
|
|
||||||
initbookshelf()
|
|
||||||
adapter.notifyDataSetChanged()
|
|
||||||
swipeRefresh2.isRefreshing = false
|
|
||||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private fun initbookshelf(){
|
|
||||||
Booklist.clear()
|
|
||||||
val bmobQuery = BmobQuery<BookShelf>()
|
|
||||||
bmobQuery.addWhereEqualTo("userid", userId)
|
|
||||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
|
||||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
|
||||||
if (e == null) {
|
|
||||||
for (i in list) {
|
|
||||||
Booklist.add(Book_Shelf(i.b_name))
|
|
||||||
}
|
|
||||||
Booklist.add(Book_Shelf("添加"))
|
|
||||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
|
||||||
recyclerView2.adapter = adapter
|
|
||||||
}else {
|
}else {
|
||||||
Log.d("error", "error")
|
Log.d("error", "error")
|
||||||
}
|
}
|
||||||
@ -155,4 +96,90 @@ class BookShelfActivity : AppCompatActivity() {
|
|||||||
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun select(){
|
||||||
|
bookshelf_select.setOnClickListener{
|
||||||
|
default_title.visibility=View.GONE
|
||||||
|
selected_title.visibility = View.VISIBLE
|
||||||
|
bookshelf_layout_bottom_navigation.visibility=View.GONE
|
||||||
|
selected_bottom_navigation.visibility=View.VISIBLE
|
||||||
|
adapter.toggleSelectMode()
|
||||||
|
}
|
||||||
|
bookshelf_cancel.setOnClickListener {
|
||||||
|
default_title.visibility=View.VISIBLE
|
||||||
|
selected_title.visibility = View.GONE
|
||||||
|
bookshelf_layout_bottom_navigation.visibility=View.VISIBLE
|
||||||
|
selected_bottom_navigation.visibility=View.GONE
|
||||||
|
adapter.toggleSelectMode()
|
||||||
|
}
|
||||||
|
adapter.onSelectionChanged = { selectedCount ->
|
||||||
|
select_books.text = if (selectedCount > 0) "已选择 $selectedCount 本书籍" else "选择书籍"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun onRemoveFromBookshelfClicked(view: View) {
|
||||||
|
//TODO:目前是用消息弹窗的方式,其他方法:若没有选中书籍时,可以设置移除按钮不可选中
|
||||||
|
if (adapter.selectedItems.isEmpty()) {
|
||||||
|
// 如果没有选中图书,弹出提示并返回
|
||||||
|
Toast.makeText(this, "请先选择要移除的图书", Toast.LENGTH_SHORT).show()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
adapter.selectedItems.toList().also { positionList ->
|
||||||
|
// 创建并显示删除确认对话框
|
||||||
|
val builder = AlertDialog.Builder(this)
|
||||||
|
val dialogView = layoutInflater.inflate(R.layout.delete_dialog, null)
|
||||||
|
builder.setView(dialogView)
|
||||||
|
|
||||||
|
val dialog = builder.create()
|
||||||
|
dialogView.findViewById<TextView>(R.id.dialog_message)?.text = "是否将《${booklist[positionList.first()].bkname}》移出书架?"
|
||||||
|
dialogView.findViewById<Button>(R.id.dialog_cancel)?.setOnClickListener {
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
dialogView.findViewById<Button>(R.id.dialog_remove)?.setOnClickListener {
|
||||||
|
// 从 BookShelf 表中删除图书的逻辑
|
||||||
|
positionList.sorted().reversed().forEach { position ->
|
||||||
|
val bmobQuery = BmobQuery<BookShelf>()
|
||||||
|
bmobQuery.addWhereEqualTo("userid", userId)
|
||||||
|
bmobQuery.addWhereEqualTo("b_name", booklist[position].bkname)
|
||||||
|
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||||
|
override fun done(books: List<BookShelf>?, e: BmobException?) {
|
||||||
|
if (e == null) {
|
||||||
|
books?.firstOrNull()?.also { book ->
|
||||||
|
book.delete(object : UpdateListener() {
|
||||||
|
override fun done(e: BmobException?) {
|
||||||
|
if (e == null) {
|
||||||
|
// 删除成功
|
||||||
|
booklist.removeAt(position)
|
||||||
|
adapter.selectedItems.remove(position)
|
||||||
|
adapter.selectedItems.forEach { selectedPosition ->
|
||||||
|
if (selectedPosition > position) {
|
||||||
|
adapter.selectedItems.remove(selectedPosition)
|
||||||
|
adapter.selectedItems.add(selectedPosition - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Toast.makeText(
|
||||||
|
this@BookShelfActivity,
|
||||||
|
"移除成功",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
adapter.onSelectionChanged?.invoke(adapter.selectedItems.size)
|
||||||
|
} else {
|
||||||
|
// 删除失败
|
||||||
|
}
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 查询失败
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -39,7 +39,6 @@ class LoginActivity : AppCompatActivity() {
|
|||||||
private fun handleLogin() {
|
private fun handleLogin() {
|
||||||
val userAccount = et_blackOutName.text.toString()
|
val userAccount = et_blackOutName.text.toString()
|
||||||
val userPassword = et_UserPassword.text.toString()
|
val userPassword = et_UserPassword.text.toString()
|
||||||
|
|
||||||
if (userAccount.isEmpty() || userPassword.isEmpty()) {
|
if (userAccount.isEmpty() || userPassword.isEmpty()) {
|
||||||
Toast.makeText(this, "账号或密码不能为空白", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "账号或密码不能为空白", Toast.LENGTH_SHORT).show()
|
||||||
return
|
return
|
||||||
|
@ -179,7 +179,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
goodbookList.add(bookRank)
|
goodbookList.add(bookRank)
|
||||||
}
|
}
|
||||||
|
|
||||||
listOfBookRankList.add(goodbookList)
|
listOfBookRankList.add(goodbookList)
|
||||||
billboardAdapter.notifyDataSetChanged() // 确保在这里更新适配器
|
billboardAdapter.notifyDataSetChanged() // 确保在这里更新适配器
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,10 @@ import kotlin.concurrent.thread
|
|||||||
|
|
||||||
class PerceptionActivity : AppCompatActivity() {
|
class PerceptionActivity : AppCompatActivity() {
|
||||||
private val PerceptionList = ArrayList<Perception>()
|
private val PerceptionList = ArrayList<Perception>()
|
||||||
lateinit var userId:String
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_perception)
|
setContentView(R.layout.activity_perception)
|
||||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
|
||||||
inits()
|
inits()
|
||||||
val layoutManager=LinearLayoutManager(this)
|
val layoutManager=LinearLayoutManager(this)
|
||||||
perception_recyclerView.layoutManager = layoutManager
|
perception_recyclerView.layoutManager = layoutManager
|
||||||
@ -36,15 +34,9 @@ class PerceptionActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.d("myLog",perception_recyclerView.adapter.toString())
|
Log.d("myLog",perception_recyclerView.adapter.toString())
|
||||||
|
|
||||||
fab.setOnClickListener {
|
|
||||||
Toast.makeText(this,"新建随笔",Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
fab.setOnClickListener {
|
fab.setOnClickListener {
|
||||||
val intent=Intent(this,sendPerceptionActivity::class.java)
|
val intent=Intent(this,sendPerceptionActivity::class.java)
|
||||||
intent.putExtra("userid", userId)
|
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
|
||||||
}
|
}
|
||||||
setupBottomNavigation()
|
setupBottomNavigation()
|
||||||
}
|
}
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
package com.zjgsu.jianshu
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
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.Bmob.Book_info_bmob
|
|
||||||
import kotlinx.android.synthetic.main.activity_anthor_introduction.*
|
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
|
||||||
import kotlinx.android.synthetic.main.book_author_item.*
|
|
||||||
import kotlinx.android.synthetic.main.expandable.*
|
|
||||||
import java.io.InputStream
|
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
class author_introductionActivity : AppCompatActivity() {
|
|
||||||
private var bookList = ArrayList<BookAuthor>()
|
|
||||||
private var author_selfintro:String=""
|
|
||||||
private val url_list = mutableListOf<String>()
|
|
||||||
private var flag: Int =0
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_anthor_introduction)
|
|
||||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
|
||||||
book_authorname1.text = intent.getStringExtra("author_name")
|
|
||||||
inits()
|
|
||||||
val layoutManager =
|
|
||||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
|
||||||
recyclerView1.layoutManager = layoutManager
|
|
||||||
var adapter = Book_authorAdapter(bookList)
|
|
||||||
recyclerView1.adapter = adapter
|
|
||||||
expand_collapse.setOnClickListener{
|
|
||||||
val myDialog:MyDialog= MyDialog(this)
|
|
||||||
myDialog.setTitle("作者介绍")
|
|
||||||
myDialog.setMessage(author_selfintro)
|
|
||||||
myDialog.setCancel("cancel",MyDialog.IOnCancelListener {
|
|
||||||
fun onCancel(dialog:MyDialog) {
|
|
||||||
Toast.makeText(this,"取消",Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
myDialog.setConfirm("confirm",MyDialog.IOnConfirmListener {
|
|
||||||
fun OnConfirm(dialog:MyDialog){
|
|
||||||
Toast.makeText(this,"确认",Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
myDialog.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private fun inits() {
|
|
||||||
val bmobQuery = BmobQuery<Book_info_bmob>()
|
|
||||||
bmobQuery.addWhereEqualTo("author_name",book_authorname1.text.toString())
|
|
||||||
bmobQuery.findObjects(object : FindListener<Book_info_bmob>() {
|
|
||||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
|
||||||
if (e == null) {
|
|
||||||
for (i in list) {
|
|
||||||
if(flag==0){
|
|
||||||
author_selfintro=i.author_introduce
|
|
||||||
flag=1
|
|
||||||
url_list.add(i!!.picture.url)
|
|
||||||
//加载authorPic
|
|
||||||
object : Thread() {
|
|
||||||
override fun run() {
|
|
||||||
try {
|
|
||||||
//作者
|
|
||||||
val url = URL(i!!.authorpic.url)
|
|
||||||
Log.d("myLog", url.toString())
|
|
||||||
val connection: HttpURLConnection =
|
|
||||||
url.openConnection() as HttpURLConnection
|
|
||||||
connection.setRequestMethod("GET")
|
|
||||||
connection.setConnectTimeout(5000)
|
|
||||||
val `in`: InputStream = connection.getInputStream()
|
|
||||||
val bitmap: Bitmap =
|
|
||||||
BitmapFactory.decodeStream(`in`)
|
|
||||||
author_img.setImageBitmap(bitmap)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start()
|
|
||||||
}
|
|
||||||
bookList.add(BookAuthor(i.name, i.author_name))
|
|
||||||
val adapter = Book_authorAdapter(bookList)
|
|
||||||
recyclerView1.adapter = adapter
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.d("error", "error")
|
|
||||||
}
|
|
||||||
expand_text_view.text=author_selfintro
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,34 +13,35 @@ import cn.bmob.v3.Bmob
|
|||||||
import cn.bmob.v3.BmobQuery
|
import cn.bmob.v3.BmobQuery
|
||||||
import cn.bmob.v3.exception.BmobException
|
import cn.bmob.v3.exception.BmobException
|
||||||
import cn.bmob.v3.listener.FindListener
|
import cn.bmob.v3.listener.FindListener
|
||||||
|
import cn.bmob.v3.listener.QueryListener
|
||||||
import cn.bmob.v3.listener.SaveListener
|
import cn.bmob.v3.listener.SaveListener
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import com.zjgsu.jianshu.*
|
import com.zjgsu.jianshu.*
|
||||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||||
import com.zjgsu.jianshu.Bmob.User_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_sendperception.*
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
class sendPerceptionActivity:AppCompatActivity() {
|
class sendPerceptionActivity:AppCompatActivity() {
|
||||||
private var bookList = ArrayList<BookAuthor>()
|
private var bookList = ArrayList<Book_Shelf>()
|
||||||
lateinit var myuserid:String
|
|
||||||
lateinit var userId:String
|
lateinit var userId:String
|
||||||
|
private lateinit var adapter: send_perceptionAdapter
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_sendperception)
|
setContentView(R.layout.activity_sendperception)
|
||||||
supportActionBar?.hide()
|
|
||||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||||
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
userId = getSharedPreferences("userinf", Context.MODE_PRIVATE).getString("user_id", "").toString()
|
||||||
myuserid=intent.getStringExtra("userid").toString()
|
adapter = send_perceptionAdapter(bookList)
|
||||||
inits()
|
|
||||||
val layoutManager =
|
val layoutManager =
|
||||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||||
send_recyclerview.layoutManager = layoutManager
|
send_recyclerview.layoutManager = layoutManager
|
||||||
var adapter = send_perceptionAdapter(bookList)
|
|
||||||
send_recyclerview.adapter = adapter
|
send_recyclerview.adapter = adapter
|
||||||
delete.setOnClickListener {
|
inits()
|
||||||
|
send_return.setOnClickListener {
|
||||||
val intent= Intent(this,PerceptionActivity::class.java)
|
val intent= Intent(this,PerceptionActivity::class.java)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
finish()
|
||||||
@ -52,7 +53,7 @@ class sendPerceptionActivity:AppCompatActivity() {
|
|||||||
else {
|
else {
|
||||||
val perception = Perception_bmob()
|
val perception = Perception_bmob()
|
||||||
perception.perception = mycontent.text.toString()
|
perception.perception = mycontent.text.toString()
|
||||||
perception.userid = myuserid
|
perception.userid = userId
|
||||||
perception.b_name = selectedBook
|
perception.b_name = selectedBook
|
||||||
perception.save(object : SaveListener<String>() {
|
perception.save(object : SaveListener<String>() {
|
||||||
override fun done(objectId: String?, e: BmobException?) {
|
override fun done(objectId: String?, e: BmobException?) {
|
||||||
@ -80,43 +81,35 @@ class sendPerceptionActivity:AppCompatActivity() {
|
|||||||
private fun inits(){
|
private fun inits(){
|
||||||
val bmobQuery = BmobQuery<Book_info_bmob>()
|
val bmobQuery = BmobQuery<Book_info_bmob>()
|
||||||
bmobQuery.findObjects(object : FindListener<Book_info_bmob>() {
|
bmobQuery.findObjects(object : FindListener<Book_info_bmob>() {
|
||||||
override fun done(list: List<Book_info_bmob>, e: BmobException?) {
|
override fun done(lists: List<Book_info_bmob>, e: BmobException?) {
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
for (i in list) {
|
bookList.clear()
|
||||||
bookList.add(BookAuthor(i.name, i.author_name))
|
lists?.let {
|
||||||
val adapter = send_perceptionAdapter(bookList)
|
bookList.addAll(it.map { b ->
|
||||||
send_recyclerview.adapter = adapter
|
// 使用安全调用和Elvis操作符提供默认值或进行错误处理
|
||||||
|
val url = b.picture?.url ?: "default_url_or_handling_case"
|
||||||
|
Book_Shelf(b.name,url)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
} else {
|
} else {
|
||||||
Log.d("error", "error")
|
Log.d("error", "error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
val query=BmobQuery<User_bmob>()
|
val queryUser = BmobQuery<User_bmob>()
|
||||||
query.findObjects(object:FindListener<User_bmob>(){
|
queryUser.getObject(userId, object : QueryListener<User_bmob>() {
|
||||||
override fun done(list:List<User_bmob>,e:BmobException?){
|
override fun done(user: User_bmob?, e: BmobException?) {
|
||||||
if(e==null){
|
if (e == null) {
|
||||||
for(i in list){
|
user?.let {
|
||||||
if(i.objectId.equals(userId)) {
|
Glide.with(this@sendPerceptionActivity) // 传入 Context
|
||||||
object : Thread() {
|
.load(it.face.url) // 加载图片的 URL
|
||||||
override fun run() {
|
.placeholder(R.drawable.pre_load) // 设置占位图
|
||||||
try {
|
.error(R.drawable.fail_load) // 设置加载失败时显示的图片
|
||||||
val url = URL(i!!.face.url)
|
.into(send_avatar) // 将图片加载到指定的 ImageView 中
|
||||||
val connection: HttpURLConnection =
|
|
||||||
url.openConnection() as HttpURLConnection
|
|
||||||
connection.setRequestMethod("GET")
|
|
||||||
connection.setConnectTimeout(5000)
|
|
||||||
val `in`: InputStream = connection.getInputStream()
|
|
||||||
val bitmap: Bitmap =
|
|
||||||
BitmapFactory.decodeStream(`in`)
|
|
||||||
touxiang.setImageBitmap(bitmap)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("QueryUser", e.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -15,6 +15,7 @@ import cn.bmob.v3.BmobQuery
|
|||||||
import cn.bmob.v3.exception.BmobException
|
import cn.bmob.v3.exception.BmobException
|
||||||
import cn.bmob.v3.listener.FindListener
|
import cn.bmob.v3.listener.FindListener
|
||||||
import cn.bmob.v3.listener.SaveListener
|
import cn.bmob.v3.listener.SaveListener
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||||
import kotlinx.android.synthetic.main.activity_main.view.*
|
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||||
@ -23,10 +24,9 @@ import java.io.InputStream
|
|||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|
||||||
class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Book_authorAdapter.ViewHolder>() {
|
class Book_authorAdapter(val authorworkList:List<AuthorWork>,val userId: String):RecyclerView.Adapter<Book_authorAdapter.ViewHolder>() {
|
||||||
lateinit var userId:String
|
|
||||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
val bookList_Image: ImageView = view.findViewById(R.id.book_Image1)
|
val workimg: ImageView = view.findViewById(R.id.authorwork_img)
|
||||||
val addButton:Button=view.findViewById(R.id.addButton)
|
val addButton:Button=view.findViewById(R.id.addButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,83 +35,48 @@ class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Boo
|
|||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val book = bookList[position]
|
val authorwork = authorworkList[position]
|
||||||
val query = BmobQuery<Book_bmob>()
|
Glide.with(holder.itemView.context)
|
||||||
query.addWhereEqualTo("name",book.name)
|
.load(authorwork.bookurl) // 确保你的Book对象有正确的图片URL
|
||||||
query.findObjects(object : FindListener<Book_bmob>() {
|
.placeholder(R.drawable.pre_load) // 可以设置一个占位图
|
||||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||||
if (p1 == null) {
|
.into(holder.workimg)
|
||||||
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`)
|
|
||||||
holder.bookList_Image.setImageBitmap(bitmap)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
val query1=BmobQuery<BookShelf>()
|
val query1=BmobQuery<BookShelf>()
|
||||||
query1.addWhereEqualTo("userid", userId)
|
query1.addWhereEqualTo("userid", userId)
|
||||||
query1.addWhereEqualTo("b_name",book.name)
|
query1.addWhereEqualTo("b_name",authorwork.book_name)
|
||||||
query1.findObjects(object :FindListener<BookShelf>() {
|
query1.findObjects(object :FindListener<BookShelf>() {
|
||||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||||
if (p1 == null) {
|
if (p1 == null) {
|
||||||
if (p0 != null && p0.size > 0) {
|
if (p0 != null && p0.size > 0) {
|
||||||
|
holder.addButton.isEnabled = false
|
||||||
holder.addButton.setText("已添加")
|
holder.addButton.setText("已添加")
|
||||||
}
|
}else{
|
||||||
}
|
holder.addButton.isEnabled = true
|
||||||
}
|
holder.addButton.setOnClickListener {
|
||||||
})
|
val bookshelf_record = BookShelf()
|
||||||
holder.bookList_Image.setOnClickListener {
|
bookshelf_record.setb_name(authorwork.book_name)
|
||||||
val intent= Intent(holder.itemView.context,BookInformationActivity::class.java)
|
|
||||||
intent.putExtra("Book_name",book.name)
|
|
||||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
|
||||||
}
|
|
||||||
holder.addButton.setOnClickListener{
|
|
||||||
// val intent = Intent(holder.itemView.context,BookShelfActivity::class.java)
|
|
||||||
// intent.putExtra("Book_name",book.name)
|
|
||||||
// ContextCompat.startActivity(holder.itemView.context,intent,null)
|
|
||||||
val query= BmobQuery<BookShelf>()
|
|
||||||
query.addWhereEqualTo("userid", userId)
|
|
||||||
query.addWhereEqualTo("b_name",book.name)
|
|
||||||
query.findObjects(object :FindListener<BookShelf>(){
|
|
||||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
|
||||||
if(p1==null){
|
|
||||||
if(p0!=null&&p0.size>0){
|
|
||||||
// Toast.makeText(author_introductionActivity, "11", Toast.LENGTH_SHORT)
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
val bookshelf_record=BookShelf()
|
|
||||||
bookshelf_record.setb_name(book.name)
|
|
||||||
bookshelf_record.setuserid(userId)
|
bookshelf_record.setuserid(userId)
|
||||||
|
bookshelf_record.setpicurl(authorwork.bookurl)
|
||||||
bookshelf_record.save(object : SaveListener<String>() {
|
bookshelf_record.save(object : SaveListener<String>() {
|
||||||
override fun done(objectId: String?, e: BmobException?) {
|
override fun done(objectId: String?, e: BmobException?) {
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
holder.addButton.text="已添加"
|
holder.addButton.isEnabled = false
|
||||||
|
holder.addButton.text = "已添加"
|
||||||
} else {
|
} else {
|
||||||
|
// 添加失败的处理
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
holder.workimg.setOnClickListener {
|
||||||
|
val intent= Intent(holder.itemView.context,BookInformationActivity::class.java)
|
||||||
|
intent.putExtra("Book_name",authorwork.book_name)
|
||||||
|
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun getItemCount() =bookList.size
|
override fun getItemCount() =authorworkList.size
|
||||||
}
|
}
|
@ -2,10 +2,6 @@ package com.zjgsu.jianshu
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.opengl.Visibility
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -14,201 +10,80 @@ import android.widget.ImageView
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import cn.bmob.v3.BmobQuery
|
import com.bumptech.glide.Glide
|
||||||
import cn.bmob.v3.exception.BmobException
|
|
||||||
import cn.bmob.v3.listener.FindListener
|
|
||||||
import java.io.InputStream
|
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
import android.widget.AdapterView.OnItemLongClickListener
|
|
||||||
import android.widget.AdapterView.VISIBLE
|
|
||||||
import android.widget.Toast
|
|
||||||
import android.view.View.OnLongClickListener
|
|
||||||
|
|
||||||
import android.widget.CompoundButton
|
//TODO:选中书本的时候书本封面变灰
|
||||||
|
class BookshelfAdapter(val context: Context, val bookshelf: ArrayList<Book_Shelf>) : RecyclerView.Adapter<BookshelfAdapter.ViewHolder>() {
|
||||||
|
private var isSelectMode: Boolean = false
|
||||||
|
val selectedItems = mutableSetOf<Int>() //当前选中的书本position列表
|
||||||
|
var onSelectionChanged: ((Int) -> Unit)? = null
|
||||||
|
|
||||||
import android.view.animation.Animation
|
|
||||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
|
||||||
|
|
||||||
|
|
||||||
class BookshelfAdapter(val context: Context, val bookshelf: ArrayList<Book_Shelf>) : RecyclerView.Adapter<BookshelfAdapter.ViewHolder>(),
|
|
||||||
View.OnLongClickListener, View.OnClickListener {
|
|
||||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
val book_img: ImageView = view.findViewById(R.id.bookshelf_bkimg)
|
val bookshelfBkimg: ImageView = view.findViewById(R.id.bookshelf_bkimg)
|
||||||
val book_name: TextView = view.findViewById(R.id.bookshelf_bkname)
|
val bookshelfSelectIcon: ImageView = view.findViewById(R.id.bookshelf_select_icon)
|
||||||
// val mCheckBox: CheckBox = view.findViewById(R.id.bookshelf_checkBox)
|
val bookshelfBkname: TextView = view.findViewById(R.id.bookshelf_bkname)
|
||||||
}
|
|
||||||
private var onItemClickListener: RecyclerViewOnItemClickListener? = null
|
|
||||||
private var isshowBox: Boolean = false
|
|
||||||
private val map: MutableMap<Int, Boolean?> = HashMap()
|
|
||||||
private var flag: Boolean = false
|
|
||||||
fun initMap() {
|
|
||||||
for (i in bookshelf.indices) {
|
|
||||||
map[i] = false
|
|
||||||
}
|
|
||||||
Log.d("initmap", "no")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setSelectItem(position: Int) {
|
|
||||||
//对当前状态取反
|
|
||||||
if (map[position]!!) {
|
|
||||||
map[position] = false
|
|
||||||
} else {
|
|
||||||
map[position] = true
|
|
||||||
}
|
|
||||||
notifyItemChanged(position)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setShowBox() {
|
|
||||||
//取反
|
|
||||||
isshowBox = !isshowBox
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getMap(): Map<Int, Boolean?> {
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
// fun setOnItemLongClickListener(onItemLongClickListener: RecyclerViewOnItemLongClickListener) {
|
|
||||||
// this.onItemLongClickListener = onItemLongClickListener;
|
|
||||||
// }
|
|
||||||
// interface RecyclerViewOnItemClickListener {
|
|
||||||
// fun onItemClickListener(view: View?, position: Int)
|
|
||||||
// }
|
|
||||||
// interface RecyclerViewOnItemLongClickListener {
|
|
||||||
// fun onItemLongClickListener(view: View, position: Int): Boolean;
|
|
||||||
// }
|
|
||||||
interface RecyclerViewOnItemClickListener {
|
|
||||||
//点击事件
|
|
||||||
fun onItemClickListener(view: View?, position: Int)
|
|
||||||
|
|
||||||
//长按事件
|
|
||||||
fun onItemLongClickListener(view: View?, position: Int): Boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setRecyclerViewOnItemClickListener(onItemClickListener: RecyclerViewOnItemClickListener?) {
|
|
||||||
this.onItemClickListener = onItemClickListener
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClick(v: View) {
|
|
||||||
if (onItemClickListener != null) {
|
|
||||||
//注意这里使用getTag方法获取数据
|
|
||||||
onItemClickListener!!.onItemClickListener(v, v.tag as Int)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLongClick(v: View): Boolean {
|
|
||||||
initMap()
|
|
||||||
return onItemClickListener != null && onItemClickListener!!.onItemLongClickListener(
|
|
||||||
v,
|
|
||||||
(v.tag as Int)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.bookshelf_item, parent, false)
|
val view = LayoutInflater.from(context).inflate(R.layout.bookshelf_item, parent, false)
|
||||||
view.setOnLongClickListener(this)
|
|
||||||
view.setOnClickListener(this)
|
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
// Log.d("check", isshowBox.toString())
|
|
||||||
// if (isshowBox) {
|
|
||||||
// holder.mCheckBox.visibility = VISIBLE
|
|
||||||
// } else {
|
|
||||||
// holder.mCheckBox.visibility = View.INVISIBLE
|
|
||||||
// }
|
|
||||||
// holder.mCheckBox.setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener { buttonView, isChecked -> //用map集合保存
|
|
||||||
// map[position] = isChecked
|
|
||||||
// })
|
|
||||||
// 设置CheckBox的状态
|
|
||||||
if (map[position] == null) {
|
|
||||||
map[position] = false
|
|
||||||
}
|
|
||||||
// holder.mCheckBox.isChecked = map[position]!!
|
|
||||||
// holder.itemView.setOnClickListener{
|
|
||||||
// if(!flag){
|
|
||||||
// holder.mCheckBox.visibility=View.VISIBLE
|
|
||||||
// flag=true
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// holder.mCheckBox.visibility=View.INVISIBLE
|
|
||||||
// flag=false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
val book = bookshelf[position]
|
val book = bookshelf[position]
|
||||||
// if (holder is ViewHolder) {
|
holder.bookshelfBkname.text = book.bkname
|
||||||
// val viewHolder: ViewHolder = holder
|
|
||||||
// if (selected == position) {
|
|
||||||
// viewHolder.mCheckBox.setChecked(true)
|
|
||||||
// viewHolder.itemView.setSelected(true)
|
|
||||||
// } else {
|
|
||||||
// viewHolder.mCheckBox.setChecked(false)
|
|
||||||
// viewHolder.itemView.setSelected(false)
|
|
||||||
// }
|
|
||||||
// if (onItemClickListener != null) {
|
|
||||||
// viewHolder.itemView.setOnClickListener(View.OnClickListener {
|
|
||||||
// onItemClickListener!!.onItemClickListener(
|
|
||||||
// viewHolder.itemView,
|
|
||||||
// viewHolder.adapterPosition
|
|
||||||
// )
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
var flag: Boolean = false
|
|
||||||
holder.book_img.setTag("1")
|
|
||||||
if (book.bkname.equals("添加")) {
|
|
||||||
holder.book_img.scaleType = ImageView.ScaleType.CENTER_INSIDE
|
|
||||||
holder.book_img.setImageResource(R.drawable.add)
|
|
||||||
flag = true
|
|
||||||
}
|
|
||||||
holder.book_name.text = book.bkname
|
|
||||||
val query = BmobQuery<Book_bmob>()
|
|
||||||
query.addWhereEqualTo("name", book.bkname)
|
|
||||||
query.findObjects(object : FindListener<Book_bmob>() {
|
|
||||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
|
||||||
if (p1 == null) {
|
|
||||||
if (p0 != null && p0.size > 0) {
|
|
||||||
for (p in p0) {
|
|
||||||
object : Thread() {
|
|
||||||
override fun run() {
|
|
||||||
try {
|
|
||||||
if (flag) {
|
|
||||||
|
|
||||||
} else {
|
if (book.bkname.equals("添加")) {
|
||||||
holder.book_img.setTag("0")
|
holder.bookshelfBkimg.scaleType = ImageView.ScaleType.CENTER_INSIDE
|
||||||
val url = URL(p!!.picture.url)
|
holder.bookshelfBkimg.setImageResource(R.drawable.add)
|
||||||
val connection: HttpURLConnection =
|
holder.bookshelfSelectIcon.visibility = View.GONE
|
||||||
url.openConnection() as HttpURLConnection
|
} else {
|
||||||
connection.setRequestMethod("GET")
|
holder.bookshelfSelectIcon.visibility = if (isSelectMode) View.VISIBLE else View.GONE
|
||||||
connection.setConnectTimeout(5000)
|
holder.bookshelfSelectIcon.setImageResource(if (selectedItems.contains(position)) R.drawable.selected else R.drawable.select)
|
||||||
val `in`: InputStream = connection.getInputStream()
|
Glide.with(holder.itemView.context)
|
||||||
val bitmap: Bitmap = BitmapFactory.decodeStream(`in`)
|
.load(book.picurl)
|
||||||
holder.book_img.setImageBitmap(bitmap)
|
.placeholder(R.drawable.pre_load)
|
||||||
}
|
.error(R.drawable.fail_load)
|
||||||
} catch (e: Exception) {
|
.into(holder.bookshelfBkimg)
|
||||||
e.printStackTrace()
|
}
|
||||||
}
|
|
||||||
}
|
holder.bookshelfSelectIcon.setOnClickListener { //选择or取消
|
||||||
}.start()
|
toggleSelection(position)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
holder.bookshelfBkimg.setOnClickListener {
|
||||||
}
|
if (book.bkname.equals("添加")) {
|
||||||
})
|
|
||||||
holder.book_img.setOnClickListener {
|
|
||||||
val res = holder.book_img.getTag()
|
|
||||||
if (res == "0") {
|
|
||||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
|
||||||
intent.putExtra("Book_name", book.bkname)
|
|
||||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
|
||||||
} else {
|
|
||||||
val intent = Intent(context, MainActivity::class.java)
|
val intent = Intent(context, MainActivity::class.java)
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
|
} else {
|
||||||
|
if (isSelectMode) {
|
||||||
|
toggleSelection(position)
|
||||||
|
} else {
|
||||||
|
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||||
|
intent.putExtra("Book_name", book.bkname)
|
||||||
|
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount() = bookshelf.size
|
override fun getItemCount() = bookshelf.size
|
||||||
}
|
|
||||||
|
|
||||||
|
fun toggleSelectMode() {
|
||||||
|
isSelectMode = !isSelectMode
|
||||||
|
if (!isSelectMode) {
|
||||||
|
selectedItems.clear()
|
||||||
|
onSelectionChanged?.invoke(selectedItems.size)
|
||||||
|
}
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
private fun toggleSelection(position: Int) {
|
||||||
|
if (selectedItems.contains(position)) {
|
||||||
|
selectedItems.remove(position)
|
||||||
|
} else {
|
||||||
|
selectedItems.add(position)
|
||||||
|
}
|
||||||
|
notifyItemChanged(position)
|
||||||
|
onSelectionChanged?.invoke(selectedItems.size)
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ import cn.bmob.v3.BmobQuery
|
|||||||
import cn.bmob.v3.exception.BmobException
|
import cn.bmob.v3.exception.BmobException
|
||||||
import cn.bmob.v3.listener.FindListener
|
import cn.bmob.v3.listener.FindListener
|
||||||
import cn.bmob.v3.listener.SaveListener
|
import cn.bmob.v3.listener.SaveListener
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
||||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||||
@ -25,73 +26,25 @@ import java.io.InputStream
|
|||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
lateinit var selectedBook:String
|
lateinit var selectedBook:String
|
||||||
class send_perceptionAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<send_perceptionAdapter.ViewHolder>() {
|
class send_perceptionAdapter(val bookList:List<Book_Shelf>):RecyclerView.Adapter<send_perceptionAdapter.ViewHolder>() {
|
||||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||||
val book_Image: ImageView = view.findViewById(R.id.book_Image2)
|
val book_Image: ImageView = view.findViewById(R.id.send_bookimg)
|
||||||
val book_Name: TextView = view.findViewById(R.id.book_name)
|
val book_Name: TextView = view.findViewById(R.id.send_bookname)
|
||||||
val background: LinearLayout = view.findViewById(R.id.bookpic_background)
|
val background: LinearLayout = view.findViewById(R.id.bookpic_background)
|
||||||
}
|
}
|
||||||
private val map: MutableMap<Int, Boolean?> = HashMap()
|
private val map: MutableMap<Int, Boolean?> = HashMap()
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.bookpic_item, parent, false)
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.bookpic_item, parent, false)
|
||||||
// val viewHolder=ViewHolder(view)
|
|
||||||
// viewHolder.book_Image.setOnClickListener {
|
|
||||||
// val position=viewHolder.adapterPosition
|
|
||||||
// val book=bookList[position]
|
|
||||||
// var cnt=0
|
|
||||||
// for (i in map){
|
|
||||||
// if(i.value==true)
|
|
||||||
// cnt++
|
|
||||||
// }
|
|
||||||
// if(cnt==0) {
|
|
||||||
// if (map[position] == false) {
|
|
||||||
// map[position] = true
|
|
||||||
// viewHolder.background.setBackgroundColor(Color.CYAN)
|
|
||||||
// selectedBook = book.name
|
|
||||||
// } else {
|
|
||||||
// map[position] = false
|
|
||||||
// viewHolder.background.setBackgroundColor(Color.WHITE)
|
|
||||||
// selectedBook = ""
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// Toast.makeText(parent.context,"只能选择一本书!",Toast.LENGTH_SHORT).show()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val book = bookList[position]
|
val book = bookList[position]
|
||||||
val query = BmobQuery<Book_bmob>()
|
Glide.with(holder.itemView.context)
|
||||||
query.addWhereEqualTo("name",book.name)
|
.load(book.picurl) // 确保你的Book对象有正确的图片URL
|
||||||
query.findObjects(object : FindListener<Book_bmob>() {
|
.placeholder(R.drawable.pre_load) // 可以设置一个占位图
|
||||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
.error(R.drawable.fail_load) // 设置加载失败的图
|
||||||
if (p1 == null) {
|
.into(holder.book_Image)
|
||||||
if (p0 != null && p0.size > 0) {
|
holder.book_Name.text=book.bkname
|
||||||
for (p in p0) {
|
|
||||||
holder.book_Name.text=p.name
|
|
||||||
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`)
|
|
||||||
holder.book_Image.setImageBitmap(bitmap)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
holder.book_Image.setOnClickListener {
|
holder.book_Image.setOnClickListener {
|
||||||
var cnt=0
|
var cnt=0
|
||||||
for (i in map){
|
for (i in map){
|
||||||
@ -101,7 +54,7 @@ class send_perceptionAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter
|
|||||||
if(cnt==0) {
|
if(cnt==0) {
|
||||||
map[position]=true
|
map[position]=true
|
||||||
holder.background.setBackgroundColor(Color.CYAN)
|
holder.background.setBackgroundColor(Color.CYAN)
|
||||||
selectedBook = book.name
|
selectedBook = book.bkname
|
||||||
}
|
}
|
||||||
else if(cnt==1){
|
else if(cnt==1){
|
||||||
if (map[position] == true){
|
if (map[position] == true){
|
||||||
@ -113,7 +66,6 @@ class send_perceptionAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
app/src/main/java/com/zjgsu/jianshu/Bmob/Author_bmob.kt
Normal file
10
app/src/main/java/com/zjgsu/jianshu/Bmob/Author_bmob.kt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.zjgsu.jianshu.Bmob
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobObject
|
||||||
|
import cn.bmob.v3.datatype.BmobFile
|
||||||
|
|
||||||
|
class Author_bmob:BmobObject() {
|
||||||
|
val picture:BmobFile=BmobFile()
|
||||||
|
val author_introduce:String=""
|
||||||
|
val author_name:String=""
|
||||||
|
}
|
@ -5,10 +5,14 @@ import cn.bmob.v3.BmobObject
|
|||||||
class BookShelf:BmobObject(){
|
class BookShelf:BmobObject(){
|
||||||
var b_name:String = ""
|
var b_name:String = ""
|
||||||
var userid:String=""
|
var userid:String=""
|
||||||
|
var picurl:String=""
|
||||||
fun setb_name(bookname: String){
|
fun setb_name(bookname: String){
|
||||||
this.b_name=bookname
|
this.b_name=bookname
|
||||||
}
|
}
|
||||||
fun setuserid(uid: String){
|
fun setuserid(uid: String){
|
||||||
this.userid=uid
|
this.userid=uid
|
||||||
}
|
}
|
||||||
|
fun setpicurl(picurl:String){
|
||||||
|
this.picurl=picurl
|
||||||
|
}
|
||||||
}
|
}
|
@ -15,6 +15,7 @@ class Book_info_bmob:BmobObject(){
|
|||||||
var tuijian:Int=0
|
var tuijian:Int=0
|
||||||
var buxing:Int=0
|
var buxing:Int=0
|
||||||
var countOfReaders:Int=0
|
var countOfReaders:Int=0
|
||||||
|
var authorid:String=""
|
||||||
fun settuijian(tuijian1: Int){
|
fun settuijian(tuijian1: Int){
|
||||||
this.tuijian=tuijian1
|
this.tuijian=tuijian1
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
package com.zjgsu.jianshu
|
package com.zjgsu.jianshu
|
||||||
|
|
||||||
class BookAuthor(val name:String,val author_name:String)
|
class AuthorWork(val book_name:String,val author_name:String,val bookurl:String)
|
@ -2,4 +2,4 @@ package com.zjgsu.jianshu
|
|||||||
|
|
||||||
import cn.bmob.v3.datatype.BmobFile
|
import cn.bmob.v3.datatype.BmobFile
|
||||||
|
|
||||||
class Book_Shelf(val bkname:String)
|
class Book_Shelf(val bkname:String,val picurl:String)
|
BIN
app/src/main/res/drawable/remove.png
Normal file
BIN
app/src/main/res/drawable/remove.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 977 B |
BIN
app/src/main/res/drawable/select.png
Normal file
BIN
app/src/main/res/drawable/select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 545 B |
BIN
app/src/main/res/drawable/selected.png
Normal file
BIN
app/src/main/res/drawable/selected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 564 B |
@ -1,18 +1,40 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".author_introductionActivity">
|
tools:context=".Author_introductionActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/author_back"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:src="@drawable/return1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/page_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="作者简介"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -20,80 +42,72 @@
|
|||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
<LinearLayout
|
android:id="@+id/author_img"
|
||||||
android:layout_width="250dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="180dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/author_img"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
tools:srcCompat="@tools:sample/avatars" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/book_authorname1"
|
android:id="@+id/book_authorname1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="50dp"
|
android:gravity="start"
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="作者"
|
android:text="作者"
|
||||||
android:textSize="20dp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="30dp"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:textSize="15dp"
|
android:text="简介"
|
||||||
android:textStyle="italic"
|
android:textSize="15sp"
|
||||||
android:text="简介">
|
android:textStyle="italic" />
|
||||||
</TextView>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_alignParentTop="true">
|
|
||||||
|
|
||||||
<include layout="@layout/expandable" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/author_intro"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:textSize="15dp"
|
android:text="详情:1111111111111111"
|
||||||
android:textStyle="italic"
|
android:textSize="15sp"
|
||||||
android:text="作品">
|
android:textStyle="italic" />
|
||||||
</TextView>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="作品"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textStyle="italic" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView1"
|
android:id="@+id/authorwork_recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
|
||||||
|
</ScrollView>
|
@ -5,38 +5,149 @@
|
|||||||
android:id="@+id/drawerLayout_bookshelf"
|
android:id="@+id/drawerLayout_bookshelf"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
<LinearLayout
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/default_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
<!-- SwipeRefreshLayout 包裹的 RecyclerView -->
|
android:orientation="horizontal"
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
android:gravity="center_vertical">
|
||||||
android:id="@+id/swipeRefresh2"
|
<TextView
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/layout_bottom_navigation"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:background="@drawable/wenli">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerView2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
||||||
|
|
||||||
<!-- 底部导航栏 -->
|
|
||||||
<include
|
|
||||||
android:id="@+id/layout_bottom_navigation"
|
|
||||||
layout="@layout/layout_bottom_navigation"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_weight="1"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
android:text="书架"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
android:layout_marginStart="10dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
app:srcCompat="@drawable/select" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bookshelf_select"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:text="选择"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<LinearLayout
|
||||||
|
android:id="@+id/selected_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/select_all"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:text="全选"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/select_books"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="选择书籍"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bookshelf_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:text="取消"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</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" />
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- SwipeRefreshLayout 包裹的 RecyclerView -->
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/bookshelf_swipeRefresh"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bookshelf_layout_bottom_navigation"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/bookshelf_recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<!-- 底部导航栏 -->
|
||||||
|
<include
|
||||||
|
android:id="@+id/bookshelf_layout_bottom_navigation"
|
||||||
|
layout="@layout/layout_bottom_navigation"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/selected_bottom_navigation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="#EEEEEE">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
app:srcCompat="@drawable/remove" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/removeFromBookshelf"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="移除书架"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:onClick="onRemoveFromBookshelfClicked" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
|
@ -50,8 +50,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_marginLeft="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="65dp"
|
||||||
android:text="简书榜单"
|
android:text="一周好书榜"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
@ -7,13 +7,11 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/delete"
|
android:id="@+id/send_return"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
android:background="@drawable/delete"
|
android:background="@drawable/return1" />
|
||||||
android:text="Back"
|
|
||||||
android:textColor="#fff" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView7"
|
android:id="@+id/textView7"
|
||||||
@ -43,7 +41,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/touxiang"
|
android:id="@+id/send_avatar"
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="37dp"
|
android:layout_height="37dp"
|
||||||
tools:srcCompat="@tools:sample/avatars" />
|
tools:srcCompat="@tools:sample/avatars" />
|
||||||
|
@ -8,10 +8,11 @@
|
|||||||
android:layout_margin="2dp">
|
android:layout_margin="2dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/book_Image1"
|
android:id="@+id/authorwork_img"
|
||||||
android:layout_width="135dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="180dp"
|
android:layout_height="160dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
android:layout_marginLeft="10dp" />
|
android:layout_marginLeft="10dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -30,7 +31,5 @@
|
|||||||
android:textSize="13dp"
|
android:textSize="13dp"
|
||||||
app:srcCompat="@drawable/addtobookshelf"
|
app:srcCompat="@drawable/addtobookshelf"
|
||||||
tools:ignore="TouchTargetSizeCheck" />
|
tools:ignore="TouchTargetSizeCheck" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -9,7 +9,7 @@
|
|||||||
android:layout_margin="2dp">
|
android:layout_margin="2dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/book_Image2"
|
android:id="@+id/send_bookimg"
|
||||||
android:layout_width="120dp"
|
android:layout_width="120dp"
|
||||||
android:layout_height="160dp"
|
android:layout_height="160dp"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
@ -23,7 +23,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/book_name"
|
android:id="@+id/send_bookname"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
@ -6,37 +6,41 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
app:cardCornerRadius="4dp">
|
app:cardCornerRadius="4dp">
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<!-- <CheckBox-->
|
|
||||||
<!-- android:id="@+id/bookshelf_checkBox"-->
|
|
||||||
<!-- android:layout_width="match_parent"-->
|
|
||||||
<!-- android:layout_height="30dp"-->
|
|
||||||
<!-- android:focusableInTouchMode="false"-->
|
|
||||||
<!-- android:visibility="invisible"-->
|
|
||||||
<!-- android:gravity="center" />-->
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/bookshelf_bkimg"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="180dp"
|
|
||||||
android:scaleType="centerCrop"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal"></LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/bookshelf_bkname"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:orientation="vertical">
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:textSize="16sp"/>
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="180dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/bookshelf_bkimg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/bookshelf_select_icon"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:src="@drawable/select"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bookshelf_bkname"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
46
app/src/main/res/layout/delete_dialog.xml
Normal file
46
app/src/main/res/layout/delete_dialog.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?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:id="@+id/dialog_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="是否移除书架?"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dialog_message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="您确定要将该书移出书架吗?"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/dialog_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="取消" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/dialog_remove"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:text="移除" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/recyclerView100"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
Loading…
x
Reference in New Issue
Block a user