本文整理汇总了Java中app.akexorcist.bluetotohspp.library.DeviceList类的典型用法代码示例。如果您正苦于以下问题:Java DeviceList类的具体用法?Java DeviceList怎么用?Java DeviceList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceList类属于app.akexorcist.bluetotohspp.library包,在下文中一共展示了DeviceList类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
Handler delayedDisconnect = new Handler() {
public void handleMessage(Message msg) {
AppState.getInstance().conn.disconnect();
}
};
if(id == R.id.menuBTConnect) {
bt.setDeviceTarget(BluetoothState.DEVICE_OTHER);
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
} else if(id == R.id.menuBTDisconnect) {
if (bt.getServiceState() == BluetoothState.STATE_CONNECTED) {
AppState.getInstance().onBeforeDisconnect();
delayedDisconnect.sendEmptyMessageDelayed(0, 100);
}
} else if(id == R.id.menuUDPConnect) {
udp.connect(getGatewayIP(), 0);
useUDP();
} else if(id == R.id.menuUDPDisconnect) {
AppState.getInstance().onBeforeDisconnect();
delayedDisconnect.sendEmptyMessageDelayed(0, 100);
}
return super.onOptionsItemSelected(item);
}
开发者ID:voroshkov,项目名称:Chorus-RF-Laptimer,代码行数:32,代码来源:MainActivity.java
示例2: onActivityResult
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == BluetoothState.REQUEST_CONNECT_DEVICE) {
if(resultCode == Activity.RESULT_OK)
BluetoothSPP.getInstance().connect(data);
} else if(requestCode == BluetoothState.REQUEST_ENABLE_BT) {
if(resultCode == Activity.RESULT_OK) {
BluetoothSPP.getInstance().setupService();
BluetoothSPP.getInstance().setDeviceTarget(BluetoothState.DEVICE_OTHER);
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
} else {
Snackbar.make(mListview, R.string.bluetooth_status_not_enabled, Snackbar.LENGTH_LONG).show();
}
}
}
开发者ID:josejuansanchez,项目名称:NanoPlayBoard-Android-App,代码行数:16,代码来源:ListViewActivity.java
示例3: onActivityResult
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == BluetoothState.REQUEST_CONNECT_DEVICE) {
if(resultCode == Activity.RESULT_OK)
BluetoothSPP.getInstance().connect(data);
} else if(requestCode == BluetoothState.REQUEST_ENABLE_BT) {
if(resultCode == Activity.RESULT_OK) {
BluetoothSPP.getInstance().setupService();
BluetoothSPP.getInstance().setDeviceTarget(BluetoothState.DEVICE_OTHER);
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
} else {
Snackbar.make(mRecyclerView, R.string.bluetooth_status_not_enabled, Snackbar.LENGTH_LONG).show();
}
}
}
开发者ID:josejuansanchez,项目名称:NanoPlayBoard-Android-App,代码行数:16,代码来源:RecyclerViewActivity.java
示例4: onCreate
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_devicelist);
bt = new BluetoothSPP(this);
if(!bt.isBluetoothAvailable()) {
Toast.makeText(getApplicationContext()
, "Bluetooth is not available"
, Toast.LENGTH_SHORT).show();
finish();
}
bt.setOnDataReceivedListener(new OnDataReceivedListener() {
public void onDataReceived(byte[] data, String message) {
Log.i("Check", "Length : " + data.length);
Log.i("Check", "Message : " + message);
}
});
Button btnConnect = (Button)findViewById(R.id.btnConnect);
btnConnect.setOnClickListener(new OnClickListener(){
public void onClick(View v){
if(bt.getServiceState() == BluetoothState.STATE_CONNECTED) {
bt.disconnect();
} else {
Intent intent = new Intent(DeviceListActivity.this, DeviceList.class);
intent.putExtra("bluetooth_devices", "Bluetooth devices");
intent.putExtra("no_devices_found", "No device");
intent.putExtra("scanning", "Scanning");
intent.putExtra("scan_for_devices", "Search");
intent.putExtra("select_device", "Select");
intent.putExtra("layout_list", R.layout.device_layout_list);
intent.putExtra("layout_text", R.layout.device_layout_text);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
}
}
});
}
开发者ID:akexorcist,项目名称:Android-BluetoothSPPLibrary,代码行数:40,代码来源:DeviceListActivity.java
示例5: openBluetoothConnection
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
public void openBluetoothConnection(Activity activity) {
Intent intent = new Intent(activity, DeviceList.class);
activity.startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
}
开发者ID:akexorcist,项目名称:Droid2JoyStick,代码行数:5,代码来源:BluetoothManager.java
示例6: setup
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
public void setup(){
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
}
开发者ID:Popati,项目名称:Android-BluetoothSPPLibrary-master,代码行数:5,代码来源:Home.java
示例7: onOptionsItemSelected
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
Intent intent;
switch (item.getItemId()) {
case R.id.matchList:
Intent matchIntent = new Intent(this.getActivity(), MatchScoutingActivity.class);
startActivity(matchIntent);
return true;
case R.id.insertTeamScouting:
DialogFragment newFragment = new InsertTeamDialogFragment();
Bundle updateArgs = new Bundle();
updateArgs.putSerializable(InsertTeamDialogFragment.RANK_ARG, adapter.getCount());
newFragment.setArguments(updateArgs);
newFragment.show(this.getFragmentManager(), "Add Team");
return true;
case R.id.refreshCompetitionTeams:
AsyncExecutor.create().execute(downloadTeams);
return true;
case R.id.sendTeamScoutingCsv:
switch(prefs.getYear()) {
case 2015:
AsyncExecutor.create().execute(new ExportCsvTeamScouting2015(this.getActivity()));
break;
}
return true;
case R.id.bluetoothTeamScoutingList:
intent = new Intent(this.getActivity().getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
return true;
case R.id.backupTeamListScouting:
switch(prefs.getYear()) {
case 2015:
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(OurAllianceGson.TYPE);
intent.putExtra(Intent.EXTRA_TITLE, "teamList.json");
startActivityForResult(intent, CREATE_DOCUMENT_JSON_REQUEST_CODE);
break;
}
return true;
case R.id.restoreTeamListScouting:
switch(prefs.getYear()) {
case 2015:
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(OurAllianceGson.TYPE);
startActivityForResult(intent, OPEN_DOCUMENT_REQUEST_CODE);
// AsyncExecutor.create().execute(new ExportCsvTeamScouting2015(this.getActivity()));
break;
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
开发者ID:mechinn,项目名称:our-alliance-android,代码行数:57,代码来源:TeamListFragment.java
示例8: onOptionsItemSelected
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.practice:
if (item.isChecked()) {
item.setChecked(false);
} else {
item.setChecked(true);
}
prefs.setPractice(item.isChecked());
return true;
case R.id.insert:
new InsertMatchDialogFragment().show(this.getFragmentManager(), "Add Match");
return true;
case R.id.refreshMatches:
AsyncExecutor.create().execute(downloadMatches);
return true;
case R.id.sendMatchScoutingCsv:
switch(prefs.getYear()) {
case 2015:
AsyncExecutor.create().execute(new ExportCsvMatchScouting2015(this.getActivity()));
break;
}
return true;
case R.id.bluetoothMatchScoutingList:
intent = new Intent(this.getActivity().getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
return true;
case R.id.backupMatchListScouting:
switch(prefs.getYear()) {
case 2015:
intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(OurAllianceGson.TYPE);
intent.putExtra(Intent.EXTRA_TITLE, "matchList.json");
startActivityForResult(intent, CREATE_DOCUMENT_JSON_REQUEST_CODE);
break;
}
return true;
case R.id.restoreMatchListScouting:
switch(prefs.getYear()) {
case 2015:
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType(OurAllianceGson.TYPE);
startActivityForResult(intent, OPEN_DOCUMENT_REQUEST_CODE);
break;
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
开发者ID:mechinn,项目名称:our-alliance-android,代码行数:55,代码来源:MatchListFragment.java
示例9: onCreate
import app.akexorcist.bluetotohspp.library.DeviceList; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_simple);
bt = new BluetoothSPP(this);
if(!bt.isBluetoothAvailable()) {
Toast.makeText(getApplicationContext()
, "Bluetooth is not available"
, Toast.LENGTH_SHORT).show();
finish();
}
bt.setOnDataReceivedListener(new OnDataReceivedListener() {
public void onDataReceived(byte[] data, String message) {
Toast.makeText(SimpleActivity.this, message, Toast.LENGTH_SHORT).show();
}
});
bt.setBluetoothConnectionListener(new BluetoothConnectionListener() {
public void onDeviceConnected(String name, String address) {
Toast.makeText(getApplicationContext()
, "Connected to " + name + "\n" + address
, Toast.LENGTH_SHORT).show();
}
public void onDeviceDisconnected() {
Toast.makeText(getApplicationContext()
, "Connection lost", Toast.LENGTH_SHORT).show();
}
public void onDeviceConnectionFailed() {
Toast.makeText(getApplicationContext()
, "Unable to connect", Toast.LENGTH_SHORT).show();
}
});
Button btnConnect = (Button)findViewById(R.id.btnConnect);
btnConnect.setOnClickListener(new OnClickListener(){
public void onClick(View v){
if(bt.getServiceState() == BluetoothState.STATE_CONNECTED) {
bt.disconnect();
} else {
Intent intent = new Intent(getApplicationContext(), DeviceList.class);
startActivityForResult(intent, BluetoothState.REQUEST_CONNECT_DEVICE);
}
}
});
}
开发者ID:akexorcist,项目名称:Android-BluetoothSPPLibrary,代码行数:50,代码来源:SimpleActivity.java
注:本文中的app.akexorcist.bluetotohspp.library.DeviceList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论