Git Product home page Git Product logo

json2view's People

Contributors

brandontsai avatar giorgosera avatar pavlospt avatar tsiougkosn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

json2view's Issues

dynamic set parameters

Find a way to dynamic set values of any View (eg set the value of StarView without any specific code in the library)

xml to json

create a script to easy convert android xml layout to json, in format that json2view lib wants as input

Library's jar file

I can't find the jar file of this library.

where is it?
how do i can find its and add to my gradle ?

Please Give Property for Button onClick In Json2View Basicallly which type they have

Like This
:
{
"properties": [
{
"value": "match_parent",
"type": "dimen",
"name": "layout_width"
},
{
"value": "50dp",
"type": "dimen",
"name": "layout_height"
},

          {
            "value": "20sp",
            "type": "dimen",
            "name": "textSize"
          },
          {
            "name":"GO",
            "type":"string",
            "value":"text"
          }

],
"widget": "TextView"
}
Then tell me the property of android:onClick="deal_week" event and How i call in Android Activity File

多语言下的适配

在土耳其语情况下,I和i是无法通过toUpperCase()和toLowerCase()正常转换的,代码中使用的都是默认的,应该去规定转换目标,例如:toLowerCase(Locale.ENGLISH) toUpperCase(Locale.ENGLISH)

can't get id for child layouts

How can I get the id for child layouts and their view and can i use the existing id with the dynamicview created with json2view.??
And instead of overriding or adding a view can i change the existing views??

VectorDrawable in ImageView

in ImageView we can normally set app:srcCompat="@drawable/ic_whatever" to set a vectorDrawable, instead of PNGs.

Can we have this support in the lib?

counld not add fragment?haw to add fragment

becauce do not has R.id.linerlayout01~~so cound't add fragment~~~~so fuck
getSupportFragmentManager().beginTransaction().add(R.id.linerlayout01,fragmentSample).show(fragmentSample).commit();

textSize in Wiki

Hi,
The page on Available Properties seems to have the type field of textSize incorrectly specified. I think it should be dimen instead of textSize.

Configuration on demand is not supported

Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.

Multi button demo

Can you provide a multi button response routines such as Button1/2/3, Textview1/2/3, Imageview1/2/3, a total of 9 widget.Button1 in response to modify the Textview1/2/3 and Imageview1/2/3 show or not? the Button2 response to modify the Textview1/2/3's Text content.Button3 response to switch Imageview1/2/3 display pictures (assuming 3). thank you very much!

cant create a text view

KOTLIN:

package com.example.libkeyboard2

import android.content.Intent
import android.net.Uri
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.text.method.ScrollingMovementMethod
import android.view.View
import android.view.WindowManager
import android.widget.LinearLayout
import android.widget.TextView
import com.example.libjson.LibJSON
import com.google.gson.*
import com.avocarrot.json2view.DynamicView
import com.avocarrot.json2view.DynamicViewId
import kotlinx.android.synthetic.main.activity_main.view.*
import org.json.JSONObject

class MainActivity : AppCompatActivity() , View.OnClickListener{

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        setContentView(R.layout.x)
//        setContentView(R.layout.activity_main)
//        val textView = findViewById(R.id.text_view) as TextView
//        textView.setMovementMethod(ScrollingMovementMethod())
//        LibJSON().Test_Lib { x -> textView.setText(textView.text.toString() + x) }

        // R.layout.activity_main as JSON

/*
        // create core view
        val VIEW = LibJSON()
        // create sub view
        val VIEW_TEXT = LibJSON()
        // create properties
        val VIEW_properties1 = LibJSON()
        val VIEW_properties2 = LibJSON()
        val VIEW_properties3 = LibJSON()
        val VIEW_TEXT_properties1 = LibJSON()
        val VIEW_TEXT_properties2 = LibJSON()
        val VIEW_TEXT_properties3 = LibJSON()
        val VIEW_TEXT_properties4 = LibJSON()
        // assign properties
        VIEW_properties1.add_value_as_vararg("name", "layout_hight", "type", "dimen", "value", "match_parent")
        VIEW_properties2.add_value_as_vararg("name", "layout_width", "type", "dimen", "value", "match_parent")
        VIEW_properties3.add_value_as_vararg("name", "orientation", "type", "string", "value", "vertical")
        VIEW_TEXT_properties1.add_value_as_vararg("name", "layout_width", "type", "dimen", "value", "match_parent")
        VIEW_TEXT_properties2.add_value_as_vararg("name", "layout_margin", "type", "dimen", "value", "16p")
        VIEW_TEXT_properties3.add_value_as_vararg("name", "scrollbars", "type", "string", "value", "vertical")
        VIEW_TEXT_properties4.add_value_as_vararg("name", "text", "type", "string", "value", "")
        // assign core view
        VIEW.add_value_as_vararg("widget", "LinearLayout", "properties")
        VIEW.add_array(VIEW_properties1, VIEW_properties2, VIEW_properties3)
        VIEW.add_name("views")
        VIEW.add_array(VIEW_TEXT)
        // assign core sub view
        VIEW_TEXT.add_value_as_vararg("widget", "text_view", "properties")
        VIEW_TEXT.add_array(VIEW_TEXT_properties1, VIEW_TEXT_properties2, VIEW_TEXT_properties3, VIEW_TEXT_properties4)
        VIEW_TEXT.add_name("views")
        VIEW_TEXT.add_array()
*/

        val DEMO = JSONObject("""
            {
	"widget": "android.widget.RelativeLayout",
	"properties": [{
		"name": "background",
		"type": "color",
		"value": "#919191"
	},
	{
		"name": "layout_width",
		"type": "dimen",
		"value": "match_parent"
	},
	{
		"name": "layout_height",
		"type": "dimen",
		"value": "match_parent"
	},
	{
		"name": "padding",
		"type": "dimen",
		"value": "10dp"
	}],
	"views": [{
		"widget": "android.widget.LinearLayout",
		"properties": [{
			"name": "layout_width",
			"type": "dimen",
			"value": "90%"
		},
		{
			"name": "layout_height",
			"type": "dimen",
			"value": "wrap_content"
		},
		{
			"name": "background",
			"type": "color",
			"value": "#ffffff"
		},
		{
			"name": "layout_centerInParent",
			"type": "boolean",
			"value": "true"
		},
		{
			"name": "orientation",
			"type": "string",
			"value": "vertical"
		}],
		"views": [{
			"widget": "android.widget.TextView",
			"properties": [{
				"name": "id",
				"type": "",
				"value": "testClick"
			},
			{
				"name": "layout_width",
				"type": "dimen",
				"value": "match_parent"
			},
			{
				"name": "layout_height",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "background",
				"type": "color",
				"value": "#ffffff"
			},
			{
				"name": "gravity",
				"type": "string",
				"value": "center"
			},
			{
				"name": "text",
				"type": "string",
				"value": "Try to click"
			},
			{
				"name": "gravity",
				"type": "",
				"value": "center"
			},
            {
                "name": "padding",
                "type": "dimen",
                "value": "5dp"
            },
			{
				"name": "textColor",
				"type": "color",
				"value": "#919191"
			}]
		},
		{
			"widget": "android.widget.TextView",
			"properties": [{
				"name": "id",
				"type": "",
				"value": "adTitle"
			},
			{
				"name": "layout_width",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "layout_height",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "background",
				"type": "color",
				"value": "#ffffff"
			},
			{
				"name": "text",
				"type": "string",
				"value": "Hello AVOCARROT!"
			},
			{
				"name": "layout_gravity",
				"type": "string",
				"value": "center"
			},
			{
				"name": "textSize",
				"type": "dimen",
				"value": "16sp"
			},
		    {
				"name": "drawableLeft",
				"type": "base64",
				"value": "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"
			},
            {
                "name": "padding",
                "type": "dimen",
                "value": "5dp"
            },
            {
                "name": "gravity",
                "type": "string",
                "value": "center"
            },
			{
				"name": "textColor",
				"type": "color",
				"value": "#1f91f7"
			}]
		},
		{
			"widget": "android.widget.ImageView",
			"properties": [{
				"name": "id",
				"type": "",
				"value": "adImage"
			},
			{
				"name": "layout_width",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "layout_height",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "scaleType",
				"type": "dimen",
				"value": "fit_Center"
			},
			{
				"name": "adjustViewBounds",
				"type": "boolean",
				"value": "true"
			},
		    {
				"name": "src",
				"type": "ref",
				"value": "sample"
			},
			{
				"name": "background",
				"type": "color",
				"value": "#228877"
			}]
		},
		{
			"widget": "android.widget.TextView",
			"properties": [{
				"name": "id",
				"type": "",
				"value": "adCTA"
			},
			{
				"name": "layout_width",
				"type": "dimen",
				"value": "match_parent"
			},
			{
				"name": "layout_height",
				"type": "dimen",
				"value": "wrap_content"
			},
			{
				"name": "background",
				"type": "color",
				"value": "#ffffff"
			},
			{
				"name": "text",
				"type": "string",
				"value": "LearnMore"
			},
			{
				"name": "padding",
				"type": "dimen",
				"value": "5dp"
			},
			{
				"name": "textSize",
				"type": "dimen",
				"value": "16sp"
			},
            {
                "name": "padding",
                "type": "dimen",
                "value": "7.5dp"
            },
            {
                "name": "gravity",
                "type": "string",
                "value": "center"
            },
			{
				"name": "textColor",
				"type": "color",
				"value": "#1f91f7"
			}]
		}]
	}]
}
        """)
        // use a static JSON string for now
        val K = JSONObject("""
            {
                "widget": "android.widget.LinearLayout",
                "properties": [
                  {
                    "name": "layout_hight",
                    "type": "dimen",
                    "value": "match_parent"
                  },
                  {
                    "name": "layout_width",
                    "type": "dimen",
                    "value": "match_parent"
                  },
                  {
                    "name": "orientation",
                    "type": "string",
                    "value": "vertical"
                  }
                ],
                "views": [
                  {
                    "type": "android.widget.TextView",
                    "properties": [
                      {
                        "name": "id",
                        "type": "",
                        "value": "text_view"
                      },
                      {
                        "name": "layout_width",
                        "type": "dimen",
                        "value": "match_parent"
                      },
                      {
                        "name": "layout_margin",
                        "type": "dimen",
                        "value": "16p"
                      },
                      {
                        "name": "scrollbars",
                        "type": "string",
                        "value": "vertical"
                      },
                      {
                        "name": "text",
                        "type": "string",
                        "value": ""
                      }
                    ],
                    "views": []
                  }
                ]
            }
          """)

