small touchups

This commit is contained in:
deniscerri 2023-03-18 18:40:47 +01:00
parent 678571685e
commit 800b82b7bd
No known key found for this signature in database
GPG key ID: 95C43D517D830350
3 changed files with 38 additions and 27 deletions

View file

@ -123,10 +123,10 @@ dependencies {
implementation "androidx.appcompat:appcompat:$appCompatVer" implementation "androidx.appcompat:appcompat:$appCompatVer"
implementation "androidx.constraintlayout:constraintlayout:2.1.4" implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation 'com.google.android.material:material:1.9.0-alpha02' implementation 'com.google.android.material:material:1.9.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.core:core:1.9.0' implementation 'androidx.core:core:1.9.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'androidx.preference:preference:1.2.0' implementation 'androidx.preference:preference:1.2.0'
implementation "androidx.navigation:navigation-fragment-ktx:2.5.3" implementation "androidx.navigation:navigation-fragment-ktx:2.5.3"
implementation "androidx.navigation:navigation-ui-ktx:2.5.3" implementation "androidx.navigation:navigation-ui-ktx:2.5.3"
@ -137,7 +137,7 @@ dependencies {
androidTestImplementation "junit:junit:$junitVer" androidTestImplementation "junit:junit:$junitVer"
androidTestImplementation "androidx.test.ext:junit:$androidJunitVer" androidTestImplementation "androidx.test.ext:junit:$androidJunitVer"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVer" androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVer"
androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha10" androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha11"
androidTestImplementation "androidx.test:runner:1.5.2" androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:core:1.5.0" androidTestImplementation "androidx.test:core:1.5.0"
androidTestImplementation "androidx.test:rules:1.5.0" androidTestImplementation "androidx.test:rules:1.5.0"

View file

@ -101,6 +101,7 @@ class CommandTemplateViewModel(private val application: Application) : AndroidVi
fun exportToClipboard() = viewModelScope.launch(Dispatchers.IO) { fun exportToClipboard() = viewModelScope.launch(Dispatchers.IO) {
try{
val allTemplates = repository.getAll() val allTemplates = repository.getAll()
val allShortcuts = repository.getAllShortCuts() val allShortcuts = repository.getAllShortCuts()
val output = jsonFormat.encodeToString( val output = jsonFormat.encodeToString(
@ -113,6 +114,9 @@ class CommandTemplateViewModel(private val application: Application) : AndroidVi
val clipboard: ClipboardManager = val clipboard: ClipboardManager =
application.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager application.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
clipboard.setText(output) clipboard.setText(output)
}catch (e: Exception){
e.printStackTrace()
}
} }
} }

View file

@ -215,6 +215,7 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
val linkYouCopied = searchView.findViewById<ConstraintLayout>(R.id.link_you_copied) val linkYouCopied = searchView.findViewById<ConstraintLayout>(R.id.link_you_copied)
searchView.addTransitionListener { view, previousState, newState -> searchView.addTransitionListener { view, previousState, newState ->
if (newState == SearchView.TransitionState.SHOWN) { if (newState == SearchView.TransitionState.SHOWN) {
try{
val clipboard = val clipboard =
requireContext().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager requireContext().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
val regex = val regex =
@ -235,6 +236,10 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
}else{ }else{
linkYouCopied.visibility = GONE linkYouCopied.visibility = GONE
} }
}catch (e: Exception){
e.printStackTrace()
linkYouCopied.visibility = GONE
}
} }
} }
@ -289,7 +294,9 @@ class HomeFragment : Fragment(), HomeAdapter.OnItemClickListener, View.OnClickLi
} }
} }
searchHistoryLinearLayout!!.visibility = VISIBLE searchHistoryLinearLayout!!.visibility = VISIBLE
linkYouCopied!!.visibility = VISIBLE if (linkYouCopied.findViewById<TextView>(R.id.suggestion_text).text.isNotEmpty()){
linkYouCopied.visibility = VISIBLE
}
}else{ }else{
for (i in suggestions.indices) { for (i in suggestions.indices) {
val v = LayoutInflater.from(fragmentContext) val v = LayoutInflater.from(fragmentContext)