diff --git a/RPCBuilder/app/build/apk/RPCBuilder.apk b/RPCBuilder/app/build/apk/RPCBuilder.apk index bfe13e9..68ae20a 100644 Binary files a/RPCBuilder/app/build/apk/RPCBuilder.apk and b/RPCBuilder/app/build/apk/RPCBuilder.apk differ diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/DataModels/RBRequestBuilder.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/DataModels/RBRequestBuilder.java index 4ddfbc1..ae7510e 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/DataModels/RBRequestBuilder.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/DataModels/RBRequestBuilder.java @@ -17,6 +17,7 @@ import com.smartdevicelink.rpcbuilder.Views.UITextField.RBParamTextField; import com.smartdevicelink.util.CorrelationIdGenerator; +import java.util.ArrayList; import java.util.Hashtable; import java.util.Vector; @@ -83,6 +84,12 @@ private Hashtable buildFields(LinearLayout list, Activity buildA }else { value = ((RBParamTextField) v).getText().toString(); } + + if(((RBParamTextField) v).requiresArray()){ + ArrayList array = new ArrayList<>(1); + array.add(value); + value = array; + } } else if (v instanceof RBSwitch) { value = ((RBSwitch) v).isChecked(); } else if (v instanceof RBStructButton) { @@ -98,6 +105,11 @@ private Hashtable buildFields(LinearLayout list, Activity buildA } } else if (v instanceof RBEnumSpinner) { value = ((RBEnumSpinner) v).getSelectedItem().toString(); + if(((RBEnumSpinner) v).requiresArray()){ + ArrayList array = new ArrayList<>(1); + array.add(value); + value = array; + } } } } diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Fragments/ListParamsFragment.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Fragments/ListParamsFragment.java index f14ecee..d219777 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Fragments/ListParamsFragment.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Fragments/ListParamsFragment.java @@ -112,12 +112,6 @@ public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.send: - try { - Log.d("Sending RPC", JsonRPCMarshaller.serializeHashtable(hash).toString(1)); - } catch (JSONException e) { - e.printStackTrace(); - } - buildActivity.sendRPCRequest(hash); buildActivity.showFragment(ListFuncsFragment.class); return true; diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/SmartDeviceLink/SdlService.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/SmartDeviceLink/SdlService.java index a1af80c..5de4207 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/SmartDeviceLink/SdlService.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/SmartDeviceLink/SdlService.java @@ -249,6 +249,11 @@ public void onResponse(int correlationId, RPCResponse response) { }); } proxy.sendRPCRequest(rpcRequest); + try { + Log.d("RPCBuilderLog", "Sending RPC:\n"+rpcRequest.serializeJSON().toString(1)); + } catch (JSONException e) { + e.printStackTrace(); + } } catch (SdlException e) { e.printStackTrace(); proxy = null; diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIEnumSpinner/RBEnumSpinner.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIEnumSpinner/RBEnumSpinner.java index 4cd7358..1cfafe0 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIEnumSpinner/RBEnumSpinner.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIEnumSpinner/RBEnumSpinner.java @@ -2,7 +2,6 @@ import android.content.Context; import android.widget.ArrayAdapter; -import android.widget.Spinner; import com.smartdevicelink.rpcbuilder.DataModels.RBElement; import com.smartdevicelink.rpcbuilder.DataModels.RBEnum; @@ -13,12 +12,21 @@ * Created by austinkirk on 11/16/16. */ -public class RBEnumSpinner extends Spinner { +public class RBEnumSpinner extends android.support.v7.widget.AppCompatSpinner { + private boolean mRequiresArray = false; + private final String[] enumsRequiringArray = {"GlobalProperty"}; + public RBEnumSpinner(Context context){ super(context); } public void format(RBEnum rbEnum){ + for(String s : enumsRequiringArray){ + if(rbEnum.name.equals(s)){ + mRequiresArray = true; + } + } + ArrayList arrayList = new ArrayList(); for(RBElement e : rbEnum.elements){ arrayList.add(e.name); @@ -28,4 +36,8 @@ public void format(RBEnum rbEnum){ spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); this.setAdapter(spinnerArrayAdapter); } + + public boolean requiresArray(){ + return mRequiresArray; + } } diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UILabel/RBNameLabel.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UILabel/RBNameLabel.java index cf66f3e..b2a9196 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UILabel/RBNameLabel.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UILabel/RBNameLabel.java @@ -12,7 +12,7 @@ * Created by austinkirk on 11/16/16. */ -public class RBNameLabel extends TextView { +public class RBNameLabel extends android.support.v7.widget.AppCompatTextView { private Boolean enabled = true; private String rbParamName = ""; diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIStructButton/RBStructButton.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIStructButton/RBStructButton.java index d5a6da8..9c9beb8 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIStructButton/RBStructButton.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UIStructButton/RBStructButton.java @@ -13,7 +13,7 @@ * Created by austinkirk on 11/15/16. */ -public class RBStructButton extends Button{ +public class RBStructButton extends android.support.v7.widget.AppCompatButton{ private Context mContext; private boolean isArray; diff --git a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UITextField/RBParamTextField.java b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UITextField/RBParamTextField.java index fc27978..feda06d 100644 --- a/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UITextField/RBParamTextField.java +++ b/RPCBuilder/app/src/main/java/com/smartdevicelink/rpcbuilder/Views/UITextField/RBParamTextField.java @@ -4,7 +4,6 @@ import android.text.InputFilter; import android.text.InputType; import android.text.Spanned; -import android.widget.EditText; import com.smartdevicelink.rpcbuilder.DataModels.RBBaseObject; import com.smartdevicelink.rpcbuilder.DataModels.RBParam; @@ -13,8 +12,9 @@ * Created by austinkirk on 11/14/16. */ -public class RBParamTextField extends EditText{ +public class RBParamTextField extends android.support.v7.widget.AppCompatEditText{ private String mType; + private Boolean mRequiresArray = false; public RBParamTextField(Context context){ super(context); @@ -23,6 +23,7 @@ public RBParamTextField(Context context){ public void format(RBParam rbParam){ mType = rbParam.mType; + mRequiresArray = rbParam.mRequiresArray; InputFilter filter = null; if(rbParam.mType.equals(RBBaseObject.RBTypeStringKey)){ @@ -97,4 +98,10 @@ private boolean isInRange(int a, int b, int c) { public String getType(){ return mType; } + public boolean requiresArray() { + if(mRequiresArray != null) + return mRequiresArray; + else + return false; + } }