        // MY CODE, FAILS
        /* create dynamic view and return the view with the holder class attached as tag */
        val sampleView : View? = DynamicView.createView(this, K, SampleViewHolder_TextView::class.java)
        if (sampleView == null) throw Exception("sampleView is null")
        setContentView(sampleView)
        val sampleTextView : TextView? = (sampleView.tag as SampleViewHolder_TextView).TEXTVIEW
        if (sampleTextView == null) throw Exception("sampleTextView is null") // FAILS HERE

        sampleTextView.setMovementMethod(ScrollingMovementMethod())
//        VIEW.print_object_pretty { x -> sampleTextView.setText(sampleTextView.text.toString() + x) }
//        VIEW.print_object_pretty{x -> throw Exception(x)}

        /* DEMO CODE, WORKS
        /* create dynamic view and return the view with the holder class attached as tag */
        val sampleView : View? = DynamicView.createView(this, DEMO, SampleViewHolder_View::class.java)
        if (sampleView == null) throw Exception("sampleView is null")
        setContentView(sampleView)

        /* add Layout Parameters in just created view and set as the contentView of the activity */
        sampleView.layoutParams = WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT)
        */

    }

    override fun onClick(v: View) {
        startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("http://www.avocarrot.com/")))
    }

    /* Constructor must be public */
    class SampleViewHolder_TextView {
        /* we need the View with id testClick */
        @DynamicViewId(id = "text_view")
        var TEXTVIEW: TextView? = null
    }

    /* Constructor must be public */
    class SampleViewHolder_View {
        /* we need the View with id testClick */
        @DynamicViewId(id = "testClick")
        var clickableView: View? = null
    }
}

Not working

i am using this json in my project

https://api.jsonbin.io/b/5e3126d03d75894195e0eff1/1
and this code:
ViewGroup viewParent;
JSONObject jsonObject = new JSONObject(response); viewParent = (ViewGroup) findViewById(R.id.parent_view_id); View sampleView = DynamicView.createView(DynamicLayoutActivity.this, jsonObject, viewParent);

xml:

`

<RelativeLayout
    android:id="@+id/parent_view_id"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


</RelativeLayout>

`

Java file link:
http://s000.tinyupload.com/?file_id=16143747534494522174

but view is not showing. please help me.

Scroll View Support

I have a question regarding the scroll view support in this jar. I tried putting the scrollview in the json file and tried to get the view. It says java.lang.ClassNotFoundException: android.widget.ScrollView$LayoutParams.
I have even tried putting a scrollview inside a RelativeLayout which was also failing.
Can you please help me in this?

ConvertXML2JSON.groovy not working

I am trying to convert an XML layout to Json but no matter how is specify the -Pxml= path I always get an error:

The input file doesn't exist. Process incomplete | /Users/valeriynenov/.gradle/daemon/5.4.1/./../../json2view-master/sample/src/main/res/layout/notes_doh_a_deer.xml

The XML file is attached.

notes_doh_a_deer.txt

