Skip to content

Instantly share code, notes, and snippets.

View prabhat1707's full-sized avatar
🏠
Working from home

Prabhat Rai prabhat1707

🏠
Working from home
  • New Delhi(India)
View GitHub Profile
const renderItem = ({ item }) => (<Text key={item.key}>{item.key}</Text>);
// we set the height of item is fixed
const getItemLayout = (data, index) => (
{length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index}
);
const items = [{ key: 'a' }, { key: 'b'}, ...+400];
function render () => (
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
// alternatively - just ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" // For Kotlin use lifecycle-viewmodel-ktx
// alternatively - just LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
// alternatively - Lifecycles only (no ViewModel or LiveData). Some UI
// AndroidX libraries use this lightweight import for Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
private val bodyJoints = listOf(
Pair(0, 1),
Pair(1, 2),
----------,
)
private fun drawCircle(body: String?, bitmap: Bitmap) {
val list = ArrayList<Position>()
body?.let { data ->
---------------
{"id": 37, "key_points": [{"Point": 0, "x": 654.2608695652174, "y": 303.1304347826087}, {"Point": 1, "x": 654.2608695652174, "y": 492.5869565217391}, {"Point": 2, "x": 743.4782608695652, "y": 530.4782608695652}, {"Point": 3, "x": 832.695652173913, "y": 303.1304347826087}, {"Point": 4, "x": 684.0, "y": 227.34782608695653}, {"Point": 5, "x": 535.304347826087, "y": 492.5869565217391}, {"Point": 6, "x": 475.82608695652175, "y": 303.1304347826087}, {"Point": 7, "x": 624.5217391304348, "y": 227.34782608695653}, {"Point": 8, "x": 713.7391304347826, "y": 871.5}, {"Point": 9, "x": 981.3913043478261, "y": 1060.9565217391305}, {"Point": 10, "x": 713.7391304347826, "y": 1136.7391304347825}, {"Point": 11, "x": 594.7826086956521, "y": 909.3913043478261}, {"Point": 12, "x": 624.5217391304348, "y": 1212.5217391304348}, {"Point": 13, "x": 684.0, "y": 1553.5434782608695}, {"Point": 14, "x": 654.2608695652174, "y": 719.9347826086956}], "pair_angles": [{"pair": [0, 1], "angle": -90.0}, {"pair": [1, 2], "angle": -156.988699555375
package test;
import android.arch.lifecycle.LiveData;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;