Move encoding part too

This commit is contained in:
kyori19 2019-12-01 00:07:33 +09:00
parent f88e2d71e1
commit 32e77346ff
2 changed files with 3 additions and 3 deletions

View File

@ -41,6 +41,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_tab_preference.*
import kotlinx.android.synthetic.main.toolbar_basic.*
import java.net.URLEncoder
import java.util.regex.Pattern
import javax.inject.Inject
@ -229,7 +230,7 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene
.setTitle(R.string.select_list_title)
.setAdapter(adapter) { _, position ->
val list = adapter.getItem(position)
val newTab = createTabDataFromId(LIST, listOf(list!!.id, list.title))
val newTab = createTabDataFromId(LIST, listOf(list!!.id, URLEncoder.encode(list.title, "UTF-8")))
currentTabs.add(newTab)
currentTabsAdapter.notifyItemInserted(currentTabs.size - 1)
updateAvailableTabs()

View File

@ -28,7 +28,6 @@ import com.keylesspalace.tusky.entity.Poll
import com.keylesspalace.tusky.entity.Status
import com.keylesspalace.tusky.json.SpannedTypeAdapter
import com.keylesspalace.tusky.util.HtmlUtils
import java.net.URLEncoder
import java.util.*
class Converters {
@ -69,7 +68,7 @@ class Converters {
@TypeConverter
fun tabDataToString(tabData: List<TabData>?): String? {
// List name may include ":"
return tabData?.joinToString(";") { it.id + ":" + it.arguments.joinToString(":") { s -> URLEncoder.encode(s, "UTF-8") } }
return tabData?.joinToString(";") { it.id + ":" + it.arguments.joinToString(":") }
}
@TypeConverter