tbr capability in ComboFragment
This commit is contained in:
parent
76c0b999ff
commit
13173e48c1
|
@ -33,7 +33,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button refresh;
|
private Button refresh;
|
||||||
private Button testButton;
|
private TextView updateCapabilities;
|
||||||
|
|
||||||
private TextView statusText;
|
private TextView statusText;
|
||||||
|
|
||||||
|
@ -46,13 +46,15 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
private TextView lastCmdTimeText;
|
private TextView lastCmdTimeText;
|
||||||
private TextView lastCmdResultText;
|
private TextView lastCmdResultText;
|
||||||
|
|
||||||
|
private TextView tbrCapabilityText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.combopump_fragment, container, false);
|
View view = inflater.inflate(R.layout.combopump_fragment, container, false);
|
||||||
|
|
||||||
refresh = (Button) view.findViewById(R.id.combo_refresh);
|
refresh = (Button) view.findViewById(R.id.combo_refresh);
|
||||||
testButton = (Button) view.findViewById(R.id.combo_testaction);
|
updateCapabilities = (TextView) view.findViewById(R.id.combo_update_capabilities);
|
||||||
|
|
||||||
statusText = (TextView) view.findViewById(R.id.combo_status);
|
statusText = (TextView) view.findViewById(R.id.combo_status);
|
||||||
|
|
||||||
|
@ -64,9 +66,10 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
|
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
|
||||||
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
|
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
|
||||||
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
|
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
|
||||||
|
tbrCapabilityText = (TextView) view.findViewById(R.id.combo_tbr_capability);
|
||||||
|
|
||||||
refresh.setOnClickListener(this);
|
refresh.setOnClickListener(this);
|
||||||
testButton.setOnClickListener(this);
|
updateCapabilities.setOnClickListener(this);
|
||||||
|
|
||||||
updateGUI();
|
updateGUI();
|
||||||
return view;
|
return view;
|
||||||
|
@ -102,11 +105,29 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
});
|
});
|
||||||
thread.start();
|
thread.start();
|
||||||
break;
|
break;
|
||||||
case R.id.combo_testaction:
|
case R.id.combo_update_capabilities:
|
||||||
(new Thread(new Runnable() {
|
(new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
getPlugin().doTestAction();
|
Activity activity = getActivity();
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateCapabilities.setText("{fa-bluetooth}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
getPlugin().updateCapabilities();
|
||||||
|
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
updateCapabilities.setText("{fa-bluetooth-b}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
})).start();
|
})).start();
|
||||||
break;
|
break;
|
||||||
|
@ -151,7 +172,9 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
} else {
|
} else {
|
||||||
lastCmdResultText.setText("");
|
lastCmdResultText.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
tbrCapabilityText.setText(getPlugin().getPumpDescription().maxTempPercent + "%");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -621,19 +621,23 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void doTestAction() {
|
public void updateCapabilities() {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance(), "TestAction called");
|
|
||||||
|
|
||||||
// if Android is sluggish this might get called before ruffy is bound
|
// if Android is sluggish this might get called before ruffy is bound
|
||||||
if (ruffyScripter == null) {
|
if (ruffyScripter == null) {
|
||||||
log.warn("Rejecting call to RefreshDataFromPump: ruffy service not bound (yet)");
|
log.warn("Rejecting call to RefreshDataFromPump: ruffy service not bound (yet)");
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance(), "Rejecting call to RefreshDataFromPump: ruffy service not bound (yet)");
|
ToastUtils.showToastInUiThread(MainApp.instance(), "Ruffy not initialized.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isBusy()){
|
||||||
|
ToastUtils.showToastInUiThread(MainApp.instance(), "Pump busy!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CommandResult result = runCommand(new DetermineCapabilitiesCommand());
|
CommandResult result = runCommand(new DetermineCapabilitiesCommand());
|
||||||
if (result.success){
|
if (result.success){
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance(), "max%: " + result.capabilities.maxTempPercent);
|
//TODO: write to settings result.capabilities.maxTempPercent
|
||||||
|
pumpDescription.maxTempPercent = (int) result.capabilities.maxTempPercent;
|
||||||
|
MainApp.bus().post(new EventComboPumpUpdateGUI());
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance(), "No success with test Command.");
|
ToastUtils.showToastInUiThread(MainApp.instance(), "No success with test Command.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Refresh" />
|
android:text="Refresh" />
|
||||||
<Button
|
|
||||||
android:id="@+id/combo_testaction"
|
|
||||||
style="?android:attr/buttonStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Test Action" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -151,6 +144,7 @@
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -379,6 +373,62 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dip"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:background="@color/listdelimiter" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:text="TBR Capability"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/combo_tbr_capability"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<com.joanzapata.iconify.widget.IconTextView
|
||||||
|
android:id="@+id/combo_update_capabilities"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:text="{fa-bluetooth-b}" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="2dip"
|
android:layout_height="2dip"
|
||||||
|
|
Loading…
Reference in a new issue