=add collect and move file package
This commit is contained in:
Generated
+4
@@ -16,11 +16,14 @@
|
|||||||
<entry key="app/src/main/res/drawable/ic_launcher_foreground.xml" value="0.19635416666666666" />
|
<entry key="app/src/main/res/drawable/ic_launcher_foreground.xml" value="0.19635416666666666" />
|
||||||
<entry key="app/src/main/res/drawable/item_bg.xml" value="0.3333333333333333" />
|
<entry key="app/src/main/res/drawable/item_bg.xml" value="0.3333333333333333" />
|
||||||
<entry key="app/src/main/res/drawable/title_bg.xml" value="0.3333333333333333" />
|
<entry key="app/src/main/res/drawable/title_bg.xml" value="0.3333333333333333" />
|
||||||
|
<entry key="app/src/main/res/layout/activity_fav_tag.xml" value="0.3066123188405797" />
|
||||||
<entry key="app/src/main/res/layout/activity_login.xml" value="0.21770833333333334" />
|
<entry key="app/src/main/res/layout/activity_login.xml" value="0.21770833333333334" />
|
||||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.4" />
|
<entry key="app/src/main/res/layout/activity_main.xml" value="0.4" />
|
||||||
<entry key="app/src/main/res/layout/activity_pic.xml" value="0.1" />
|
<entry key="app/src/main/res/layout/activity_pic.xml" value="0.1" />
|
||||||
|
<entry key="app/src/main/res/layout/img_item_layout.xml" value="0.3066123188405797" />
|
||||||
<entry key="app/src/main/res/layout/item_layout.xml" value="0.1625" />
|
<entry key="app/src/main/res/layout/item_layout.xml" value="0.1625" />
|
||||||
<entry key="app/src/main/res/layout/nav_header.xml" value="0.1" />
|
<entry key="app/src/main/res/layout/nav_header.xml" value="0.1" />
|
||||||
|
<entry key="app/src/main/res/layout/nav_tag_item_layout.xml" value="0.3129528985507246" />
|
||||||
<entry key="app/src/main/res/layout/settings_activity.xml" value="0.264" />
|
<entry key="app/src/main/res/layout/settings_activity.xml" value="0.264" />
|
||||||
<entry key="app/src/main/res/layout/settings_activity_2.xml" value="0.2595108695652174" />
|
<entry key="app/src/main/res/layout/settings_activity_2.xml" value="0.2595108695652174" />
|
||||||
<entry key="app/src/main/res/layout/settings_activity_backup.xml" value="0.25181159420289856" />
|
<entry key="app/src/main/res/layout/settings_activity_backup.xml" value="0.25181159420289856" />
|
||||||
@@ -28,6 +31,7 @@
|
|||||||
<entry key="app/src/main/res/layout/spinner_item_layout.xml" value="0.1" />
|
<entry key="app/src/main/res/layout/spinner_item_layout.xml" value="0.1" />
|
||||||
<entry key="app/src/main/res/layout/tag_item_layout.xml" value="0.31302083333333336" />
|
<entry key="app/src/main/res/layout/tag_item_layout.xml" value="0.31302083333333336" />
|
||||||
<entry key="app/src/main/res/menu/nav_menu.xml" value="0.1" />
|
<entry key="app/src/main/res/menu/nav_menu.xml" value="0.1" />
|
||||||
|
<entry key="app/src/main/res/menu/nav_tags.xml" value="0.1" />
|
||||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.3333333333333333" />
|
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.3333333333333333" />
|
||||||
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.3333333333333333" />
|
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.3333333333333333" />
|
||||||
<entry key="app/src/main/res/xml/root_preferences.xml" value="0.21829710144927536" />
|
<entry key="app/src/main/res/xml/root_preferences.xml" value="0.21829710144927536" />
|
||||||
|
|||||||
@@ -14,11 +14,14 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.LspView.NoActionBar">
|
android:theme="@style/Theme.LspView.NoActionBar">
|
||||||
<activity
|
<activity
|
||||||
android:name=".setting.SettingsActivity"
|
android:name=".activity.favtag.FavTagActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.setting.SettingsActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_settings" />
|
android:label="@string/title_activity_settings" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".setting.SettingsActivity_BackUp"
|
android:name=".activity.setting.SettingsActivity_BackUp"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_settings_backup" />
|
android:label="@string/title_activity_settings_backup" />
|
||||||
|
|
||||||
@@ -27,12 +30,13 @@
|
|||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
<activity android:name=".login.LoginActivity" />
|
<activity android:name=".activity.login.LoginActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/Theme.LspView.NoActionBar.Pic"
|
android:name=".activity.pic.PicActivity"
|
||||||
android:name=".pic.PicActivity"
|
android:configChanges="uiMode"
|
||||||
android:configChanges="uiMode" />
|
android:theme="@style/Theme.LspView.NoActionBar.Pic" />
|
||||||
<activity android:name=".main.MainActivity"
|
<activity
|
||||||
|
android:name=".activity.main.MainActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.lsp.view.activity.favtag
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.google.android.flexbox.*
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import com.lsp.view.R
|
||||||
|
import com.lsp.view.activity.main.MainActivity
|
||||||
|
import com.lsp.view.bean.Tags
|
||||||
|
|
||||||
|
class FavTagActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_fav_tag)
|
||||||
|
|
||||||
|
val recyclerViewTag = findViewById<RecyclerView>(R.id.tag_recy)
|
||||||
|
recyclerViewTag.layoutManager = layoutManager()
|
||||||
|
val tagsArraySp = getSharedPreferences("tags_sp", Context.MODE_PRIVATE)
|
||||||
|
val array = tagsArraySp.getString("array",null)
|
||||||
|
var favTagList :ArrayList<Tags> = ArrayList()
|
||||||
|
if (array!=null){
|
||||||
|
//有收藏内容
|
||||||
|
val tagListType = object : TypeToken<ArrayList<Tags>>(){}.type
|
||||||
|
favTagList = Gson().fromJson(array,tagListType)
|
||||||
|
|
||||||
|
}else{
|
||||||
|
favTagList.add(Tags("没有任何Tag"))
|
||||||
|
}
|
||||||
|
|
||||||
|
val favTagAdapter = FavTagAdapter(favTagList)
|
||||||
|
favTagAdapter.setOnItemClickListener(object :FavTagAdapter.OnItemClickListener{
|
||||||
|
override fun onItemClick(view: View, position: Int) {
|
||||||
|
val intent = Intent(this@FavTagActivity, MainActivity::class.java)
|
||||||
|
intent.putExtra("searchTag",favTagList[position].tag)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
recyclerViewTag.adapter = favTagAdapter
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun layoutManager(): FlexboxLayoutManager {
|
||||||
|
val manager = object : FlexboxLayoutManager(this, FlexDirection.ROW, FlexWrap.WRAP) {
|
||||||
|
override fun canScrollVertically(): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manager.flexWrap = FlexWrap.WRAP
|
||||||
|
manager.flexDirection = FlexDirection.ROW
|
||||||
|
manager.alignItems = AlignItems.CENTER
|
||||||
|
manager.justifyContent = JustifyContent.FLEX_START
|
||||||
|
return manager
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
-16
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.pic
|
package com.lsp.view.activity.favtag
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -8,38 +8,50 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import com.lsp.view.R
|
import com.lsp.view.R
|
||||||
import com.lsp.view.bean.Tags
|
import com.lsp.view.bean.Tags
|
||||||
|
|
||||||
class TagAdapter(val tagList:List<Tags>):RecyclerView.Adapter<TagAdapter.ViewHolder>() {
|
class FavTagAdapter(val tagList:ArrayList<Tags>): RecyclerView.Adapter<FavTagAdapter.ViewHolder>() {
|
||||||
inner class ViewHolder(view:View):RecyclerView.ViewHolder(view){
|
inner class ViewHolder(view:View):RecyclerView.ViewHolder(view) {
|
||||||
val tagText = view.findViewById<TextView>(R.id.tag)
|
val fav_tag = view.findViewById<TextView>(R.id.fav_tag)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var mOnItemClickListener: OnItemClickListener
|
private lateinit var mOnItemClickListener :OnItemClickListener
|
||||||
interface OnItemClickListener{
|
interface OnItemClickListener{
|
||||||
fun onItemClick(view: View,position: Int)
|
fun onItemClick(view:View, position: Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOnItemClickListener(mOnItemClickListener: OnItemClickListener){
|
fun setOnItemClickListener(mOnItemClickListener: OnItemClickListener){
|
||||||
this.mOnItemClickListener = mOnItemClickListener
|
this.mOnItemClickListener = mOnItemClickListener
|
||||||
|
|
||||||
|
}
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.fav_tag_item_layout,parent,false)
|
||||||
|
val viewHolder = ViewHolder(view)
|
||||||
|
viewHolder.fav_tag.setOnLongClickListener {
|
||||||
|
val position = viewHolder.adapterPosition
|
||||||
|
removeData(position)
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
return viewHolder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeData(position: Int){
|
||||||
|
tagList.removeAt(position)
|
||||||
|
notifyItemRangeInserted(0,tagList.size)
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
|
||||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.tag_item_layout,parent,false)
|
|
||||||
return ViewHolder(view)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val tag = tagList[position]
|
val tag = tagList[position].tag
|
||||||
holder.tagText.text = tag.tag
|
holder.fav_tag.text = tag
|
||||||
holder.tagText.setOnClickListener {
|
holder.fav_tag.setOnClickListener {
|
||||||
mOnItemClickListener.onItemClick(it,position)
|
mOnItemClickListener.onItemClick(it,position)
|
||||||
}
|
}
|
||||||
if (position == 0){
|
|
||||||
holder.tagText.setBackgroundResource(R.drawable.title_bg)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
return tagList.size
|
return tagList.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+2
-10
@@ -1,21 +1,13 @@
|
|||||||
package com.lsp.view.login
|
package com.lsp.view.activity.login
|
||||||
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.app.Dialog
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Environment
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.TextView
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
import com.lsp.view.R
|
import com.lsp.view.R
|
||||||
import com.lsp.view.main.MainActivity
|
import com.lsp.view.activity.main.MainActivity
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
import java.io.File
|
|
||||||
import java.security.MessageDigest
|
|
||||||
import java.security.NoSuchAlgorithmException
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.login;
|
package com.lsp.view.activity.login;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
+23
-13
@@ -1,20 +1,15 @@
|
|||||||
package com.lsp.view.main
|
package com.lsp.view.activity.main
|
||||||
|
|
||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.Color
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.text.Html
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.Window
|
|
||||||
import android.view.WindowManager
|
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
@@ -26,22 +21,23 @@ import androidx.drawerlayout.widget.DrawerLayout
|
|||||||
import androidx.recyclerview.widget.*
|
import androidx.recyclerview.widget.*
|
||||||
import com.google.android.material.navigation.NavigationView
|
import com.google.android.material.navigation.NavigationView
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
import com.lsp.view.bean.Post
|
import com.lsp.view.bean.Post
|
||||||
import com.hentai.yandeview.Retrofit.PostService
|
import com.hentai.yandeview.Retrofit.PostService
|
||||||
import com.hentai.yandeview.Retrofit.ServiceCreator
|
import com.hentai.yandeview.Retrofit.ServiceCreator
|
||||||
import com.lsp.view.R
|
import com.lsp.view.R
|
||||||
import com.lsp.view.setting.SettingsActivity
|
import com.lsp.view.activity.favtag.FavTagActivity
|
||||||
import jp.wasabeef.recyclerview.adapters.AlphaInAnimationAdapter
|
import com.lsp.view.activity.favtag.FavTagAdapter
|
||||||
|
import com.lsp.view.bean.Tags
|
||||||
|
import com.lsp.view.activity.setting.SettingsActivity
|
||||||
import jp.wasabeef.recyclerview.adapters.SlideInBottomAnimationAdapter
|
import jp.wasabeef.recyclerview.adapters.SlideInBottomAnimationAdapter
|
||||||
import jp.wasabeef.recyclerview.animators.SlideInUpAnimator
|
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Callback
|
import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
import java.security.AccessController.getContext
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.properties.Delegates
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
private var searchTag:String? = null
|
private var searchTag:String? = null
|
||||||
@@ -95,6 +91,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
recyclerView.layoutManager = layoutManager
|
recyclerView.layoutManager = layoutManager
|
||||||
|
|
||||||
|
|
||||||
|
//收藏Tag
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val fbtn = findViewById<com.google.android.material.floatingactionbutton.FloatingActionButton>(
|
val fbtn = findViewById<com.google.android.material.floatingactionbutton.FloatingActionButton>(
|
||||||
R.id.fbtn
|
R.id.fbtn
|
||||||
)
|
)
|
||||||
@@ -203,6 +208,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
false
|
false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
R.id.taglist -> {
|
||||||
|
val intent = Intent(this,FavTagActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
drawerLayout.closeDrawers()
|
||||||
|
false
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,7 +336,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val postService: PostService = if(source!=null){
|
val postService: PostService = if(source!=null){
|
||||||
ServiceCreator.create<PostService>(source)
|
ServiceCreator.create<PostService>(source)
|
||||||
}else {
|
}else {
|
||||||
@@ -384,7 +394,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
try{
|
try{
|
||||||
if (position!=null) {
|
if (position!=null) {
|
||||||
if (position > 4) {
|
if (position > 4) {
|
||||||
recyclerView.scrollToPosition(position - 2)
|
recyclerView.scrollToPosition(position - 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e:Exception){
|
}catch (e:Exception){
|
||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.main
|
package com.lsp.view.activity.main
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@@ -12,7 +12,7 @@ import com.bumptech.glide.Glide
|
|||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
import com.bumptech.glide.load.model.LazyHeaders
|
import com.bumptech.glide.load.model.LazyHeaders
|
||||||
import com.lsp.view.bean.Post
|
import com.lsp.view.bean.Post
|
||||||
import com.lsp.view.pic.PicActivity
|
import com.lsp.view.activity.pic.PicActivity
|
||||||
import com.lsp.view.R
|
import com.lsp.view.R
|
||||||
|
|
||||||
class PostAdapter(val context:Context, private var postList: ArrayList<Post>) :RecyclerView.Adapter<PostAdapter.ViewHolder>(){
|
class PostAdapter(val context:Context, private var postList: ArrayList<Post>) :RecyclerView.Adapter<PostAdapter.ViewHolder>(){
|
||||||
@@ -22,7 +22,7 @@ class PostAdapter(val context:Context, private var postList: ArrayList<Post>) :R
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.item_layout,parent,false)
|
val view = LayoutInflater.from(context).inflate(R.layout.img_item_layout,parent,false)
|
||||||
val viewHolder = ViewHolder(view)
|
val viewHolder = ViewHolder(view)
|
||||||
viewHolder.picImage.setOnClickListener {
|
viewHolder.picImage.setOnClickListener {
|
||||||
val position = viewHolder.adapterPosition
|
val position = viewHolder.adapterPosition
|
||||||
@@ -57,13 +57,13 @@ class PostAdapter(val context:Context, private var postList: ArrayList<Post>) :R
|
|||||||
fun notifyData(newPostList: ArrayList<Post>, isRefresh:Boolean){
|
fun notifyData(newPostList: ArrayList<Post>, isRefresh:Boolean){
|
||||||
Log.e("isRefresh",isRefresh.toString())
|
Log.e("isRefresh",isRefresh.toString())
|
||||||
if (isRefresh){
|
if (isRefresh){
|
||||||
notifyItemRangeRemoved(0, postList.size);
|
|
||||||
postList = newPostList
|
postList = newPostList
|
||||||
notifyItemRangeInserted(0, newPostList.size)
|
notifyItemRangeInserted(0, newPostList.size)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
val position = postList.size
|
||||||
postList.addAll(newPostList)
|
postList.addAll(newPostList)
|
||||||
notifyItemInserted(0)
|
notifyItemRangeInserted(position,postList.size)
|
||||||
|
|
||||||
}
|
}
|
||||||
Log.e("size",postList.size.toString())
|
Log.e("size",postList.size.toString())
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.pic
|
package com.lsp.view.activity.pic
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.pic
|
package com.lsp.view.activity.pic
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
+3
-11
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.pic
|
package com.lsp.view.activity.pic
|
||||||
|
|
||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
@@ -7,8 +7,6 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.ServiceConnection
|
import android.content.ServiceConnection
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.content.res.Resources
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.*
|
import android.os.*
|
||||||
@@ -20,9 +18,7 @@ import android.view.WindowManager
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import android.widget.Toolbar
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
@@ -40,15 +36,11 @@ import com.lsp.view.bean.Author
|
|||||||
import com.lsp.view.bean.ID
|
import com.lsp.view.bean.ID
|
||||||
import com.lsp.view.bean.Size
|
import com.lsp.view.bean.Size
|
||||||
import com.lsp.view.bean.Tags
|
import com.lsp.view.bean.Tags
|
||||||
import com.lsp.view.main.MainActivity
|
import com.lsp.view.activity.main.MainActivity
|
||||||
import com.lsp.view.service.DownloadService
|
import com.lsp.view.service.DownloadService
|
||||||
import okhttp3.OkHttpClient
|
|
||||||
import okhttp3.Request
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.lang.Exception
|
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
import kotlin.math.log
|
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
class PicActivity : AppCompatActivity() {
|
class PicActivity : AppCompatActivity() {
|
||||||
@@ -306,7 +298,7 @@ class PicActivity : AppCompatActivity() {
|
|||||||
for (tag in list) run {
|
for (tag in list) run {
|
||||||
tagList.add(Tags(tag))
|
tagList.add(Tags(tag))
|
||||||
}
|
}
|
||||||
val adapter = TagAdapter(tagList)
|
val adapter = TagAdapter(tagList,this)
|
||||||
adapter.setOnItemClickListener(object : TagAdapter.OnItemClickListener{
|
adapter.setOnItemClickListener(object : TagAdapter.OnItemClickListener{
|
||||||
override fun onItemClick(view: View, position: Int) {
|
override fun onItemClick(view: View, position: Int) {
|
||||||
val intent = Intent(this@PicActivity, MainActivity::class.java)
|
val intent = Intent(this@PicActivity, MainActivity::class.java)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.pic
|
package com.lsp.view.activity.pic
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.lsp.view.activity.pic
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.TextView
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import com.lsp.view.R
|
||||||
|
import com.lsp.view.bean.Tags
|
||||||
|
|
||||||
|
class TagAdapter(val tagList:List<Tags>,val context: Context):RecyclerView.Adapter<TagAdapter.ViewHolder>() {
|
||||||
|
inner class ViewHolder(view:View):RecyclerView.ViewHolder(view){
|
||||||
|
val tagText = view.findViewById<TextView>(R.id.tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var mOnItemClickListener: OnItemClickListener
|
||||||
|
interface OnItemClickListener{
|
||||||
|
fun onItemClick(view: View,position: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setOnItemClickListener(mOnItemClickListener: OnItemClickListener){
|
||||||
|
this.mOnItemClickListener = mOnItemClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val view = LayoutInflater.from(parent.context).inflate(R.layout.tag_item_layout,parent,false)
|
||||||
|
val viewHolder = ViewHolder(view)
|
||||||
|
viewHolder.tagText.setOnLongClickListener {
|
||||||
|
val position = viewHolder.adapterPosition
|
||||||
|
if (position == 0){
|
||||||
|
//标题
|
||||||
|
return@setOnLongClickListener false
|
||||||
|
}
|
||||||
|
var tagsArray :ArrayList<Tags> = ArrayList()
|
||||||
|
val tagsArraySp = context.getSharedPreferences("tags_sp",Context.MODE_PRIVATE)
|
||||||
|
val tagsArrayJson = tagsArraySp.getString("array",null)
|
||||||
|
if (tagsArrayJson!=null){
|
||||||
|
val tagListType = object :TypeToken<ArrayList<Tags>>(){}.type
|
||||||
|
tagsArray = Gson().fromJson(tagsArrayJson,tagListType)
|
||||||
|
}
|
||||||
|
tagsArray.add(Tags(viewHolder.tagText.text.toString()))
|
||||||
|
tagsArraySp.edit().putString("array",Gson().toJson(tagsArray)).apply()
|
||||||
|
Toast.makeText(context,"收藏了新标签",Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
|
return@setOnLongClickListener true
|
||||||
|
}
|
||||||
|
return viewHolder
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
val tag = tagList[position]
|
||||||
|
holder.tagText.text = tag.tag
|
||||||
|
holder.tagText.setOnClickListener {
|
||||||
|
mOnItemClickListener.onItemClick(it,position)
|
||||||
|
}
|
||||||
|
if (position == 0){
|
||||||
|
holder.tagText.setBackgroundResource(R.drawable.title_bg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount(): Int {
|
||||||
|
return tagList.size
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
package com.lsp.view.setting
|
package com.lsp.view.activity.setting
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
package com.lsp.view.setting
|
package com.lsp.view.activity.setting
|
||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -8,7 +8,6 @@ import android.widget.ArrayAdapter
|
|||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.lsp.view.R
|
import com.lsp.view.R
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class SettingsActivity_BackUp : AppCompatActivity(), AdapterView.OnItemSelectedListener {
|
class SettingsActivity_BackUp : AppCompatActivity(), AdapterView.OnItemSelectedListener {
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout 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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.favtag.FavTagActivity">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/tag_recy"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".login.LoginActivity">
|
tools:context=".activity.login.LoginActivity">
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginTop="160dp"
|
android:layout_marginTop="160dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
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=".main.MainActivity">
|
tools:context=".activity.main.MainActivity">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|
||||||
android:id="@+id/rl"
|
android:id="@+id/rl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".main.MainActivity">
|
tools:context=".activity.main.MainActivity">
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -116,7 +116,11 @@
|
|||||||
app:menu="@menu/nav_menu"
|
app:menu="@menu/nav_menu"
|
||||||
app:headerLayout="@layout/nav_header"
|
app:headerLayout="@layout/nav_header"
|
||||||
/>
|
/>
|
||||||
<!-- TODO 侧边连:登录 收藏 Tag列表-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TODO 侧边连:登录 收藏 Tag列表-->
|
||||||
|
|
||||||
|
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".pic.PicActivity">
|
tools:context=".activity.pic.PicActivity">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/fav_tag"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="#fff"
|
||||||
|
android:background="@drawable/item_bg"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
android:id="@+id/fav"
|
android:id="@+id/fav"
|
||||||
android:icon="@drawable/ic_baseline_favorite_24"
|
android:icon="@drawable/ic_baseline_favorite_24"
|
||||||
android:title="Favorite"/>
|
android:title="Favorite"/>
|
||||||
<!-- <item-->
|
<item
|
||||||
<!-- android:id="@+id/taglist"-->
|
android:id="@+id/taglist"
|
||||||
<!-- android:icon="@drawable/ic_baseline_label_24"-->
|
android:icon="@drawable/ic_baseline_label_24"
|
||||||
<!-- android:title="Tags"/>-->
|
android:title="FavTags"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/setting"
|
android:id="@+id/setting"
|
||||||
android:icon="@drawable/setting_icon"
|
android:icon="@drawable/setting_icon"
|
||||||
|
|||||||
Reference in New Issue
Block a user