56 lines
1.6 KiB
Java
56 lines
1.6 KiB
Java
package im.ricochet.androidod;
|
|
|
|
import android.os.AsyncTask;
|
|
import android.support.v7.app.AppCompatActivity;
|
|
import android.os.Bundle;
|
|
import android.widget.Button;
|
|
import android.widget.TextView;
|
|
|
|
import goRicochetMobile.GoRicochetMobile;
|
|
|
|
public class RemoteActivity extends AppCompatActivity {
|
|
TextView deviceText;
|
|
TextView batteryText;
|
|
TextView statusText;
|
|
|
|
Button offButton;
|
|
Button lowButton;
|
|
Button medButton;
|
|
Button highButton;
|
|
Button disconnectButton;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_remote);
|
|
|
|
deviceText = (TextView)findViewById(R.id.deviceName);
|
|
batteryText = (TextView)findViewById(R.id.batteryLevel);
|
|
statusText = (TextView)findViewById(R.id.status);
|
|
|
|
offButton = (Button)findViewById(R.id.offButton);
|
|
lowButton = (Button)findViewById(R.id.lowButton);
|
|
medButton = (Button)findViewById(R.id.medButton);
|
|
highButton = (Button)findViewById(R.id.highButton);
|
|
disconnectButton = (Button)findViewById(R.id.disconnetButton);
|
|
|
|
GetDeviceNameTask getDeviceNameTask = new GetDeviceNameTask();
|
|
getDeviceNameTask.execute();
|
|
|
|
}
|
|
|
|
private class GetDeviceNameTask extends AsyncTask<Void, Void, String> {
|
|
|
|
@Override
|
|
protected String doInBackground(Void... params) {
|
|
String name = GoRicochetMobile.getDeviceName();
|
|
return name;
|
|
}
|
|
|
|
@Override
|
|
protected void onPostExecute(String deviceName) {
|
|
deviceText.setText(deviceName);
|
|
}
|
|
}
|
|
}
|