Skip to content

Commit

Permalink
Migrate to emoji2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Oct 30, 2021
1 parent c4b3362 commit b866b6b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion mobile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {
implementation("androidx.appcompat:appcompat:1.4.0-rc01") // https://issuetracker.google.com/issues/151603528
implementation("androidx.browser:browser:1.4.0-rc01")
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.emoji:emoji:1.1.0")
implementation("androidx.emoji2:emoji2:1.0.0-rc01")
implementation("androidx.fragment:fragment-ktx:1.3.6")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
Expand Down
4 changes: 2 additions & 2 deletions mobile/src/main/java/be/mygod/vpnhotspot/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import androidx.core.provider.FontRequest
import androidx.emoji.text.EmojiCompat
import androidx.emoji.text.FontRequestEmojiCompatConfig
import androidx.emoji2.text.EmojiCompat
import androidx.emoji2.text.FontRequestEmojiCompatConfig
import androidx.preference.PreferenceManager
import be.mygod.librootkotlinx.NoShellException
import be.mygod.vpnhotspot.net.DhcpWorkaround
Expand Down
2 changes: 1 addition & 1 deletion mobile/src/main/java/be/mygod/vpnhotspot/BootReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class BootReceiver : BroadcastReceiver() {
started = true
}
fun startIfEnabled() {
if (started && userEnabled) startIfNecessary()
if (!started && userEnabled) startIfNecessary()
}
}

Expand Down
2 changes: 1 addition & 1 deletion mobile/src/main/java/be/mygod/vpnhotspot/client/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ open class Client(val mac: MacAddressCompat, val iface: String) {
SpannableStringBuilder(if (record.nickname.isEmpty()) {
if (record.macLookupPending) MacLookup.perform(mac)
macIface
} else emojize(record.nickname)).apply {
} else record.nickname).apply {
if (record.blocked) setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.PopupMenu
import androidx.collection.LongSparseArray
import androidx.databinding.BaseObservable
import androidx.emoji2.text.EmojiCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.findViewTreeLifecycleOwner
Expand Down Expand Up @@ -55,7 +56,7 @@ class ClientsFragment : Fragment() {
setTitle(getString(R.string.clients_nickname_title, MacAddressCompat(arg.mac).toString()))
setPositiveButton(android.R.string.ok, listener)
setNegativeButton(android.R.string.cancel, null)
setNeutralButton(emojize(getText(R.string.clients_nickname_set_to_vendor)), listener)
setNeutralButton(EmojiCompat.get().process(getText(R.string.clients_nickname_set_to_vendor)), listener)
}

override fun onCreateDialog(savedInstanceState: Bundle?) = super.onCreateDialog(savedInstanceState).apply {
Expand Down
9 changes: 0 additions & 9 deletions mobile/src/main/java/be/mygod/vpnhotspot/client/Emojize.kt

This file was deleted.

4 changes: 2 additions & 2 deletions mobile/src/main/res/layout/dialog_nickname.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:viewBindingIgnore="true">
<androidx.emoji.widget.EmojiEditText
<EditText
android:id="@android:id/edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -14,5 +14,5 @@
android:importantForAutofill="no"
tools:text="Nick">
<requestFocus/>
</androidx.emoji.widget.EmojiEditText>
</EditText>
</FrameLayout>

0 comments on commit b866b6b

Please sign in to comment.