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) })
}
}
private fun itemClicked(model: JSonViewerModel) {

View file

@ -38,7 +38,6 @@ internal data class JSonViewerFragmentArgs(
val styleProvider: JSonViewerStyleProvider?
) : Parcelable
class JSonViewerFragment : Fragment(), MavericksView {
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) {
keys[model.key!!] = model
}
}
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) :
JSonViewerModel(key, index, stringRes)
internal enum class JSONType {
STRING,
NUMBER,

View file

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

View file

@ -16,7 +16,15 @@
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
internal data class JSonViewerState(
@ -61,7 +69,6 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) :
} catch (failure: Throwable) {
JSonViewerState(Fail(failure))
}
}
}
}

View file

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

View file

@ -69,28 +69,23 @@ class ModelParseTest {
Assert.assertEquals(JSONType.STRING, it.type)
}
Assert.assertTrue(glossary.keys["GlossDiv"] is JSonViewerObject)
val glossDiv = glossary.keys["GlossDiv"] as JSonViewerObject
Assert.assertTrue(glossDiv.keys["GlossList"] is JSonViewerObject)
val glossList = glossDiv.keys["GlossList"] as JSonViewerObject
Assert.assertTrue(glossList.keys["GlossEntry"] is JSonViewerObject)
val glossEntry = glossList.keys["GlossEntry"] as JSonViewerObject
Assert.assertTrue(glossEntry.keys["GlossDef"] is JSonViewerObject)
val glossDef = glossEntry.keys["GlossDef"] as JSonViewerObject
Assert.assertTrue(glossDef.keys["GlossSeeAlso"] is JSonViewerArray)
val glossSeeAlso = glossDef.keys["GlossSeeAlso"] as JSonViewerArray
Assert.assertEquals(2, glossSeeAlso.items.size)
Assert.assertEquals("0", glossSeeAlso.items.first().key)
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.time.Clock
import im.vector.app.features.analytics.plan.Error
import im.vector.app.core.utils.compat.removeIfCompat
import im.vector.app.features.analytics.plan.Error
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob

View file

@ -31,8 +31,8 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.transition.AutoTransition
import androidx.transition.TransitionManager
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.features.reactions.data.EmojiData
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch