mirror of
https://github.com/openlibrecommunity/olcng.git
synced 2026-07-03 14:05:17 +02:00
style: remove underlines from navigation drawer links and update text styling and labels
This commit is contained in:
@@ -82,8 +82,31 @@ class MainActivity : HelperBaseActivity(), NavigationView.OnNavigationItemSelect
|
||||
binding.drawerLayout.addDrawerListener(toggle)
|
||||
toggle.syncState()
|
||||
binding.navView.setNavigationItemSelectedListener(this)
|
||||
findViewById<android.widget.TextView>(R.id.tv_forked)?.movementMethod = android.text.method.LinkMovementMethod.getInstance()
|
||||
findViewById<android.widget.TextView>(R.id.tv_developed)?.movementMethod = android.text.method.LinkMovementMethod.getInstance()
|
||||
fun removeUnderlines(textView: android.widget.TextView?) {
|
||||
if (textView == null) return
|
||||
textView.movementMethod = android.text.method.LinkMovementMethod.getInstance()
|
||||
val text = textView.text
|
||||
if (text is android.text.Spanned) {
|
||||
val spannable = android.text.SpannableStringBuilder(text)
|
||||
val spans = spannable.getSpans(0, spannable.length, android.text.style.URLSpan::class.java)
|
||||
for (span in spans) {
|
||||
val start = spannable.getSpanStart(span)
|
||||
val end = spannable.getSpanEnd(span)
|
||||
val flags = spannable.getSpanFlags(span)
|
||||
val url = span.url
|
||||
spannable.removeSpan(span)
|
||||
spannable.setSpan(object : android.text.style.URLSpan(url) {
|
||||
override fun updateDrawState(ds: android.text.TextPaint) {
|
||||
super.updateDrawState(ds)
|
||||
ds.isUnderlineText = false
|
||||
}
|
||||
}, start, end, flags)
|
||||
}
|
||||
textView.text = spannable
|
||||
}
|
||||
}
|
||||
removeUnderlines(findViewById(R.id.tv_forked))
|
||||
removeUnderlines(findViewById(R.id.tv_developed))
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
|
||||
@@ -150,7 +150,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/drawer_forked_text"
|
||||
android:textColorLink="?attr/colorAccent"
|
||||
android:textColor="#9E9E9E"
|
||||
android:textColorLink="#9E9E9E"
|
||||
android:linksClickable="true"
|
||||
android:textIsSelectable="true" />
|
||||
|
||||
@@ -160,7 +161,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/drawer_developed_text"
|
||||
android:textColorLink="?attr/colorAccent"
|
||||
android:textColor="#9E9E9E"
|
||||
android:textColorLink="#9E9E9E"
|
||||
android:linksClickable="true"
|
||||
android:textIsSelectable="true" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<string name="navigation_drawer_close">Закрыть панель навигации</string>
|
||||
<string name="migration_success">Успешный перенос данных!</string>
|
||||
<string name="drawer_forked_text">forked from <a href="https://github.com/2dust/v2rayng">V2RayNG</a></string>
|
||||
<string name="drawer_developed_text">developed by developers from <a href="https://t.me/openlibrecommunity">openlibrecommunity</a></string>
|
||||
<string name="drawer_developed_text">developed by developers from <a href="https://t.me/openlibrecommunity">Olc</a></string>
|
||||
<string name="action_stop_service">Остановить службу</string>
|
||||
<string name="migration_fail">Перенос данных не выполнен!</string>
|
||||
<string name="pull_down_to_refresh">Потяните вниз для обновления!</string>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="migration_success">Data migration success!</string>
|
||||
<string name="drawer_forked_text">forked from <a href="https://github.com/2dust/v2rayng">V2RayNG</a></string>
|
||||
<string name="drawer_developed_text">developed by developers from <a href="https://t.me/openlibrecommunity">openlibrecommunity</a></string>
|
||||
<string name="drawer_developed_text">developed by developers from <a href="https://t.me/openlibrecommunity">Olc</a></string>
|
||||
<string name="action_stop_service">Stop service</string>
|
||||
<string name="migration_fail">Data migration failed!</string>
|
||||
<string name="pull_down_to_refresh">Please pull down to refresh!</string>
|
||||
|
||||
Reference in New Issue
Block a user