2024.5.12基本AI功能基本完善,但是非流式回答
This commit is contained in:
parent
33828f0d38
commit
cb924f28b9
@ -24,18 +24,18 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Jianshu"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".GoodBookActivity" />
|
||||
<activity android:name=".HotBookActivity" />
|
||||
<activity android:name=".BookInformationActivity" />
|
||||
<activity android:name=".PerceptionActivity" />
|
||||
<activity android:name=".FindpwdActivity" />
|
||||
<activity android:name=".LiteratureActivity" />
|
||||
<activity android:name=".PsychologyActivity" />
|
||||
<activity android:name=".ManagementActivity" />
|
||||
<activity android:name=".PhilosophyActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.GoodBookActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.HotBookActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.BookInformationActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.PerceptionActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.FindpwdActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.LiteratureActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.PsychologyActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ManagementActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.PhilosophyActivity" />
|
||||
<!-- <activity android:name=".BookShelfActivity"/>-->
|
||||
<activity android:name=".ScienceActivity" />
|
||||
<activity android:name=".Author_introductionActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ScienceActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.Author_introductionActivity" />
|
||||
<!-- <activity android:name=".MainActivity"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- android:label="@string/app_name"-->
|
||||
@ -46,26 +46,27 @@
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<activity android:name=".SendSpecificActivity" />
|
||||
<activity android:name=".BookIntroActivity" />
|
||||
<activity android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation" />
|
||||
<activity android:name=".RegisterActivity" />
|
||||
<activity android:name=".BookShelfActivity" />
|
||||
<activity android:name=".Activity.Perception_informationActivity" />
|
||||
<activity android:name=".Activity.sendPerceptionActivity" />
|
||||
<activity android:name=".MyActivity" />
|
||||
<activity android:name=".Activity.MyPostActivity" />
|
||||
<activity android:name=".ReEmailActivity" />
|
||||
<activity android:name=".RePhoneActivity" />
|
||||
<activity android:name=".ReMyinfoActivity" />
|
||||
<activity android:name=".ReNameActivity" />
|
||||
<activity android:name=".ReSexActivity" />
|
||||
<activity android:name=".ReSignatureActivity" />
|
||||
<activity android:name=".Activity.AccountManagerActivity" />
|
||||
<activity android:name=".ReAddressActivity"/>
|
||||
<activity android:name="com.zjgsu.jianshu.SendSpecificActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.BookIntroActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.MainActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
||||
/>
|
||||
<activity android:name="com.zjgsu.jianshu.RegisterActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.BookShelfActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.Activity.Perception_informationActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.Activity.sendPerceptionActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.MyActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.Activity.MyPostActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReEmailActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.RePhoneActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReMyinfoActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReNameActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReSexActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReSignatureActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.Activity.AccountManagerActivity" />
|
||||
<activity android:name="com.zjgsu.jianshu.ReAddressActivity"/>
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:name="com.zjgsu.jianshu.LoginActivity"
|
||||
android:exported="true"
|
||||
android:label="Jianshu">
|
||||
<intent-filter>
|
||||
|
@ -1,11 +1,9 @@
|
||||
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
|
||||
@ -15,7 +13,6 @@ 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>()
|
||||
|
@ -7,7 +7,6 @@ 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.view.View
|
||||
import android.widget.Button
|
||||
@ -26,7 +25,6 @@ import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Bookcontent_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
import kotlinx.android.synthetic.main.bookinfo_title.*
|
||||
import okhttp3.*
|
||||
import java.io.File
|
||||
|
@ -8,8 +8,6 @@ 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.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.*
|
||||
|
@ -1,11 +1,8 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -16,23 +13,9 @@ import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import kotlinx.android.synthetic.main.activity_bookshelf.*
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_perception.*
|
||||
import kotlinx.android.synthetic.main.bookshelf_item.*
|
||||
import kotlinx.android.synthetic.main.expandable.*
|
||||
import kotlin.concurrent.thread
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.OnLongClickListener
|
||||
|
||||
import android.view.ViewGroup
|
||||
|
||||
import android.widget.TextView
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.MotionEvent
|
||||
import android.view.View.OnTouchListener
|
||||
import android.widget.Button
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
|
@ -3,8 +3,6 @@ package com.zjgsu.jianshu
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
@ -17,58 +15,64 @@ import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.*
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.image_findpwd_backtoLogin
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class FindpwdActivity:AppCompatActivity() {
|
||||
private var msg:String=""
|
||||
class FindpwdActivity : AppCompatActivity() {
|
||||
private var msg: String = ""
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_findpwd)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
image_findpwd_backtoLogin.setOnClickListener{
|
||||
val intent=Intent(this,LoginActivity::class.java)
|
||||
image_findpwd_backtoLogin.setOnClickListener {
|
||||
val intent = Intent(this, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
inits()
|
||||
}
|
||||
private val click2 = DialogInterface.OnClickListener { arg0, arg1 -> arg0.cancel()
|
||||
val intent=Intent(this,LoginActivity::class.java)
|
||||
|
||||
private val click2 = DialogInterface.OnClickListener { arg0, arg1 ->
|
||||
arg0.cancel()
|
||||
val intent = Intent(this, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
public fun showdialog(view:View){
|
||||
val alertdialog:AlertDialog.Builder=AlertDialog.Builder(this)
|
||||
|
||||
public fun showdialog(view: View) {
|
||||
val alertdialog: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||
alertdialog.setMessage(msg)
|
||||
alertdialog.setNegativeButton("确认", click2);
|
||||
val alertdialog1:AlertDialog=alertdialog.create();
|
||||
val alertdialog1: AlertDialog = alertdialog.create();
|
||||
alertdialog1.show();
|
||||
}
|
||||
public fun inits(){
|
||||
bt_find_nextstep.setOnClickListener{
|
||||
var flag:Boolean=false
|
||||
|
||||
public fun inits() {
|
||||
bt_find_nextstep.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_find_account.text.toString()
|
||||
val user_email:String=et_find_mail.text.toString()
|
||||
if(user_account.isEmpty()||user_email.isEmpty()) {
|
||||
val user_email: String = et_find_mail.text.toString()
|
||||
if (user_account.isEmpty() || user_email.isEmpty()) {
|
||||
Toast.makeText(this, "账号或邮箱不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy",user_account)
|
||||
}
|
||||
else{
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd:String=""
|
||||
bmobQuery.findObjects(object :FindListener<User_bmob>(){
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)&&user_email.equals(i.email)) {
|
||||
if (user_account.equals(i.account) && user_email.equals(i.email)) {
|
||||
flag = true
|
||||
tempPwd=i.password
|
||||
msg="您的密码为: "+tempPwd
|
||||
tempPwd = i.password
|
||||
msg = "您的密码为: " + tempPwd
|
||||
showdialog(bt_find_nextstep)
|
||||
}
|
||||
}
|
||||
if(flag!=true)
|
||||
Toast.makeText(this@FindpwdActivity,"账号不存在,请重新输入!",Toast.LENGTH_SHORT).show()
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@FindpwdActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -12,10 +11,6 @@ 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() {
|
||||
|
@ -1,24 +1,16 @@
|
||||
package com.zjgsu.jianshu
|
||||
import android.content.Context
|
||||
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
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
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.*
|
||||
import com.zjgsu.jianshu.Adapter.BillboardAdapter
|
||||
import com.zjgsu.jianshu.Adapter.BookRankAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import kotlinx.android.synthetic.main.activity_bookrank.*
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
|
||||
class HotBookActivity: AppCompatActivity() {
|
||||
private var hotbookList=ArrayList<Book_rank>()
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.SearchView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -83,6 +84,7 @@ class MainActivity : AppCompatActivity() {
|
||||
setupBottomNavigation()
|
||||
}
|
||||
|
||||
|
||||
private fun loadBooks() {
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.zjgsu.jianshu.Activity;
|
||||
import android.app.Activity;
|
||||
import android.app.LocalActivityManager;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
@ -9,11 +8,9 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import com.zjgsu.jianshu.R;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
@ -6,7 +6,6 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
@ -14,7 +13,6 @@ import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Activity.AccountManagerActivity
|
||||
import com.zjgsu.jianshu.Activity.MyPostActivity
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_my.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import java.io.InputStream
|
||||
|
@ -1,22 +1,18 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
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.Activity.sendPerceptionActivity
|
||||
import com.zjgsu.jianshu.Adapter.GoodperceptionAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_perception.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class PerceptionActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
|
@ -1,18 +1,14 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.R.attr
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.view.menu.MenuAdapter
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import kotlinx.android.synthetic.main.activity_my.*
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import android.R.attr.data
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
|
||||
|
||||
|
@ -10,11 +10,8 @@ import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.*
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.back2my
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class ReNameActivity : AppCompatActivity() {
|
||||
|
||||
|
@ -4,15 +4,12 @@ import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.*
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.back2my
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.btnOk
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.et_account
|
||||
|
@ -11,7 +11,6 @@ import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
|
||||
class ReSignatureActivity : AppCompatActivity() {
|
||||
|
@ -9,11 +9,8 @@ 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 cn.bmob.v3.listener.SaveListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class RegisterActivity : AppCompatActivity() {
|
||||
|
@ -9,14 +9,9 @@ import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Book_Shelf
|
||||
import com.zjgsu.jianshu.R
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
|
||||
class SendSpecificActivity: AppCompatActivity() {
|
||||
|
@ -2,8 +2,6 @@ package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
@ -22,12 +20,7 @@ import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_sendperception.*
|
||||
import kotlinx.android.synthetic.main.activity_sendspecific.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class sendPerceptionActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book_Shelf>()
|
||||
@ -51,8 +44,8 @@ class sendPerceptionActivity:AppCompatActivity() {
|
||||
send_recyclerview.adapter = adapter
|
||||
inits()
|
||||
send_return.setOnClickListener {
|
||||
val intent= Intent(this,PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
// val intent= Intent(this,PerceptionActivity::class.java)
|
||||
// startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
submit.setOnClickListener {
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.transition.Transition
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -12,12 +8,8 @@ import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.zjgsu.jianshu.*
|
||||
|
||||
class BillboardAdapter(var listOfbookRankList: List<List<Book_rank>>) : RecyclerView.Adapter<BillboardAdapter.ViewHolder>() {
|
||||
|
@ -1,9 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -12,14 +9,7 @@ import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class BookAdapter(var bookList: List<Book>) : RecyclerView.Adapter<BookAdapter.ViewHolder>() {
|
||||
|
@ -1,29 +1,16 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.ActivityChooserView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class BookAdapter2(val bookList: List<Book>,val categoryId:Int) : RecyclerView.Adapter<BookAdapter2.ViewHolder>() {
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.media.Image
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -20,9 +19,13 @@ import cn.bmob.v3.listener.SaveListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import kotlinx.android.synthetic.main.bookinfo_title.*
|
||||
|
||||
class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>, val isHotList: Boolean, val userId: String) :
|
||||
class BookRankAdapter(
|
||||
private val context: Context,
|
||||
var bookList: List<Book_rank>,
|
||||
val isHotList: Boolean,
|
||||
val userId: String
|
||||
) :
|
||||
RecyclerView.Adapter<BookRankAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookrank_pic: ImageView = view.findViewById(R.id.bookrank_pic)
|
||||
@ -34,7 +37,7 @@ class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>
|
||||
val bookrank_author: TextView = view.findViewById(R.id.bookrank_author)
|
||||
val bookrank_icon: ImageView = view.findViewById(R.id.bookrank_icon)
|
||||
val bookrank_addbook: ImageView = view.findViewById(R.id.bookrank_addbook)
|
||||
val bookrank_add:TextView=view.findViewById(R.id.bookrank_add)
|
||||
val bookrank_add: TextView = view.findViewById(R.id.bookrank_add)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
@ -47,6 +50,9 @@ class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>
|
||||
val book = bookList[position]
|
||||
holder.bookrank_name.text = book.name
|
||||
holder.bookrank_intro.text = book.intro
|
||||
// 设置默认状态
|
||||
holder.bookrank_addbook.setImageResource(R.drawable.addbook)
|
||||
holder.bookrank_add.text = "加入书架"
|
||||
val backgrounds = arrayOf(
|
||||
R.drawable.color_lightpurple, R.drawable.color_lightblue,
|
||||
R.drawable.color_lightgreen, R.drawable.color_flesh
|
||||
@ -83,7 +89,7 @@ class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>
|
||||
holder.outerLinearLayout.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, BookInformationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
if(isHotList)
|
||||
if (isHotList)
|
||||
intent.putExtra("Source_Activity", HotBookActivity::class.java)
|
||||
else
|
||||
intent.putExtra("Source_Activity", GoodBookActivity::class.java)
|
||||
@ -103,7 +109,8 @@ class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>
|
||||
bookshelfRecord.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, saveException: BmobException?) {
|
||||
if (saveException == null) {
|
||||
holder.bookrank_addbook.setImageResource(R.drawable.bookshelf2)
|
||||
holder.bookrank_addbook.setImageResource(R.drawable.alreadyin)
|
||||
holder.bookrank_add.text = "已加入"
|
||||
Toast.makeText(
|
||||
context,
|
||||
"添加成功",
|
||||
@ -124,20 +131,17 @@ class BookRankAdapter(private val context: Context,var bookList: List<Book_rank>
|
||||
}
|
||||
})
|
||||
}
|
||||
fun judgeInBookshelf() {
|
||||
val queryBookshelf = BmobQuery<BookShelf>()
|
||||
queryBookshelf.addWhereEqualTo("userid", userId)
|
||||
queryBookshelf.addWhereEqualTo("b_name", book.name)
|
||||
queryBookshelf.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(bookshelfItems: MutableList<BookShelf>?, e: BmobException?) {
|
||||
if (e == null && bookshelfItems != null && bookshelfItems.isNotEmpty()) {
|
||||
holder.bookrank_addbook.setImageResource(R.drawable.alreadyin)
|
||||
holder.bookrank_add.text="已加入"
|
||||
}
|
||||
val queryBookshelf = BmobQuery<BookShelf>()
|
||||
queryBookshelf.addWhereEqualTo("userid", userId)
|
||||
queryBookshelf.addWhereEqualTo("b_name", book.name)
|
||||
queryBookshelf.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(bookshelfItems: MutableList<BookShelf>?, e: BmobException?) {
|
||||
if (e == null && bookshelfItems != null && bookshelfItems.isNotEmpty()) {
|
||||
holder.bookrank_addbook.setImageResource(R.drawable.alreadyin)
|
||||
holder.bookrank_add.text = "已加入"
|
||||
}
|
||||
})
|
||||
}
|
||||
judgeInBookshelf()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun getItemCount() = bookList.size
|
||||
|
@ -1,14 +1,10 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
@ -17,12 +13,6 @@ import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||
import kotlinx.android.synthetic.main.book_author_item.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class Book_authorAdapter(val authorworkList:List<AuthorWork>,val userId: String):RecyclerView.Adapter<Book_authorAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
@ -5,7 +5,6 @@ import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
|
@ -6,7 +6,6 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -15,7 +14,6 @@ import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Comment_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import com.zjgsu.jianshu.Book_authorAdapter
|
||||
import com.zjgsu.jianshu.Comment
|
||||
import com.zjgsu.jianshu.R
|
||||
import java.io.InputStream
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import com.zjgsu.jianshu.Perception
|
||||
import com.zjgsu.jianshu.R
|
||||
import android.view.LayoutInflater
|
||||
@ -16,10 +14,6 @@ import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class GoodperceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<GoodperceptionAdapter.ViewHolder>() {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -19,9 +17,6 @@ import com.zjgsu.jianshu.Activity.Perception_informationActivity
|
||||
import com.zjgsu.jianshu.Bmob.Book_info_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class PerceptionAdapter(val perceptionList: List<Perception>) :
|
||||
|
@ -1,30 +1,13 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||
import kotlinx.android.synthetic.main.book_author_item.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
lateinit var selectedBook:String
|
||||
class send_perceptionAdapter(val bookList:List<Book_Shelf>):RecyclerView.Adapter<send_perceptionAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Book_Shelf(val bkname:String,val picurl:String)
|
@ -5,5 +5,5 @@ class Book_rank(var name: String,
|
||||
var score:String,
|
||||
var courtOfReaders:Int,
|
||||
var author:String,
|
||||
var intro:String
|
||||
var intro:String,
|
||||
)
|
@ -1,6 +1,5 @@
|
||||
package com.zjgsu.jianshu.Fragment
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -3,7 +3,6 @@ package com.zjgsu.jianshu;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
|
@ -2,7 +2,6 @@ package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
|
||||
object NavigationHelper {
|
||||
fun <T> navigateTo(activity: AppCompatActivity, destinationClass: Class<T>) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Perception(val perceptionid:String)
|
@ -3,7 +3,6 @@ package com.zjgsu.jianshu
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.widget.TextView
|
||||
import com.zjgsu.jianshu.R
|
||||
|
||||
class TypeView(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var textView: TextView
|
||||
|
@ -58,6 +58,10 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageV
|
||||
Message message = messages.get(position);
|
||||
if (message.getIsuser() == 1) { // user
|
||||
holder.textViewMessage.setText(message.getContent());
|
||||
if(message.getCite()!=""){
|
||||
holder.messageUser_Cite.setVisibility(View.VISIBLE);
|
||||
holder.messageUser_Cite.setText(message.getCite());
|
||||
}
|
||||
} else { // bot
|
||||
holder.textViewMessage.setText(message.getContent());
|
||||
// 检查是否为最后一条机器人消息
|
||||
@ -105,13 +109,13 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageV
|
||||
}
|
||||
|
||||
static class MessageViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView textViewMessage;
|
||||
ImageView imageViewCopy;
|
||||
ImageView imageViewRegenerate;
|
||||
TextView textViewMessage,messageUser_Cite;
|
||||
ImageView imageViewCopy,imageViewRegenerate;
|
||||
MessageViewHolder(View itemView, int viewType) {
|
||||
super(itemView);
|
||||
if (viewType == 1) { // 假设 1 是用户消息
|
||||
textViewMessage = itemView.findViewById(R.id.textViewMessageUser);
|
||||
messageUser_Cite=itemView.findViewById(R.id.MessageUser_Cite);
|
||||
} else { // 非 1 即机器人消息
|
||||
textViewMessage = itemView.findViewById(R.id.textViewMessageBot);
|
||||
imageViewCopy = itemView.findViewById(R.id.imageViewCopy);
|
||||
|
@ -7,6 +7,7 @@ public class ChatMessage_bmob extends BmobObject {
|
||||
private Integer isuser;
|
||||
private String relatedBook;
|
||||
private String userid;
|
||||
private String cite;
|
||||
|
||||
public ChatMessage_bmob() {
|
||||
|
||||
@ -44,10 +45,19 @@ public class ChatMessage_bmob extends BmobObject {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public ChatMessage_bmob(String content, Integer isuser, String relatedBook, String userid) {
|
||||
public ChatMessage_bmob(String content, Integer isuser, String relatedBook, String userid, String cite) {
|
||||
this.content = content;
|
||||
this.isuser = isuser;
|
||||
this.relatedBook = relatedBook;
|
||||
this.userid = userid;
|
||||
this.cite = cite;
|
||||
}
|
||||
|
||||
public String getCite() {
|
||||
return cite;
|
||||
}
|
||||
|
||||
public void setCite(String cite) {
|
||||
this.cite = cite;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.bifan.txtreaderlib.bean;
|
||||
public class Message {
|
||||
private String content;
|
||||
private Integer isuser;
|
||||
private String cite;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
@ -20,8 +21,17 @@ public class Message {
|
||||
this.isuser = isuser;
|
||||
}
|
||||
|
||||
public Message(String content, Integer isuser) {
|
||||
public Message(String content, Integer isuser, String cite) {
|
||||
this.content = content;
|
||||
this.isuser = isuser;
|
||||
this.cite = cite;
|
||||
}
|
||||
|
||||
public String getCite() {
|
||||
return cite;
|
||||
}
|
||||
|
||||
public void setCite(String cite) {
|
||||
this.cite = cite;
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,17 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.LongDef;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
@ -52,24 +56,33 @@ import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class ChatWithGptActivity extends AppCompatActivity implements MessageAdapter.OnRegenerateClickListener {
|
||||
private Boolean isStop=false;
|
||||
private RecyclerView recyclerView;
|
||||
private MessageAdapter messageAdapter;
|
||||
private EditText editTextMessage;
|
||||
private TextView chatbot_title;
|
||||
private ImageView buttonSend,chat_return;
|
||||
private ImageView buttonSend, chat_return;
|
||||
private String bookName = "";
|
||||
private String userid = "";
|
||||
private String cite = "";
|
||||
private String lastUserQuestion = ""; // 全局变量来存储最后一条用户消息
|
||||
private Call<ChatResponse> currentCall = null;
|
||||
|
||||
private ArrayList<Message> messageList = new ArrayList<>();
|
||||
private TextView questionView1, questionView2, questionView3;
|
||||
private TextView questionView1, questionView2, questionView3, textView_Cite;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_chatwithgpt);
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754");
|
||||
if (getIntent() != null && getIntent().hasExtra("book_name")) {
|
||||
bookName = getIntent().getStringExtra("book_name");
|
||||
if (getIntent() != null) {
|
||||
if (getIntent().hasExtra("book_name")) {
|
||||
bookName = getIntent().getStringExtra("book_name");
|
||||
}
|
||||
if (getIntent().hasExtra("cite")) {
|
||||
cite = getIntent().getStringExtra("cite");
|
||||
}
|
||||
}
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("userinf", Context.MODE_PRIVATE);
|
||||
String userIdFromPrefs = sharedPreferences.getString("user_id", "");
|
||||
@ -82,15 +95,25 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
buttonSend.setOnClickListener(v -> sendandStoreMessage(editTextMessage.getText().toString()));
|
||||
|
||||
buttonSend.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// 检查是否存在活跃的请求,有的话再点击一次则取消本次请求
|
||||
if (currentCall != null) {
|
||||
isStop=true;
|
||||
currentCall.cancel();
|
||||
} else {
|
||||
// 没有活跃的请求或请求已完成,发送新的请求
|
||||
String message = editTextMessage.getText().toString();
|
||||
sendandStoreMessage(message); // 发送并存储消息的函数需要你自行实现
|
||||
}
|
||||
}
|
||||
});
|
||||
View.OnClickListener questionClickListener = view -> {
|
||||
TextView questionView = (TextView) view;
|
||||
String message = questionView.getText().toString();
|
||||
clearQuestionsVisibility();
|
||||
sendandStoreMessage(message);
|
||||
};
|
||||
|
||||
questionView1.setOnClickListener(questionClickListener);
|
||||
questionView2.setOnClickListener(questionClickListener);
|
||||
questionView3.setOnClickListener(questionClickListener);
|
||||
@ -109,15 +132,25 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
}
|
||||
|
||||
private void sendandStoreMessage(String text) {
|
||||
messageList.add(new Message(text, 1)); // User message
|
||||
clearQuestionsVisibility();
|
||||
messageList.add(new Message(text, 1, cite)); // User message
|
||||
messageAdapter.notifyItemInserted(messageList.size() - 1);
|
||||
editTextMessage.setText("");
|
||||
sendMessageToChatGPT(text);
|
||||
lastUserQuestion=text;
|
||||
storeMessage(text,1);
|
||||
storeMessage(text, 1);
|
||||
hideKeyboard();
|
||||
}
|
||||
private void storeMessage(String text,int isuser){
|
||||
ChatMessage_bmob chatMessage_bmob = new ChatMessage_bmob(text, isuser, bookName, userid);
|
||||
//隐藏软键盘
|
||||
private void hideKeyboard() {
|
||||
InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
View view = getCurrentFocus();
|
||||
if (view != null) {
|
||||
inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
|
||||
}
|
||||
}
|
||||
//存储到bmob
|
||||
private void storeMessage(String text, int isuser) {
|
||||
ChatMessage_bmob chatMessage_bmob = new ChatMessage_bmob(text, isuser, bookName, userid, cite);
|
||||
chatMessage_bmob.save(new SaveListener<String>() {
|
||||
@Override
|
||||
public void done(String objectId, BmobException e) {
|
||||
@ -138,11 +171,29 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
questionView1 = findViewById(R.id.question1);
|
||||
questionView2 = findViewById(R.id.question2);
|
||||
questionView3 = findViewById(R.id.question3);
|
||||
chat_return=findViewById(R.id.chat_return);
|
||||
textView_Cite = findViewById(R.id.textView_Cite);
|
||||
chat_return = findViewById(R.id.chat_return);
|
||||
messageAdapter = new MessageAdapter(messageList, this);
|
||||
messageAdapter.setOnRegenerateClickListener(this);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerView.setAdapter(messageAdapter);
|
||||
chatbot_title.setText(bookName);
|
||||
editTextMessage.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
// 根据输入框是否有文本来禁用或启用按钮
|
||||
buttonSend.setEnabled(s.toString().trim().length() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
buttonSend.setEnabled(false);
|
||||
}
|
||||
|
||||
private void loadLastUserMessage() {
|
||||
@ -165,9 +216,13 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//从数据库加载数据
|
||||
private void init() {
|
||||
chatbot_title.setText(bookName);
|
||||
if (cite != "") {
|
||||
cite = "引用:" + cite;
|
||||
textView_Cite.setVisibility(View.VISIBLE);
|
||||
textView_Cite.setText(cite);
|
||||
}
|
||||
BmobQuery<ChatMessage_bmob> bmobQuery = new BmobQuery<>();
|
||||
bmobQuery.addWhereEqualTo("relatedBook", bookName);
|
||||
bmobQuery.addWhereEqualTo("userid", userid);
|
||||
@ -179,16 +234,16 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
for (ChatMessage_bmob item : messages) {
|
||||
if (item.getContent() == null) {
|
||||
String content = "出现未知错误!";
|
||||
messageList.add(new Message(content, item.getIsuser()));
|
||||
messageList.add(new Message(content, item.getIsuser(), ""));
|
||||
} else {
|
||||
messageList.add(new Message(item.getContent(), item.getIsuser()));
|
||||
messageList.add(new Message(item.getContent(), item.getIsuser(), item.getCite()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 如果没有消息,添加一条 bot 的欢迎消息
|
||||
String welcomeMessage = "你好!我是你的阅读助手。我可以帮助你解答关于书籍的各种问题,比如内容概述、作者信息、主要主题和角色分析等。请随时向我提问,现在,你有什么关于《" + bookName + "》的问题吗?";
|
||||
messageList.add(new Message(welcomeMessage, 0)); // 假设 0 表示系统或助手消息
|
||||
ChatMessage_bmob chatMessage_bmob = new ChatMessage_bmob(welcomeMessage, 0, bookName, userid);
|
||||
messageList.add(new Message(welcomeMessage, 0, "")); // 假设 0 表示系统或助手消息
|
||||
ChatMessage_bmob chatMessage_bmob = new ChatMessage_bmob(welcomeMessage, 0, bookName, userid, "");
|
||||
chatMessage_bmob.save(new SaveListener<String>() {
|
||||
@Override
|
||||
public void done(String objectId, BmobException e) {
|
||||
@ -208,7 +263,7 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//加载模拟用户评论
|
||||
private void initgenerateUserQuestions() {
|
||||
BmobQuery<ChatMessage_bmob> bmobQuery = new BmobQuery<>();
|
||||
bmobQuery.addWhereEqualTo("relatedBook", bookName);
|
||||
@ -289,7 +344,13 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
}
|
||||
|
||||
private void sendMessageToChatGPT(String messageText) {
|
||||
moveToNewest();
|
||||
buttonSend.setImageResource(R.drawable.ic_loading);
|
||||
if (cite != "") {
|
||||
textView_Cite.setVisibility(View.GONE);
|
||||
messageText = "请你根据《" + bookName + "》书中的这段内容:" + cite + ",回答我这个提问:" + messageText;
|
||||
}
|
||||
lastUserQuestion = messageText;
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
@ -302,7 +363,7 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
.build();
|
||||
ChatGPTService service = retrofit.create(ChatGPTService.class);
|
||||
List<ChatRequest.Message> messages = new ArrayList<>();
|
||||
String prompt = "你好!我是你的阅读助手。";
|
||||
String prompt = "你好!我是你的阅读助手。请确保你的回答准确而精炼。";
|
||||
|
||||
if (messageText.equals("请告诉我更多内容。") && !lastUserQuestion.isEmpty()) {
|
||||
// 特别关注用户的上一个问题
|
||||
@ -317,69 +378,82 @@ public class ChatWithGptActivity extends AppCompatActivity implements MessageAda
|
||||
messages.add(new ChatRequest.Message("system", prompt));
|
||||
messages.addAll(loadMessagesFromDatabase(bookName, userid));
|
||||
messages.add(new ChatRequest.Message("user", messageText)); // 添加用户消息
|
||||
|
||||
Log.d("zytest", messageText);
|
||||
ChatRequest request = new ChatRequest(messages); // 使用消息列表创建请求
|
||||
request.setModel("gpt-4-turbo"); // 根据需要选择不同的模型
|
||||
request.setMaxTokens(50); // 设置最大 token 数,根据需要调整
|
||||
request.setTemperature(0.5); // 设置适当的温度
|
||||
service.postMessage(request).enqueue(new Callback<ChatResponse>() {
|
||||
currentCall = service.postMessage(request);
|
||||
currentCall.enqueue(new Callback<ChatResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<ChatResponse> call, Response<ChatResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ChatResponse chatResponse = response.body();
|
||||
if (chatResponse.choices != null && !chatResponse.choices.isEmpty()) {
|
||||
ChatResponse.Message message = chatResponse.choices.get(0).message;
|
||||
String reply = message.content; // 这是从 GPT-3.5 响应中提取的内容
|
||||
runOnUiThread(() -> {
|
||||
messageList.add(new Message(reply, 0));
|
||||
messageAdapter.notifyDataSetChanged();
|
||||
moveToNewest();
|
||||
buttonSend.setImageResource(R.drawable.ic_send);
|
||||
generateUserQuestions(reply);
|
||||
storeMessage(reply,0);
|
||||
});
|
||||
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ChatResponse chatResponse = response.body();
|
||||
if (chatResponse.choices != null && !chatResponse.choices.isEmpty()) {
|
||||
ChatResponse.Message message = chatResponse.choices.get(0).message;
|
||||
String reply = message.content; // 这是从 GPT-3.5 响应中提取的内容
|
||||
runOnUiThread(() -> {
|
||||
cite = "";
|
||||
messageList.add(new Message(reply, 0, ""));
|
||||
messageAdapter.notifyDataSetChanged();
|
||||
moveToNewest();
|
||||
buttonSend.setImageResource(R.drawable.ic_send);
|
||||
generateUserQuestions(reply);
|
||||
storeMessage(reply, 0);
|
||||
});
|
||||
}
|
||||
currentCall = null; // 请求失败后清空引用
|
||||
} else {
|
||||
try {
|
||||
String errorBody = response.errorBody() != null ? response.errorBody().string() : "Unknown error";
|
||||
Log.e("ChatGPT", "Error: " + errorBody);
|
||||
} catch (IOException e) {
|
||||
Log.e("ChatGPT", "Error reading error body", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
String errorBody = response.errorBody() != null ? response.errorBody().string() : "Unknown error";
|
||||
Log.e("ChatGPT", "Error: " + errorBody);
|
||||
} catch (IOException e) {
|
||||
Log.e("ChatGPT", "Error reading error body", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ChatResponse> call, Throwable t) {
|
||||
String content="机器人响应超时,请重新生成回答!";
|
||||
buttonSend.setImageResource(R.drawable.ic_send);
|
||||
messageList.add(new Message(content, 0));
|
||||
messageAdapter.notifyDataSetChanged();
|
||||
moveToNewest();
|
||||
storeMessage(content,0);
|
||||
Log.e("ChatGPT", "Failure: " + t.getMessage());
|
||||
if(isStop==true){
|
||||
buttonSend.setImageResource(R.drawable.ic_send);
|
||||
isStop=false;
|
||||
}
|
||||
else {
|
||||
String content = "机器人响应超时,请重新生成回答!";
|
||||
buttonSend.setImageResource(R.drawable.ic_send);
|
||||
messageList.add(new Message(content, 0, ""));
|
||||
messageAdapter.notifyDataSetChanged();
|
||||
moveToNewest();
|
||||
currentCall = null; // 请求失败后清空引用
|
||||
storeMessage(content, 0);
|
||||
Log.e("ChatGPT", "Failure: " + t.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动移动至最新回答
|
||||
private void moveToNewest(){
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.nestedScrollView);
|
||||
recyclerView.post(() -> {
|
||||
// 确保最后一条消息可见
|
||||
if (messageList.size() > 0) {
|
||||
recyclerView.scrollToPosition(messageList.size() - 1);
|
||||
recyclerView.post(() -> {
|
||||
// 获取最后一个视图的引用
|
||||
View lastChild = recyclerView.getChildAt(recyclerView.getChildCount() - 1);
|
||||
int bottom = lastChild.getBottom() + recyclerView.getPaddingBottom();
|
||||
int sy = nestedScrollView.getScrollY();
|
||||
int sh = nestedScrollView.getHeight();
|
||||
int delta = bottom - (sy + sh);
|
||||
nestedScrollView.smoothScrollBy(0, delta);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
private void moveToNewest() {
|
||||
NestedScrollView nestedScrollView = findViewById(R.id.nestedScrollView);
|
||||
recyclerView.post(() -> {
|
||||
// 确保最后一条消息可见
|
||||
if (messageList.size() > 0) {
|
||||
recyclerView.scrollToPosition(messageList.size() - 1);
|
||||
recyclerView.post(() -> {
|
||||
// 获取最后一个视图的引用
|
||||
View lastChild = recyclerView.getChildAt(recyclerView.getChildCount() - 1);
|
||||
int bottom = lastChild.getBottom() + recyclerView.getPaddingBottom();
|
||||
int sy = nestedScrollView.getScrollY();
|
||||
int sh = nestedScrollView.getHeight();
|
||||
int delta = bottom - (sy + sh);
|
||||
nestedScrollView.smoothScrollBy(0, delta);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//回调函数,重新生成回答
|
||||
@Override
|
||||
public void onRegenerateClick(int position) {
|
||||
@ -477,7 +551,7 @@ private void moveToNewest(){
|
||||
// 提取问题
|
||||
private List<String> extractQuestions(ChatResponse response) {
|
||||
GenerateQue_bmob generateQue_bmob = new GenerateQue_bmob();
|
||||
generateQue_bmob.setQues1("请告诉我更多。");
|
||||
generateQue_bmob.setQues1("请告诉我更多内容。");
|
||||
generateQue_bmob.setUserid(userid);
|
||||
generateQue_bmob.setRelatedBook(bookName);
|
||||
List<String> questions = new ArrayList<>();
|
||||
|
@ -764,6 +764,13 @@ public class HwTxtPlayActivity extends AppCompatActivity {
|
||||
mTxtReaderView.releaseSelectedState();
|
||||
Gone(ClipboardView);
|
||||
}
|
||||
public void onChatbot(View view){
|
||||
String bookName = FileName.substring(0, FileName.lastIndexOf("."));
|
||||
Intent intent = new Intent(HwTxtPlayActivity.this,ChatWithGptActivity.class);
|
||||
intent.putExtra("book_name", bookName);
|
||||
intent.putExtra("cite", CurrentSelectedText);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
|
@ -9,7 +9,7 @@
|
||||
android:id="@+id/nestedScrollView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/inputEditText"
|
||||
app:layout_constraintBottom_toTopOf="@id/chatbot_bottom"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/chatbot_title">
|
||||
@ -82,6 +82,7 @@
|
||||
android:id="@+id/chat_return"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="4dp"
|
||||
android:src="@drawable/ic_return"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/chatbot_title"
|
||||
@ -89,38 +90,63 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/chatbot_title" />
|
||||
|
||||
<!-- 标题栏 -->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chatbot_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:gravity="center"
|
||||
android:text="书名"
|
||||
android:textSize="22sp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintStart_toEndOf="@id/chat_return"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/chat_return"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 输入框 -->
|
||||
<EditText
|
||||
android:id="@+id/inputEditText"
|
||||
android:layout_width="0dp"
|
||||
<LinearLayout
|
||||
android:id="@+id/chatbot_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:hint="输入消息..."
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/sendButton" />
|
||||
app:layout_constraintRight_toRightOf="parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<!-- 输入框 -->
|
||||
<EditText
|
||||
android:id="@+id/inputEditText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:hint="与阅读小助手交谈..." />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sendButton"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:src="@drawable/ic_send"
|
||||
android:layout_gravity="right|bottom" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/textView_Cite"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="引用:"
|
||||
android:textSize="14sp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginRight="40dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sendButton"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:src="@drawable/ic_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"></ImageView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -109,30 +109,43 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/s_dp_10"
|
||||
android:paddingBottom="@dimen/s_dp_10"
|
||||
android:layout_marginStart="@dimen/s_dp_10"
|
||||
android:paddingTop="@dimen/s_dp_10"
|
||||
android:paddingBottom="@dimen/s_dp_10"
|
||||
android:text="@string/selected_0_num_text"
|
||||
android:textColor="@color/color_aaffffff"
|
||||
android:layout_marginStart="@dimen/s_dp_10" />
|
||||
android:textColor="@color/color_aaffffff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/activity_hwTxtPlay_ClipBoar_click"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="@dimen/s_dp_5"
|
||||
android:layout_marginEnd="@dimen/s_dp_5"
|
||||
android:clickable="true"
|
||||
android:onClick="onCopyText"
|
||||
android:paddingBottom="@dimen/s_dp_10"
|
||||
android:focusable="true"
|
||||
android:paddingTop="@dimen/s_dp_10"
|
||||
android:paddingBottom="@dimen/s_dp_10"
|
||||
android:text="@string/copy"
|
||||
android:textColor="@color/color_withe"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/s_dp_5"
|
||||
android:focusable="true" />
|
||||
android:textColor="@color/color_withe" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chatbot_bottom"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:onClick="onChatbot"
|
||||
android:layout_marginRight="@dimen/s_dp_10"
|
||||
android:layout_toLeftOf="@id/activity_hwTxtPlay_ClipBoar_click"
|
||||
android:layout_toStartOf="@id/activity_hwTxtPlay_ClipBoar_click"
|
||||
android:paddingTop="@dimen/s_dp_10"
|
||||
android:src="@drawable/chatbot" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/activity_hwTxtPlay_cover"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,10 +2,11 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:layout_margin="8dp"
|
||||
android:gravity="right">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewMessageUser"
|
||||
android:layout_width="wrap_content"
|
||||
@ -14,4 +15,16 @@
|
||||
android:padding="10dp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:text="User message here"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/MessageUser_Cite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="引用:"
|
||||
android:textSize="14sp"
|
||||
android:ellipsize="end"
|
||||
android:visibility="gone"
|
||||
android:maxLines="1"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginLeft="25dp" />
|
||||
</LinearLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user