Skip to content

Commit d3dae91

Browse files
authored
Minor Fixes (#29)
- Fix Double Copy Toast - Fix Host and User Focus - Cleanup Unused Files
1 parent f57d0c5 commit d3dae91

File tree

8 files changed

+14
-94
lines changed

8 files changed

+14
-94
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
.gradle/
88
.kotlin/
99
captures/
10+
app/debug
1011
app/release
1112

1213
local.properties

app/src/main/java/com/djangofiles/djangofiles/MainActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,16 @@ class MainActivity : AppCompatActivity() {
444444
}
445445
}
446446

447-
fun copyToClipboard(context: Context, url: String) {
447+
fun copyToClipboard(context: Context, url: String, msg: String? = null) {
448448
Log.d("copyToClipboard", "url: $url")
449+
var message = msg
450+
if (msg == null){
451+
message = context.getString(R.string.tst_copied_clipboard)
452+
}
449453
val clipboard = context.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
450454
val clip = ClipData.newPlainText("URL", url)
451455
clipboard.setPrimaryClip(clip)
452-
Toast.makeText(context, "Copied URL to Clipboard.", Toast.LENGTH_SHORT).show()
456+
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
453457
}
454458

455459
fun isURL(url: String): Boolean {

app/src/main/java/com/djangofiles/djangofiles/ui/PreviewFragment.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,6 @@ class PreviewFragment : Fragment() {
204204
withContext(Dispatchers.Main) {
205205
if (fileResponse != null) {
206206
copyToClipboard(requireContext(), fileResponse.url)
207-
val msg = getString(R.string.tst_copied_clipboard)
208-
Log.d("processUpload", "msg: $msg")
209-
Toast.makeText(requireContext(), msg, Toast.LENGTH_SHORT).show()
210207
navController.navigate(
211208
R.id.nav_item_home,
212209
bundleOf("url" to fileResponse.url),

app/src/main/java/com/djangofiles/djangofiles/ui/ShortFragment.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ class ShortFragment : Fragment() {
152152
withContext(Dispatchers.Main) {
153153
if (shortResponse != null) {
154154
copyToClipboard(requireContext(), shortResponse.url)
155-
val msg = getString(R.string.tst_copied_clipboard)
156-
Toast.makeText(requireContext(), msg, Toast.LENGTH_SHORT).show()
157155
val shareUrl = sharedPreferences.getBoolean("share_after_short", true)
158156
Log.d("processShort", "shareUrl: $shareUrl")
159157
if (shareUrl) {

app/src/main/java/com/djangofiles/djangofiles/ui/settings/LoginFragment.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class LoginFragment : Fragment() {
5656
Log.d("Main[onCreate]", "versionName: $versionName")
5757

5858
binding.hostnameText.requestFocus()
59+
binding.hostnameText.setSelection(binding.hostnameText.text.length)
5960

6061
val loginFunction = View.OnClickListener {
6162
Log.d("OnClickListener", "it: ${it.id}")

app/src/main/java/com/djangofiles/djangofiles/ui/settings/LoginTwoFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.djangofiles.djangofiles.databinding.FragmentLoginTwoBinding
2525
import kotlinx.coroutines.Dispatchers
2626
import kotlinx.coroutines.launch
2727
import kotlinx.coroutines.withContext
28+
import androidx.core.view.isVisible
2829

2930
class LoginTwoFragment : Fragment() {
3031

@@ -80,6 +81,10 @@ class LoginTwoFragment : Fragment() {
8081
}
8182
}
8283

84+
if (binding.loginLocal.isVisible){
85+
binding.loginUsername.requestFocus()
86+
}
87+
8388
val sharedPreferences =
8489
requireContext().getSharedPreferences("AppPreferences", MODE_PRIVATE)
8590

app/src/main/res/layout/fragment_setup.xml

Lines changed: 0 additions & 84 deletions
This file was deleted.

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
<string name="tst_upload_error">Error Uploading!</string>
77
<string name="tst_no_url">URL Not Set!</string>
8-
<string name="tst_copied_clipboard">Copied to Clipboard.</string>
98
<string name="tst_uploading_file">Uploading File…</string>
9+
<string name="tst_copied_clipboard">Copied to Clipboard</string>
1010

1111
<string name="upload">Upload</string>
1212
<string name="upload_file">Upload File</string>
@@ -21,6 +21,4 @@
2121
<string name="vanity">Vanity</string>
2222
<string name="file_name">File Name</string>
2323
<string name="shorten_url">Shorten URL</string>
24-
25-
<string name="github_link"><![CDATA[<a href="https://django-files.github.io/">https://django-files.github.io</a>]]></string>
2624
</resources>

0 commit comments

Comments
 (0)