Skip to content

Commit

Permalink
fix(input): update the input information
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and Hector Rondon committed Oct 19, 2017
1 parent 3ba1c15 commit 3917419
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.runner.RunWith;

import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;

/*
* Copyright © 2017 Teclib. All rights reserved.
Expand Down Expand Up @@ -46,7 +47,7 @@ public class InputsTest {
@Test
public void getKeyboard() throws Exception {
Inputs inputs = new Inputs(appContext);
assertNotEquals("", inputs.getKeyboard());
assertNotNull(inputs.getKeyboard());
}

@Test
Expand Down
37 changes: 24 additions & 13 deletions inventory/src/main/java/org/flyve/inventory/categories/Inputs.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public class Inputs extends Categories {
private Configuration config;

/**
* Indicates whether some other object is "equal to" this one
* @param Object obj the reference object with which to compare
* @return boolean true if the object is the same as the one given in argument
*/
* Indicates whether some other object is "equal to" this one
* @param Object obj the reference object with which to compare
* @return boolean true if the object is the same as the one given in argument
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
Expand All @@ -69,9 +69,9 @@ public boolean equals(Object obj) {
}

/**
* Returns a hash code value for the object
* @return int a hash code value for the object
*/
* Returns a hash code value for the object
* @return int a hash code value for the object
*/
@Override
public int hashCode() {
int hash = super.hashCode();
Expand All @@ -88,10 +88,21 @@ public Inputs(Context xCtx) {

config = xCtx.getResources().getConfiguration();

if(getKeyboard()) {
Category c = new Category("INPUTS", "inputs");

c.put("CAPTION", new CategoryValue("keyboard", "CAPTION", "caption"));
c.put("DESCRIPTION", new CategoryValue("keyboard", "DESCRIPTION", "description"));
c.put("TYPE", new CategoryValue("keyboard", "TYPE", "type"));

this.add(c);
}

Category c = new Category("INPUTS", "inputs");

c.put("KEYBOARD", new CategoryValue(getKeyboard(), "KEYBOARD", "keyboard"));
c.put("TOUCHSCREEN", new CategoryValue(getTouchscreen(), "TOUCHSCREEN", "touchScreen"));
c.put("CAPTION", new CategoryValue("Touch Screen", "CAPTION", "caption"));
c.put("DESCRIPTION", new CategoryValue("Touch Screen", "DESCRIPTION", "description"));
c.put("TYPE", new CategoryValue(getTouchscreen(), "TYPE", "type"));

this.add(c);
}
Expand All @@ -100,18 +111,18 @@ public Inputs(Context xCtx) {
* Get the keyboard
* @return string if the device has a hardware keyboard
*/
public String getKeyboard() {
public Boolean getKeyboard() {

String val;
Boolean val;

switch (config.keyboard) {
case Configuration.KEYBOARD_QWERTY:
case Configuration.KEYBOARD_12KEY:
val = "YES";
val = true;
break;
case Configuration.KEYBOARD_NOKEYS:
default:
val = "NO";
val = false;
break;
}

Expand Down

0 comments on commit 3917419

Please sign in to comment.