Skip to content

Commit

Permalink
Merge pull request #8 from smartdevicelink/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Austin Kirk authored Jun 15, 2017
2 parents 7303e6d + e68b314 commit 1f67c35
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 12 deletions.
Binary file modified RPCBuilder/app/build/apk/RPCBuilder.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -83,6 +84,12 @@ private Hashtable<String, Object> 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) {
Expand All @@ -98,6 +105,11 @@ private Hashtable<String, Object> 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;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String> arrayList = new ArrayList<String>();
for(RBElement e : rbEnum.elements){
arrayList.add(e.name);
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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)){
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 1f67c35

Please sign in to comment.