I am not able to go up the directory stack using ../
I tried both in the Android Studio built-in terminal and in the standard MacOS terminal but get the same error. Bellow is part of the log:

`valeriys-imac:json2view-master valeriynenov$ ./gradlew runScript -Pxml=./json2view-master/sample/src/main/res/layout/notes_doh_a_deer.xml

Task :utils:runScript
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/valeriynenov/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.15/423a17aeb2f64bc6f76e8e44265a548bec80fd42/groovy-all-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release


*** ConvertXML2Json ***
Still in experimental mode :(

The input file doesn't exist. Process incomplete | /Users/valeriynenov/.gradle/daemon/5.4.1/././json2view-master/sample/src/main/res/layout/notes_doh_a_deer.xml

BUILD SUCCESSFUL in 2s
2 actionable tasks: 1 executed, 1 up-to-date
valeriys-imac:json2view-master valeriynenov$ ./gradlew runScript -Pxml=./sample/src/main/res/layout/notes_doh_a_deer.xml

Task :utils:runScript
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/valeriynenov/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.15/423a17aeb2f64bc6f76e8e44265a548bec80fd42/groovy-all-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release


*** ConvertXML2Json ***
Still in experimental mode :(

The input file doesn't exist. Process incomplete | /Users/valeriynenov/.gradle/daemon/5.4.1/././sample/src/main/res/layout/notes_doh_a_deer.xml

BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date
valeriys-imac:json2view-master valeriynenov$
`

Can you please help?

Thanks,

Val

Using editext

I am able to use edittext but setting hint for edittext is not working.

Thanks in advance

a better solution

json2view is very good idea, i read u codes, find a better solution, we can discuss it.

  1. use a static web server for remote loading json;
  2. build a helper class for setContent(),it can load json by http.And it very like the android setContent(), u can simply use reg replace tools to replace u codes to toogle production env or test env.
  3. json convert can put into setContent() helper class. it read xml from http and convert it to json. BTW,I read u codes,i think that u json is very simply format, it very like xml. so u can remove the convert, directly use xml for dynamic view.

Usage in kotlin

Type mismatch: inferred type is MainActivity but View.OnClickListener! was expected

    (sampleView.getTag() as SampleViewHolder).clickableView?.setOnClickListener(this)

iOS support :)

Hi,

Just found your project ! And for a project I need to support web, Android and iOS interface from JSON.
It would be cool if your project support also iOS interface (or a common interface for both).

Anyway thanks for this great job !

How to load data to view?

I have see this project ,it seems that it's only convert json to native ui, but not provide the Solution of loading data from backend to app view

Get data from editText

How to get data from edit text on Click of button, if EditText and button is passed from JSON.

And also is there any way to add DynamicId in SampleViewHolder dynamically rather than hardcoding it.

Can't get object IDs

Hi, thanks for this tool.

When I create a checkbox for example using this tool, I cannot set the resource ID which I need to initialize the checkbox.

Thanks
Brad

Not working LayoutParams.gravity

Not working with multiple gravity params such as "start|top"
Not working with gravity params for FrameLayout

Add something like this to file DynamicHelper.java:

                
                        switch (dynProp.type) {
                            case INTEGER: {
                                if (params instanceof LinearLayout.LayoutParams)
                                    ((LinearLayout.LayoutParams) params).gravity = dynProp.getValueInt();
                                else if (params instanceof FrameLayout.LayoutParams)
                                    ((FrameLayout.LayoutParams) params).gravity = dynProp.getValueInt();
                            }
                            break;
                            case STRING: {
                                if (params instanceof LinearLayout.LayoutParams)
                                    ((LinearLayout.LayoutParams) params).gravity = (Integer) dynProp.getValueInt(Gravity.class, dynProp.getValueString().toUpperCase());
                                else if (params instanceof FrameLayout.LayoutParams) {
                                    int grav = 0;
                                    if (dynProp.getValueString().isEmpty()){
                                        grav = Gravity.TOP | Gravity.START;
                                    }
                                    if (dynProp.getValueString().contains("|")) {
                                        for (String gravParam : Arrays.asList(dynProp.getValueString().split(Pattern.quote("|")))) {
                                            grav |= (Integer) dynProp.getValueInt(Gravity.class, gravParam.toUpperCase());
                                        }
                                    } else {
                                        grav = (Integer) dynProp.getValueInt(Gravity.class, dynProp.getValueString().toUpperCase());
                                    }
                                    ((FrameLayout.LayoutParams) params).gravity = grav;
                                }
                            }
                            break;
                        }
                    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.