mirror of
https://github.com/fumiama/simple-dict-android.git
synced 2026-06-05 00:30:24 +08:00
v1.4
This commit is contained in:
@@ -13,8 +13,8 @@ android {
|
||||
applicationId "top.fumiama.simpledict"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
versionCode 5
|
||||
versionName '1.3'
|
||||
versionCode 6
|
||||
versionName '1.4'
|
||||
resConfigs "zh", "zh-rCN"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package top.fumiama.simpledict
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.speech.RecognizerIntent
|
||||
@@ -14,7 +17,6 @@ import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import com.lapism.search.internal.SearchLayout
|
||||
import com.lapism.search.util.SearchUtils
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
@@ -31,12 +33,14 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
private var cm: ClipboardManager? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
val ad = LikeViewHolder(ffr).RecyclerViewAdapter()
|
||||
ffr.apply {
|
||||
cm = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
ffr.apply {
|
||||
layoutManager = LinearLayoutManager(this@MainActivity)
|
||||
adapter = ad
|
||||
setOnScrollChangeListener { _, _, scrollY, _, _ ->
|
||||
@@ -126,13 +130,15 @@ class MainActivity : AppCompatActivity() {
|
||||
.setMessage(data)
|
||||
.setPositiveButton(hintAdd) { _, _ ->
|
||||
val t = EditText(this@MainActivity)
|
||||
t.setText(data)
|
||||
AlertDialog.Builder(this@MainActivity)
|
||||
.setTitle("$hintAdd$key")
|
||||
.setView(t)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
if (t.text.isNotEmpty()) Thread {
|
||||
if (t.text.isNotEmpty() && t.text.toString() != data) Thread {
|
||||
dict[key] = t.text.toString()
|
||||
}.start()
|
||||
else Toast.makeText(this, "未更改", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ -> }
|
||||
.show()
|
||||
@@ -157,7 +163,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
newSet
|
||||
}
|
||||
listKeys = selectSet.toList()
|
||||
listKeys = selectSet.toList().let { if(it.size > 50) it.subList(0, 49) else it }
|
||||
listKeys?.forEach {
|
||||
Log.d("MyMain", "Select key: $it")
|
||||
}
|
||||
@@ -204,9 +210,16 @@ class MainActivity : AppCompatActivity() {
|
||||
setOnClickListener {
|
||||
showDictAlert(key, data)
|
||||
}
|
||||
setOnLongClickListener {
|
||||
cm?.setPrimaryClip(ClipData.newPlainText("SimpleDict", "$key\n$data"))
|
||||
runOnUiThread {
|
||||
Toast.makeText(this@MainActivity, "已复制", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
true
|
||||
}
|
||||
vl.setOnClickListener {
|
||||
getSharedPreferences("dict", MODE_PRIVATE)?.edit()?.apply {
|
||||
if(like) {
|
||||
if (like) {
|
||||
remove(key)
|
||||
it.setBackgroundResource(R.drawable.ic_like)
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,24 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/ffsw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/ffns"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/ffr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -29,22 +47,4 @@
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/ffsw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/ffns"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/ffr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -7,19 +7,6 @@
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground">
|
||||
|
||||
<View
|
||||
android:id="@+id/vl"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/ic_like"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -44,7 +31,18 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<View
|
||||
android:id="@+id/vl"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/ic_like"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Binary file not shown.
@@ -10,8 +10,8 @@
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 5,
|
||||
"versionName": "1.3",
|
||||
"versionCode": 6,
|
||||
"versionName": "1.4",
|
||||
"outputFile": "app-winrelease.apk"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user