Quellcode durchsuchen

加是否能加页

master
雷云 vor 5 Jahren
Ursprung
Commit
d2b4cb6c49
3 geänderte Dateien mit 34 neuen und 9 gelöschten Zeilen
  1. +1
    -1
      app/src/main/java/com/yzx/webebook/MainActivity.kt
  2. +17
    -7
      app/src/main/java/com/yzx/webebook/activity/NoteActivity.kt
  3. +16
    -1
      app/src/main/java/com/yzx/webebook/activity/WebActivity.kt

+ 1
- 1
app/src/main/java/com/yzx/webebook/MainActivity.kt Datei anzeigen

@@ -51,7 +51,7 @@ class MainActivity : BaseActivity<BasePresenter<*>>() {
btn5.setOnClickListener { btn5.setOnClickListener {
// BookActivity.active(this,"教育云空间(无图)","","","",2,2) // BookActivity.active(this,"教育云空间(无图)","","","",2,2)
val json ="" val json =""
NoteActivity.active(this, "测试笔记写字", json)
NoteActivity.active(this, "测试笔记写字", json,1)
} }


/*OkGo.post<String>("https://fileupload.oa.qbjjyyun.net/edufile/fileUpload") /*OkGo.post<String>("https://fileupload.oa.qbjjyyun.net/edufile/fileUpload")


+ 17
- 7
app/src/main/java/com/yzx/webebook/activity/NoteActivity.kt Datei anzeigen

@@ -82,11 +82,12 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
companion object { companion object {
const val NOTE_FOLDER_DIR = "/mnt/sdcard/ebook/" const val NOTE_FOLDER_DIR = "/mnt/sdcard/ebook/"
const val REQ_CODE = 0x98 const val REQ_CODE = 0x98
fun active(act: Activity, title: String, noteInfo: String) {
fun active(act: Activity, title: String, noteInfo: String, can_add_page: Int = 1) {
act.startActivityForResult<NoteActivity>( act.startActivityForResult<NoteActivity>(
REQ_CODE, REQ_CODE,
"note_info" to noteInfo, "note_info" to noteInfo,
"title" to title
"title" to title,
"can_add_page" to can_add_page
) )
} }
} }
@@ -149,7 +150,10 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
} }
//加纸 //加纸
new_add.setOnClickListener { new_add.setOnClickListener {
notList.add(Note())
val lastBGid = notList[notList.size-1].BGid
val note = Note()
note.BGid = lastBGid
notList.add(note)
tv_page_index.text = "${currIndex + 1}/${notList.size}" tv_page_index.text = "${currIndex + 1}/${notList.size}"
indexBox.visibility = if (notList.size > 1) { indexBox.visibility = if (notList.size > 1) {
View.VISIBLE View.VISIBLE
@@ -206,7 +210,6 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
} }
} }



@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun initData() { override fun initData() {
val json = intent.getStringExtra("note_info") val json = intent.getStringExtra("note_info")
@@ -244,6 +247,13 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
} else { } else {
View.GONE View.GONE
} }

val canAddPage = intent.getIntExtra("can_add_page", 1)
if (canAddPage == 1) {
new_add.visibility = View.VISIBLE
}else{
new_add.visibility = View.GONE
}
} }


private fun loadImage(index: Int = 0) { private fun loadImage(index: Int = 0) {
@@ -255,7 +265,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
note.key = Date().time.toString() note.key = Date().time.toString()
note_view.showExistPage( note_view.showExistPage(
"", "",
mBGDrawableList[0]
mBGDrawableList[bgId]
) )
currKey = note.key currKey = note.key
currIndex = index currIndex = index
@@ -326,7 +336,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
note.key = Date().time.toString() note.key = Date().time.toString()
note_view.showExistPage( note_view.showExistPage(
"", "",
mBGDrawableList[0]
mBGDrawableList[bgId]
) )
currKey = note.key currKey = note.key
currIndex = index currIndex = index
@@ -419,7 +429,7 @@ class NoteActivity : BaseActivity<BasePresenter<*>>() {
private fun copyList(): MutableList<Note> { private fun copyList(): MutableList<Note> {
val list = mutableListOf<Note>() val list = mutableListOf<Note>()
notList.forEach { notList.forEach {
if(!TextUtils.isEmpty(it.key)&&!TextUtils.isEmpty(it.identity)){
if (!TextUtils.isEmpty(it.key) && !TextUtils.isEmpty(it.identity)) {
val item = Note() val item = Note()
item.key = it.key item.key = it.key
item.identity = it.identity item.identity = it.identity


+ 16
- 1
app/src/main/java/com/yzx/webebook/activity/WebActivity.kt Datei anzeigen

@@ -264,6 +264,21 @@ class YzxJavascriptInterface(var ctx: Activity) {
BookActivity.active(ctx, title, key, identity, name, index, type) BookActivity.active(ctx, title, key, identity, name, index, type)
} }


/**
* 跳转到笔记页面
* @param title 展示的title
* @param note_info 笔记得json,新的笔记 传"" ,老的笔记 传 [{"BGid":0,"identity":"fileb","key":"a92511a457cdc444bb274e5dee29c487"}]
* @param can_add_page 是否可以新加纸,1可以,0不可以
*/
@JavascriptInterface
fun notePage(
title: String,
note_info:String,
can_add_page:Int=1
) {
NoteActivity.active(ctx, title, note_info ,can_add_page)
}

/** /**
* 跳转到笔记页面 * 跳转到笔记页面
* @param title 展示的title * @param title 展示的title
@@ -274,7 +289,7 @@ class YzxJavascriptInterface(var ctx: Activity) {
title: String, title: String,
note_info:String note_info:String
) { ) {
NoteActivity.active(ctx, title, note_info)
NoteActivity.active(ctx, title, note_info ,1)
} }


/** /**


Laden…
Abbrechen
Speichern