off button
This commit is contained in:
@@ -72,7 +72,7 @@ public class MainActivity extends Activity implements RadioGroup.OnCheckedChange
|
|||||||
private BluetoothAdapter mBtAdapter = null;
|
private BluetoothAdapter mBtAdapter = null;
|
||||||
private ListView messageListView;
|
private ListView messageListView;
|
||||||
private ArrayAdapter<String> listAdapter;
|
private ArrayAdapter<String> listAdapter;
|
||||||
private Button btnConnectDisconnect, btnSend, btnRainbow, btnFastest, btnFast, btnMed, btnSlow, btnSlowest;
|
private Button btnConnectDisconnect, btnSend, btnOff, btnRainbow, btnFastest, btnFast, btnMed, btnSlow, btnSlowest;
|
||||||
private Button disableButtons[];
|
private Button disableButtons[];
|
||||||
private EditText edtMessage;
|
private EditText edtMessage;
|
||||||
@Override
|
@Override
|
||||||
@@ -95,12 +95,13 @@ public class MainActivity extends Activity implements RadioGroup.OnCheckedChange
|
|||||||
btnConnectDisconnect=(Button) findViewById(R.id.btn_select);
|
btnConnectDisconnect=(Button) findViewById(R.id.btn_select);
|
||||||
btnSend=(Button) findViewById(R.id.sendButton);
|
btnSend=(Button) findViewById(R.id.sendButton);
|
||||||
btnRainbow=findViewById(R.id.rainbowButton);
|
btnRainbow=findViewById(R.id.rainbowButton);
|
||||||
|
btnOff=findViewById(R.id.offButton);
|
||||||
btnFastest=findViewById(R.id.speedFastest);
|
btnFastest=findViewById(R.id.speedFastest);
|
||||||
btnFast=findViewById((R.id.speedFast));
|
btnFast=findViewById((R.id.speedFast));
|
||||||
btnMed=findViewById((R.id.speedMed));
|
btnMed=findViewById((R.id.speedMed));
|
||||||
btnSlow=findViewById((R.id.speedSlow));
|
btnSlow=findViewById((R.id.speedSlow));
|
||||||
btnSlowest=findViewById(R.id.speedSlowest);
|
btnSlowest=findViewById(R.id.speedSlowest);
|
||||||
disableButtons = new Button[7];
|
disableButtons = new Button[8];
|
||||||
disableButtons[0] = btnSend;
|
disableButtons[0] = btnSend;
|
||||||
disableButtons[1] = btnRainbow;
|
disableButtons[1] = btnRainbow;
|
||||||
disableButtons[2] = btnFastest;
|
disableButtons[2] = btnFastest;
|
||||||
@@ -108,6 +109,7 @@ public class MainActivity extends Activity implements RadioGroup.OnCheckedChange
|
|||||||
disableButtons[4] = btnMed;
|
disableButtons[4] = btnMed;
|
||||||
disableButtons[5] = btnSlow;
|
disableButtons[5] = btnSlow;
|
||||||
disableButtons[6] = btnSlowest;
|
disableButtons[6] = btnSlowest;
|
||||||
|
disableButtons[7] = btnOff;
|
||||||
for (Button btn: disableButtons){
|
for (Button btn: disableButtons){
|
||||||
btn.setEnabled(false);
|
btn.setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -173,7 +175,12 @@ public class MainActivity extends Activity implements RadioGroup.OnCheckedChange
|
|||||||
sendCmd("pr");
|
sendCmd("pr");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
btnOff.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
sendCmd("po");
|
||||||
|
}
|
||||||
|
});
|
||||||
btnFastest.setOnClickListener(new View.OnClickListener() {
|
btnFastest.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|||||||
@@ -27,17 +27,27 @@
|
|||||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<com.google.android.flexbox.FlexboxLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/patternRow"
|
android:id="@+id/patternRow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:flexWrap="wrap"
|
||||||
|
app:alignItems="stretch"
|
||||||
|
app:alignContent="stretch">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/offButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Off" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/rainbowButton"
|
android:id="@+id/rainbowButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Rainbow" />
|
android:text="Rainbow" />
|
||||||
</RelativeLayout>
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user