diff --git a/app/build.gradle b/app/build.gradle index 4faed20..de145f8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" - } -} \ No newline at end of file diff --git a/app/src/main/java/top/fumiama/copymanga/ui/home/HomeFragment.kt b/app/src/main/java/top/fumiama/copymanga/ui/home/HomeFragment.kt index 6cc8d8a..94a8903 100644 --- a/app/src/main/java/top/fumiama/copymanga/ui/home/HomeFragment.kt +++ b/app/src/main/java/top/fumiama/copymanga/ui/home/HomeFragment.kt @@ -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(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(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(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(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() diff --git a/build.gradle b/build.gradle index 8334b16..9f9ecb3 100644 --- a/build.gradle +++ b/build.gradle @@ -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