This commit is contained in:
Benoit Marty 2022-01-18 12:12:04 +01:00 committed by Benoit Marty
parent e8d71feef1
commit 2a7719cdf6
9 changed files with 11 additions and 15 deletions

View File

@ -237,7 +237,6 @@ internal class JSonViewerEpoxyController(private val context: Context) :
) )
itemClickListener(View.OnClickListener { host.itemClicked(composed) }) itemClickListener(View.OnClickListener { host.itemClicked(composed) })
} }
} }
private fun itemClicked(model: JSonViewerModel) { private fun itemClicked(model: JSonViewerModel) {

View File

@ -38,7 +38,6 @@ internal data class JSonViewerFragmentArgs(
val styleProvider: JSonViewerStyleProvider? val styleProvider: JSonViewerStyleProvider?
) : Parcelable ) : Parcelable
class JSonViewerFragment : Fragment(), MavericksView { class JSonViewerFragment : Fragment(), MavericksView {
private val viewModel: JSonViewerViewModel by fragmentViewModel() private val viewModel: JSonViewerViewModel by fragmentViewModel()

View File

@ -38,7 +38,6 @@ internal class JSonViewerObject(key: String?, index: Int?, jObject: JSONObject)
override fun addChild(model: JSonViewerModel) { override fun addChild(model: JSonViewerModel) {
keys[model.key!!] = model keys[model.key!!] = model
} }
} }
internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) : internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) :
@ -53,7 +52,6 @@ internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) :
internal class JSonViewerLeaf(key: String?, index: Int?, val stringRes: String, val type: JSONType) : internal class JSonViewerLeaf(key: String?, index: Int?, val stringRes: String, val type: JSONType) :
JSonViewerModel(key, index, stringRes) JSonViewerModel(key, index, stringRes)
internal enum class JSONType { internal enum class JSONType {
STRING, STRING,
NUMBER, NUMBER,

View File

@ -43,4 +43,3 @@ data class JSonViewerStyleProvider(
) )
} }
} }

View File

@ -16,7 +16,15 @@
package org.billcarsonfr.jsonviewer package org.billcarsonfr.jsonviewer
import com.airbnb.mvrx.* import com.airbnb.mvrx.Async
import com.airbnb.mvrx.Fail
import com.airbnb.mvrx.Loading
import com.airbnb.mvrx.MavericksState
import com.airbnb.mvrx.MavericksViewModel
import com.airbnb.mvrx.MavericksViewModelFactory
import com.airbnb.mvrx.Success
import com.airbnb.mvrx.Uninitialized
import com.airbnb.mvrx.ViewModelContext
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
internal data class JSonViewerState( internal data class JSonViewerState(
@ -61,7 +69,6 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) :
} catch (failure: Throwable) { } catch (failure: Throwable) {
JSonViewerState(Fail(failure)) JSonViewerState(Fail(failure))
} }
} }
} }
} }

View File

@ -75,7 +75,6 @@ internal abstract class ValueItem : EpoxyModelWithHolder<ValueItem.Holder>() {
v: View?, v: View?,
menuInfo: ContextMenu.ContextMenuInfo? menuInfo: ContextMenu.ContextMenuInfo?
) { ) {
if (copyValue != null) { if (copyValue != null) {
val menuItem = menu?.add( val menuItem = menu?.add(
Menu.NONE, R.id.copy_value, Menu.NONE, R.id.copy_value,

View File

@ -69,28 +69,23 @@ class ModelParseTest {
Assert.assertEquals(JSONType.STRING, it.type) Assert.assertEquals(JSONType.STRING, it.type)
} }
Assert.assertTrue(glossary.keys["GlossDiv"] is JSonViewerObject) Assert.assertTrue(glossary.keys["GlossDiv"] is JSonViewerObject)
val glossDiv = glossary.keys["GlossDiv"] as JSonViewerObject val glossDiv = glossary.keys["GlossDiv"] as JSonViewerObject
Assert.assertTrue(glossDiv.keys["GlossList"] is JSonViewerObject) Assert.assertTrue(glossDiv.keys["GlossList"] is JSonViewerObject)
val glossList = glossDiv.keys["GlossList"] as JSonViewerObject val glossList = glossDiv.keys["GlossList"] as JSonViewerObject
Assert.assertTrue(glossList.keys["GlossEntry"] is JSonViewerObject) Assert.assertTrue(glossList.keys["GlossEntry"] is JSonViewerObject)
val glossEntry = glossList.keys["GlossEntry"] as JSonViewerObject val glossEntry = glossList.keys["GlossEntry"] as JSonViewerObject
Assert.assertTrue(glossEntry.keys["GlossDef"] is JSonViewerObject) Assert.assertTrue(glossEntry.keys["GlossDef"] is JSonViewerObject)
val glossDef = glossEntry.keys["GlossDef"] as JSonViewerObject val glossDef = glossEntry.keys["GlossDef"] as JSonViewerObject
Assert.assertTrue(glossDef.keys["GlossSeeAlso"] is JSonViewerArray) Assert.assertTrue(glossDef.keys["GlossSeeAlso"] is JSonViewerArray)
val glossSeeAlso = glossDef.keys["GlossSeeAlso"] as JSonViewerArray val glossSeeAlso = glossDef.keys["GlossSeeAlso"] as JSonViewerArray
Assert.assertEquals(2, glossSeeAlso.items.size) Assert.assertEquals(2, glossSeeAlso.items.size)
Assert.assertEquals("0", glossSeeAlso.items.first().key) Assert.assertEquals("0", glossSeeAlso.items.first().key)
Assert.assertEquals("GML", (glossSeeAlso.items.first() as JSonViewerLeaf).stringRes) Assert.assertEquals("GML", (glossSeeAlso.items.first() as JSonViewerLeaf).stringRes)
} }
} }

View File

@ -18,8 +18,8 @@ package im.vector.app.features.analytics
import im.vector.app.core.flow.tickerFlow import im.vector.app.core.flow.tickerFlow
import im.vector.app.core.time.Clock import im.vector.app.core.time.Clock
import im.vector.app.features.analytics.plan.Error
import im.vector.app.core.utils.compat.removeIfCompat import im.vector.app.core.utils.compat.removeIfCompat
import im.vector.app.features.analytics.plan.Error
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob

View File

@ -31,8 +31,8 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.transition.AutoTransition import androidx.transition.AutoTransition
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
import im.vector.app.R import im.vector.app.R
import im.vector.app.features.reactions.data.EmojiData
import im.vector.app.core.utils.compat.removeIfCompat import im.vector.app.core.utils.compat.removeIfCompat
import im.vector.app.features.reactions.data.EmojiData
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch