Merge pull request #2 from Anrannn/main

Merge new commit
This commit is contained in:
Anrannn
2022-10-01 00:58:08 +08:00
committed by GitHub
9 changed files with 20 additions and 20 deletions
@@ -4,7 +4,6 @@ import android.animation.Animator
import android.animation.AnimatorListenerAdapter import android.animation.AnimatorListenerAdapter
import android.content.Intent import android.content.Intent
import android.os.* import android.os.*
import android.util.Log
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
@@ -259,7 +258,6 @@ class MainActivity : BaseActivity() {
//执行搜索 //执行搜索
private fun searchAction(tags: String?) { private fun searchAction(tags: String?) {
Log.e("num",tags.toString())
var tag = tags var tag = tags
var isNum = true var isNum = true
try { try {
@@ -283,8 +281,6 @@ class MainActivity : BaseActivity() {
//缓存搜索的tags //缓存搜索的tags
this.tags = tags this.tags = tags
Log.e(TAG,"now page is $page")
val swipeRefreshLayout = val swipeRefreshLayout =
findViewById<androidx.swiperefreshlayout.widget.SwipeRefreshLayout>( findViewById<androidx.swiperefreshlayout.widget.SwipeRefreshLayout>(
R.id.swipeRefreshLayout R.id.swipeRefreshLayout
@@ -63,7 +63,6 @@ class PostAdapter(val context: Context, private var postYandList: ArrayList<Post
if (file_ext == null){ if (file_ext == null){
val strarr = postYandList[position].sample_url.split(".") val strarr = postYandList[position].sample_url.split(".")
file_ext = strarr[strarr.lastIndex] file_ext = strarr[strarr.lastIndex]
Log.e("file_ext",file_ext)
} }
PicActivity.actionStartActivity(context,postYandList[position].id,postYandList[position].sample_url, PicActivity.actionStartActivity(context,postYandList[position].id,postYandList[position].sample_url,
@@ -6,7 +6,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.* import android.os.*
import android.util.Log
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
@@ -200,7 +199,7 @@ class PicActivity : BaseActivity() {
isFirstResource: Boolean isFirstResource: Boolean
): Boolean { ): Boolean {
if (e != null) { if (e != null) {
Log.e("Pic", e.stackTraceToString()) e.printStackTrace()
} }
val pb = findViewById<ProgressBar>(R.id.pb) val pb = findViewById<ProgressBar>(R.id.pb)
Snackbar.make(pb, R.string.toast_load_fail, Snackbar.LENGTH_LONG).setAction(R.string.button_check) { Snackbar.make(pb, R.string.toast_load_fail, Snackbar.LENGTH_LONG).setAction(R.string.button_check) {
@@ -1,6 +1,5 @@
package com.lsp.view.activity.pic package com.lsp.view.activity.pic
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
@@ -24,7 +23,6 @@ class SizeAdapter(val tagList: List<Size>) : RecyclerView.Adapter<SizeAdapter.Vi
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val tag = tagList[position] val tag = tagList[position]
Log.e("size", tag.file_size)
if (position == 0) { if (position == 0) {
holder.tagText.text = tag.file_size holder.tagText.text = tag.file_size
holder.tagText.setBackgroundResource(R.drawable.title_bg) holder.tagText.setBackgroundResource(R.drawable.title_bg)
@@ -1,6 +1,5 @@
package com.lsp.view.retrofit package com.lsp.view.retrofit
import android.util.Log
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
@@ -18,7 +17,6 @@ object ServiceCreator {
.baseUrl(source) .baseUrl(source)
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.build() .build()
Log.e("Post", source)
ServiceCreator.source = source ServiceCreator.source = source
return retrofit.create(serviceClass) return retrofit.create(serviceClass)
} }
@@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.media.MediaScannerConnection import android.media.MediaScannerConnection
import android.os.* import android.os.*
import android.util.Log
import com.lsp.view.util.CallBackStatus import com.lsp.view.util.CallBackStatus
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
@@ -40,7 +39,6 @@ class DownloadService : Service() {
if (file.exists()){ if (file.exists()){
callBack(handler,CallBackStatus.FILEEXISTS) callBack(handler,CallBackStatus.FILEEXISTS)
Log.e("callback","文件存在")
return@thread return@thread
} }
@@ -71,7 +69,6 @@ class DownloadService : Service() {
return@thread return@thread
} else { } else {
Log.e("Test", "errorNet")
file.delete() file.delete()
callBack(handler, CallBackStatus.NETWORKERROR) callBack(handler, CallBackStatus.NETWORKERROR)
return@thread return@thread
+7 -6
View File
@@ -11,6 +11,7 @@ import android.os.Message
import android.widget.Toast import android.widget.Toast
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.lsp.view.R
import com.lsp.view.YandViewApplication import com.lsp.view.YandViewApplication
import java.io.File import java.io.File
import kotlin.concurrent.thread import kotlin.concurrent.thread
@@ -45,7 +46,7 @@ object Util {
shareIntent.type = "image/*" shareIntent.type = "image/*"
shareIntent.putExtra(Intent.EXTRA_STREAM,imageUri) shareIntent.putExtra(Intent.EXTRA_STREAM,imageUri)
val intent = Intent.createChooser(shareIntent,"分享") val intent = Intent.createChooser(shareIntent,R.string.title_share.toString())
val resInfoList: List<ResolveInfo> = context.packageManager val resInfoList: List<ResolveInfo> = context.packageManager
.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY) .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
@@ -65,7 +66,7 @@ object Util {
} }
fun download(file_url: String?, file_ext: String?,md5: String?){ fun download(file_url: String?, file_ext: String?,md5: String?){
Toast.makeText(YandViewApplication.context, "开始保存", Toast.LENGTH_SHORT).show() Toast.makeText(YandViewApplication.context, R.string.toast_download_start, Toast.LENGTH_SHORT).show()
if (file_url != null) { if (file_url != null) {
if (file_ext != null) { if (file_ext != null) {
@@ -79,19 +80,19 @@ object Util {
super.handleMessage(msg) super.handleMessage(msg)
when(msg.what){ when(msg.what){
CallBackStatus.OK.ordinal ->{ CallBackStatus.OK.ordinal ->{
Toast.makeText(YandViewApplication.context, "保存成功", Toast.LENGTH_SHORT).show() Toast.makeText(YandViewApplication.context, R.string.toast_download_success, Toast.LENGTH_SHORT).show()
} }
CallBackStatus.DOWNLOADERROR.ordinal -> { CallBackStatus.DOWNLOADERROR.ordinal -> {
Toast.makeText(YandViewApplication.context, "下载异常", Toast.LENGTH_SHORT).show() Toast.makeText(YandViewApplication.context, R.string.toast_download_fail, Toast.LENGTH_SHORT).show()
} }
CallBackStatus.MD5COMPAREERROR.ordinal -> { CallBackStatus.MD5COMPAREERROR.ordinal -> {
Toast.makeText(YandViewApplication.context, "文件下载异常,MD5对比失败", Toast.LENGTH_SHORT).show() Toast.makeText(YandViewApplication.context, R.string.toast_compar_md5_fail, Toast.LENGTH_SHORT).show()
} }
CallBackStatus.FILEEXISTS.ordinal -> { CallBackStatus.FILEEXISTS.ordinal -> {
Toast.makeText(YandViewApplication.context, "文件已经存在", Toast.LENGTH_SHORT).show() Toast.makeText(YandViewApplication.context, R.string.toast_file_exist, Toast.LENGTH_SHORT).show()
} }
} }
+6
View File
@@ -22,4 +22,10 @@
<string name="title_setting_load_source">加载源</string> <string name="title_setting_load_source">加载源</string>
<string name="toast_tag_add_fav">收藏了新的标签</string> <string name="toast_tag_add_fav">收藏了新的标签</string>
<string name="toast_tag_exist">收藏过了哦</string> <string name="toast_tag_exist">收藏过了哦</string>
<string name="toast_download_success">下载成功</string>
<string name="toast_download_fail">下载失败</string>
<string name="toast_compar_md5_fail">MD5对比失败</string>
<string name="toast_file_exist">文件已经存在</string>
<string name="toast_download_start">开始下载</string>
<string name="title_share">分享</string>
</resources> </resources>
+6
View File
@@ -23,4 +23,10 @@
<string name="title_setting_load_source">Load source</string> <string name="title_setting_load_source">Load source</string>
<string name="toast_tag_add_fav">Add to new favorites</string> <string name="toast_tag_add_fav">Add to new favorites</string>
<string name="toast_tag_exist">This tag exist</string> <string name="toast_tag_exist">This tag exist</string>
<string name="toast_download_success">Successfully download</string>
<string name="toast_download_fail">Download failed</string>
<string name="toast_compar_md5_fail">MD5 comparison failed</string>
<string name="toast_file_exist">File exists</string>
<string name="toast_download_start">Start download</string>
<string name="title_share">Share</string>
</resources> </resources>