ui: only show a snackbar for Android 12 and lower
Signed-off-by: SlipkHunter <abrito025@gmail.com> Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
56be913fa4
commit
0be12b8d07
@ -6,6 +6,7 @@ package com.wireguard.android.util
|
|||||||
|
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
|
import android.os.Build
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
@ -29,6 +30,8 @@ object ClipboardUtils {
|
|||||||
}
|
}
|
||||||
val service = view.context.getSystemService<ClipboardManager>() ?: return
|
val service = view.context.getSystemService<ClipboardManager>() ?: return
|
||||||
service.setPrimaryClip(ClipData.newPlainText(data.second, data.first))
|
service.setPrimaryClip(ClipData.newPlainText(data.second, data.first))
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
Snackbar.make(view, view.context.getString(R.string.copied_to_clipboard, data.second), Snackbar.LENGTH_LONG).show()
|
Snackbar.make(view, view.context.getString(R.string.copied_to_clipboard, data.second), Snackbar.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user