1
0
mirror of https://github.com/fumiama/copymanga.git synced 2026-06-08 08:50:27 +08:00

2.0.beta8

1. 增加搜索
2. 升级sdk、api
3. 优化更新
This commit is contained in:
fumiama
2022-01-18 17:12:09 +08:00
parent f1c7a6ad62
commit 5811a4da13
3 changed files with 75 additions and 136 deletions

View File

@@ -1,27 +1,8 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'AndResGuard'
android {
signingConfigs {
release {
storeFile file('../../../OneDrive/swc/developer/android_key/open_key')
storePassword 'fumiama'
keyAlias 'default'
keyPassword 'fumiama'
v1SigningEnabled true
v2SigningEnabled true
}
/*winrelease {
storeFile file('C:/Users/spayi/OneDrive/swc/developer/android_key/open_key')
storePassword 'fumiama'
keyAlias 'default'
keyPassword 'fumiama'
v1SigningEnabled true
v2SigningEnabled true
}*/
}
compileSdkVersion 31
defaultConfig {
@@ -40,19 +21,16 @@ android {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
/*winrelease {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.winrelease
}
debug{
minifyEnabled false
shrinkResources false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.winrelease
}*/
}
compileOptions {
@@ -98,42 +76,3 @@ dependencies {
implementation 'com.github.zawadz88.materialpopupmenu:material-popup-menu:4.0.1'
implementation 'com.lapism:search:2.4.1@aar'
}
andResGuard {
// mappingFile = file("./resource_mapping.txt")
mappingFile = null
use7zip = true
useSign = true
// It will keep the origin path of your resources when it's true
keepRoot = false
// If set, name column in arsc those need to proguard will be kept to this value
fixedResName = "arg"
// It will merge the duplicated resources, but don't rely on this feature too much.
// it's always better to remove duplicated resource from repo
mergeDuplicatedRes = true
whiteList = [
// your icon
"R.drawable.icon",
// for fabric
"R.string.com.crashlytics.*",
// for google-services
"R.string.google_app_id",
"R.string.gcm_defaultSenderId",
"R.string.default_web_client_id",
"R.string.ga_trackingId",
"R.string.firebase_database_url",
"R.string.google_api_key",
"R.string.google_crash_reporting_api_key"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
"resources.arsc"
]
sevenzip {
//artifact = 'com.tencent.mm:SevenZip:1.2.20'
path = "7za"
}
}

View File

@@ -45,82 +45,83 @@ class HomeFragment : NoBackRefreshFragment(R.layout.fragment_home) {
resources.getColor(R.color.colorBlue2, theme),
resources.getColor(R.color.colorGreen, theme))
fhs.apply {
val recyclerView = findViewById<RecyclerView>(R.id.search_recycler_view)
setAdapterLayoutManager(LinearLayoutManager(context))
val adapter = ListViewHolder(recyclerView).RecyclerViewAdapter()
setAdapter(adapter)
navigationIconSupport = SearchLayout.NavigationIconSupport.SEARCH
setMicIconImageResource(R.drawable.ic_setting_search)
val micView = findViewById<ImageButton>(R.id.search_image_view_mic)
setClearFocusOnBackPressed(true)
setOnNavigationClickListener(object : SearchLayout.OnNavigationClickListener {
override fun onNavigationClick(hasFocus: Boolean) {
if (hasFocus()) {
clearFocus()
}
else requestFocus()
}
})
setTextHint(android.R.string.search_go)
setOnQueryTextListener(object : SearchLayout.OnQueryTextListener {
var lastChangeTime = 0L
override fun onQueryTextChange(newText: CharSequence): Boolean {
postDelayed({
val diff = System.currentTimeMillis() - lastChangeTime
if(diff > 500) {
if (newText.isNotEmpty()) adapter.refresh(newText)
}
}, 1024)
lastChangeTime = System.currentTimeMillis()
return true
}
override fun onQueryTextSubmit(query: CharSequence): Boolean {
/*if(query.isNotEmpty()) {
val key = query.toString()
Toast.makeText(context, key, Toast.LENGTH_SHORT).show()
}*/
return true
}
})
setOnMicClickListener(object : SearchLayout.OnMicClickListener {
val types = arrayOf("", "name", "author", "local")
var i = 0
override fun onMicClick() {
val typenames = resources.getStringArray(R.array.search_types)
AlertDialog.Builder(ContextThemeWrapper(context, R.style.AlertDialogTheme))
.setTitle(R.string.set_search_types)
.setIcon(R.mipmap.ic_launcher)
.setSingleChoiceItems(ArrayAdapter(context, R.layout.line_choice_list, typenames), i){ d, p ->
adapter.type = types[p]
i = p
d.cancel()
}.show()
}
})
setOnFocusChangeListener(object : SearchLayout.OnFocusChangeListener {
override fun onFocusChange(hasFocus: Boolean) {
navigationIconSupport = if (hasFocus) SearchLayout.NavigationIconSupport.ARROW
else {
micView.postDelayed({ micView.visibility = View.VISIBLE }, 233)
SearchLayout.NavigationIconSupport.SEARCH
}
}
})
fhns.setOnTouchListener { _, e ->
if (e.action == MotionEvent.ACTION_UP && mSearchEditText?.text?.isNotEmpty() == true) {
ime?.hideSoftInputFromWindow(mainWeakReference?.get()?.window?.decorView?.windowToken, 0)
}
false
}
}
Thread{
homeHandler.obtainMessage(-1, true).sendToTarget()
while(mainWeakReference?.get()?.isDrawerClosed != true) sleep(233)
//homeHandler.sendEmptyMessage(6) //removeAllViews
fhs.apply {
val recyclerView = findViewById<RecyclerView>(R.id.search_recycler_view)
setAdapterLayoutManager(LinearLayoutManager(context))
val adapter = ListViewHolder(recyclerView).RecyclerViewAdapter()
setAdapter(adapter)
navigationIconSupport = SearchLayout.NavigationIconSupport.SEARCH
setMicIconImageResource(R.drawable.ic_setting_search)
val micView = findViewById<ImageButton>(R.id.search_image_view_mic)
setClearFocusOnBackPressed(true)
setOnNavigationClickListener(object : SearchLayout.OnNavigationClickListener {
override fun onNavigationClick(hasFocus: Boolean) {
if (hasFocus()) {
clearFocus()
}
else requestFocus()
}
})
setTextHint(android.R.string.search_go)
setOnQueryTextListener(object : SearchLayout.OnQueryTextListener {
var lastChangeTime = 0L
override fun onQueryTextChange(newText: CharSequence): Boolean {
postDelayed({
val diff = System.currentTimeMillis() - lastChangeTime
if(diff > 500) {
if (newText.isNotEmpty()) adapter.refresh(newText)
}
}, 1024)
lastChangeTime = System.currentTimeMillis()
return true
}
override fun onQueryTextSubmit(query: CharSequence): Boolean {
/*if(query.isNotEmpty()) {
val key = query.toString()
Toast.makeText(context, key, Toast.LENGTH_SHORT).show()
}*/
return true
}
})
setOnMicClickListener(object : SearchLayout.OnMicClickListener {
val types = arrayOf("", "name", "author", "local")
var i = 0
override fun onMicClick() {
val typenames = resources.getStringArray(R.array.search_types)
AlertDialog.Builder(ContextThemeWrapper(context, R.style.AlertDialogTheme))
.setTitle(R.string.set_search_types)
.setIcon(R.mipmap.ic_launcher)
.setSingleChoiceItems(ArrayAdapter(context, R.layout.line_choice_list, typenames), i){ d, p ->
adapter.type = types[p]
i = p
d.cancel()
}.show()
}
})
setOnFocusChangeListener(object : SearchLayout.OnFocusChangeListener {
override fun onFocusChange(hasFocus: Boolean) {
navigationIconSupport = if (hasFocus) SearchLayout.NavigationIconSupport.ARROW
else {
micView.postDelayed({ micView.visibility = View.VISIBLE }, 233)
SearchLayout.NavigationIconSupport.SEARCH
}
}
})
fhns.setOnTouchListener { _, e ->
if (e.action == MotionEvent.ACTION_UP && mSearchEditText?.text?.isNotEmpty() == true) {
ime?.hideSoftInputFromWindow(mainWeakReference?.get()?.window?.decorView?.windowToken, 0)
}
false
}
}
homeHandler.fhib = null
sleep(600)
homeHandler.startLoad()

View File

@@ -11,7 +11,6 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files