项目:BLEFOTA
文件:BflFwUploader.java
/**
* Update GATT service adapter.
*
* @param gattServiceData is services list.
* @param gattCharacteristicData is characteristics list.
* @return GATT service adapter.
* @see kr.co.sevencore.blefotalib.BflFwUploadService
*/
public Simpleexpandablelistadapter updateGattServicesAdapter(
ArrayList<HashMap<String,String>> gattServiceData,ArrayList<ArrayList<HashMap<String,String>>> gattCharacteristicData) {
Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(
mContext,gattServiceData,android.R.layout.simple_expandable_list_item_2,new String[] {BflCodeList.LIST_NAME,BflCodeList.LIST_UUID},new int[] { android.R.id.text1,android.R.id.text2},gattCharacteristicData,android.R.id.text2 }
);
return gattServiceAdapter;
}
项目:SaldoTicket
文件:TransactionsActivity.java
@Override
protected Void doInBackground(Void... arg0) {
explistadapter =
new Simpleexpandablelistadapter(
TransactionsActivity.this,createGroupList(),// Creating group List.
R.layout.group_row,// Group item layout XML.
new String[] { "Month" },// the key of group item.
new int[] { R.id.row_name },// ID of each group item.-Data under the key goes into this TextView.
createChildList(),// childData describes second-level entries.
R.layout.child_row,// Layout for sub-level entries(second level).
new String[] {"Transaction"},// Keys in childData maps to display.
new int[] { R.id.grp_child} // Data under the keys above go into these TextViews.
);
return null;
}
项目:SaldoTicket
文件:TransactionsShortActivity.java
@Override
protected Void doInBackground(Void... arg0) {
explistadapter =
new Simpleexpandablelistadapter(
TransactionsShortActivity.this,// Keys in childData maps to display.
new int[] { R.id.grp_child} // Data under the keys above go into these TextViews.
);
return null;
}
protected void clearUI() {
mDeviceAddress.setText(String.format(getString(R.string.ble_address),""));
mDeviceStatus.setText(String.format(getString(R.string.ble_state),""));
mDeviceData.setText(String.format(getString(R.string.ble_data),""));
mDeviceService.setAdapter((Simpleexpandablelistadapter)null);
}
项目:AndroidBleManager
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mGattUUID.setText(R.string.no_data);
mGattUUIDDesc.setText(R.string.no_data);
mDataAsArray.setText(R.string.no_data);
mDataAsstring.setText(R.string.no_data);
}
项目:OverPulltorefresh
文件:PullToRefreshExpandableListActivity.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_expandable_list);
mpullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);
// Set a listener to be invoked when the list should be refreshed.
mpullRefreshListView.setonRefreshListener(new OnRefreshListener<ExpandableListView>() {
@Override
public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
for (String group : mGroupStrings) {
Map<String,String> groupMap1 = new HashMap<String,String>();
groupData.add(groupMap1);
groupMap1.put(KEY,group);
List<Map<String,String>> childList = new ArrayList<Map<String,String>>();
for (String string : mChildStrings) {
Map<String,String> childMap = new HashMap<String,String>();
childList.add(childMap);
childMap.put(KEY,string);
}
childData.add(childList);
}
mAdapter = new Simpleexpandablelistadapter(this,groupData,android.R.layout.simple_expandable_list_item_1,new String[] { KEY },new int[] { android.R.id.text1 },childData,new int[] { android.R.id.text1 });
setlistadapter(mAdapter);
}
项目:anvil-examples
文件:ExpandableListLayout.java
public ExpandableListLayout(Context c) {
super(c);
expanded = new boolean[GROUP.length];
List<Map<String,String>> groupData = new ArrayList<>();
List<List<Map<String,String>>> childData = new ArrayList<>();
for (int i = 0; i < GROUP.length; i++) {
Map<String,String> map = new HashMap<String,String>();
groupData.add(map);
map.put(NAME,GROUP[i]);
List<Map<String,String>> children = new ArrayList<>();
for (int j = 0; j < CHILD[i].length; j++) {
Map<String,String>();
children.add(childMap);
childMap.put(NAME,CHILD[i][j]);
}
childData.add(children);
expanded[i] = false;
}
mAdapter = new Simpleexpandablelistadapter(c,new String[] { NAME },new int[] { android.R.id.text1 });
}
项目:ApkLauncher
文件:ExpandableList3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,String>> groupData = new ArrayList<Map<String,String>>();
List<List<Map<String,String>>> childData = new ArrayList<List<Map<String,String>>>();
for (int i = 0; i < 20; i++) {
Map<String,String> curGroupMap = new HashMap<String,String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME,"Group " + i);
curGroupMap.put(IS_EVEN,(i % 2 == 0) ? "This group is even" : "This group is odd");
List<Map<String,String>> children = new ArrayList<Map<String,String>>();
for (int j = 0; j < 15; j++) {
Map<String,String> curChildMap = new HashMap<String,String>();
children.add(curChildMap);
curChildMap.put(NAME,"Child " + j);
curChildMap.put(IS_EVEN,(j % 2 == 0) ? "This child is even" : "This child is odd");
}
childData.add(children);
}
// Set up our adapter
mAdapter = new Simpleexpandablelistadapter(
this,new String[] { NAME,IS_EVEN },android.R.id.text2 },android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:ApiDemos
文件:ExpandableList3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:FullRobolectricTestSample
文件:ExpandableListViewTest.java
@Ignore("not yet working in 2.0,sorry :-(") // todo 2.0-cleanup
@Test
public void testPerformItemClick_ShouldFireOnItemClickListener() throws Exception {
Simpleexpandablelistadapter adapter = holyCrapYouHaveGottoBeKidding();
expandableListView.setAdapter(adapter);
expandableListView.setonChildClickListener(myOnChildClickListener);
expandableListView.expandGroup(1);
shadowOf(expandableListView).populateItems();
expandableListView.performItemClick(null,-1); // open the group...
expandableListView.performItemClick(null,6,-1);
transcript.assertEventsSoFar("item was clicked: 6");
}
项目:FullRobolectricTestSample
文件:ExpandableListViewTest.java
private Simpleexpandablelistadapter holyCrapYouHaveGottoBeKidding() {
List<Map<String,String>>();
List<List<Map<String,String>>>();
for (int i = 0; i < 20; i++) {
Map<String,String>();
groupData.add(curGroupMap);
curGroupMap.put("NAME","Item " + i);
curGroupMap.put("IS_EVEN",(i % 2 == 0) ? "This group is even" : "This group is odd");
List<Map<String,String>>();
for (int j = 0; j < 5; j++) {
Map<String,String>();
children.add(curChildMap);
// curChildMap.put(NAME,"Child " + j);
curChildMap.put("IS_EVEN",(j % 2 == 0) ? "Hello " + j : "Good Morning " + j);
}
childData.add(children);
}
return new Simpleexpandablelistadapter(
Robolectric.application,R.layout.simple_expandable_list_item_1,new String[] {"NAME","IS_EVEN"},new int[] {R.id.text1,R.id.text2},R.layout.simple_expandable_list_item_2,R.id.text2}
);
}
private void clearUI() {
mExportString = null;
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mGattUUID.setText(R.string.no_data);
mGattUUIDDesc.setText(R.string.no_data);
mDataAsArray.setText(R.string.no_data);
mDataAsstring.setText(R.string.no_data);
}
项目:UltimateAndroid
文件:ExpandableListViewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edge_effect_expandablelistview_layout);
//this comes from android samples
List<Map<String,(j % 2 == 0) ? "This child is even" : "This child is odd");
}
childData.add(children);
}
// Set up our adapter
((EdgeEffectExpandableListView) findViewById(R.id.expandablelistview)).setAdapter(new Simpleexpandablelistadapter(
this,new String[]{NAME,IS_EVEN},new int[]{android.R.id.text1,android.R.id.text2}
));
}
项目:Z_MyProPullToRefresh
文件:PullToRefreshExpandableListActivity.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_expandable_list);
mpullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);
// Set a listener to be invoked when the list should be refreshed.
mpullRefreshListView.setonRefreshListener(new OnRefreshListener<ExpandableListView>() {
@Override
public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
for (String group : mGroupStrings) {
Map<String,new int[] { android.R.id.text1 });
setlistadapter(mAdapter);
}
项目:irma_future_id
文件:PluginActivity.java
/**
* Creates the View containing the Plugin's actions.
*
* @return The View containing the Plugin's actions.
*/
private ScrollView createActionsView() {
LayoutParams fillParams = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
int padding = this.getResources().getDimensionPixelSize(R.dimen.padding);
ScrollView sv = new ScrollView(PluginActivity.this);
sv.setLayoutParams(fillParams);
sv.setPadding(padding,padding,padding);
ExpandableListView elv = new ExpandableListView(PluginActivity.this) {
// workaround to get a ExpandableListView displayed in a ScrollView
@Override
public void onMeasure(int widthMeasureSpec,int heightMeasureSpec) {
// Calculate entire height by providing a very large height hint.
// But do not use the highest 2 bits of this integer; those are
// reserved for the MeasureSpec mode.
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec,expandSpec);
android.view.ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
};
elv.setLayoutParams(fillParams);
Simpleexpandablelistadapter sela = new PluginActionsexpandablelistadapter(this,PluginActivity.this,R.layout.group_row,new int[] { R.id.row_name },createChildList(),R.layout.child_row,new String[] { DESC },new int[] { R.id.grp_child });
elv.setAdapter(sela);
sv.addView(elv);
return sv;
}
项目:Android-PullToRefresh-VerticalViewPager
文件:PullToRefreshExpandableListActivity.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_expandable_list);
mpullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);
// Set a listener to be invoked when the list should be refreshed.
mpullRefreshListView.setonRefreshListener(new OnRefreshListener<ExpandableListView>() {
@Override
public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
for (String group : mGroupStrings) {
Map<String,new int[] { android.R.id.text1 });
setlistadapter(mAdapter);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:MEng
文件:ExpandableList3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:RoviRunner
文件:MainActivityPresenter.java
@Override
public expandablelistadapter getStreamingSourcesAdapter()
{
// refer to: http://blog.denevell.org/android-Simpleexpandablelistadapter-example.html
// keys for our maps we'll be creating
final String KEY_GROUP_NAME = "GROUP_NAME";
final String KEY_CHILD_NAME = "STREAM_SOURCE";
// we only have one parent
List<Map<String,String>> listofParents = new ArrayList<Map<String,String>>();
Map<String,String> parents = new HashMap<String,String>();
parents.put( KEY_GROUP_NAME,"Stream music from..." );
listofParents.add( parents );
// that one parent has children; each child needs to be its own map,which may
// seem interesting,but it's required by Simpleexpandablelistadapter
List<List<Map<String,String>>> listofChildLists = new ArrayList<List<Map<String,String>>>();
List<Map<String,String>>();
for ( String value : m_streamingSourcesMgr.getAvailableStreamingSources().values() )
{
Map<String,String> child = new HashMap<String,String>();
child.put( KEY_CHILD_NAME,value );
children.add( child );
}
listofChildLists.add( children );
expandablelistadapter adapter = new Simpleexpandablelistadapter( m_context,listofParents,R.layout.streaming_sources_group_view,new String[] { KEY_GROUP_NAME },new int[] { R.id.streaming_sources_group_name },listofChildLists,R.layout.streaming_sources_row_view,new String[] { KEY_CHILD_NAME },new int[] { R.id.streaming_sources_row_name } );
return adapter;
}
项目:codeexamples-android
文件:ExpandableList3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:deview-2013-samples
文件:ExpandableList3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String,android.R.id.text2 }
);
setlistadapter(mAdapter);
}
项目:PullToRefresh-StaggeredGridView
文件:PullToRefreshExpandableListActivity.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_expandable_list);
mpullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);
// Set a listener to be invoked when the list should be refreshed.
mpullRefreshListView.setonRefreshListener(new OnRefreshListener<ExpandableListView>() {
@Override
public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
for (String group : mGroupStrings) {
Map<String,new int[] { android.R.id.text1 });
setlistadapter(mAdapter);
}
项目:igrow-android
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(com.igrow.android.R.string.no_data);
}
项目:igrow-android
文件:DeviceControlActivity.java
private void displayGattServices(List<BluetoothGattService> gattServices) {
if (gattServices == null) return;
String uuid = null;
String unkNownServiceString = getResources().getString(com.igrow.android.R.string.unkNown_service);
String unkNownCharaString = getResources().getString(com.igrow.android.R.string.unkNown_characteristic);
ArrayList<HashMap<String,String>> gattServiceData = new ArrayList<HashMap<String,String>>();
ArrayList<ArrayList<HashMap<String,String>>> gattCharacteristicData
= new ArrayList<ArrayList<HashMap<String,String>>>();
mGattcharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
// Loops through available GATT Services.
for (BluetoothGattService gattService : gattServices) {
HashMap<String,String> currentServiceData = new HashMap<String,String>();
uuid = gattService.getUuid().toString();
currentServiceData.put(
LIST_NAME,IGrowGattAttributes.lookup(uuid,unkNownServiceString));
currentServiceData.put(LIST_UUID,uuid);
gattServiceData.add(currentServiceData);
ArrayList<HashMap<String,String>> gattCharacteristicGroupData =
new ArrayList<HashMap<String,String>>();
List<BluetoothGattCharacteristic> gattcharacteristics =
gattService.getcharacteristics();
ArrayList<BluetoothGattCharacteristic> charas =
new ArrayList<BluetoothGattCharacteristic>();
// Loops through available characteristics.
for (BluetoothGattCharacteristic gattCharacteristic : gattcharacteristics) {
charas.add(gattCharacteristic);
HashMap<String,String> currentCharaData = new HashMap<String,String>();
uuid = gattCharacteristic.getUuid().toString();
currentCharaData.put(
LIST_NAME,unkNownCharaString));
currentCharaData.put(LIST_UUID,uuid);
gattCharacteristicGroupData.add(currentCharaData);
}
mGattcharacteristics.add(charas);
gattCharacteristicData.add(gattCharacteristicGroupData);
}
Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(
this,new String[] {LIST_NAME,LIST_UUID},android.R.id.text2 }
);
mGattServicesList.setAdapter(gattServiceAdapter);
}
项目:Android-BLE-to-Arduino
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(R.string.no_data);
}
项目:Android-BLE-to-Arduino
文件:DeviceControlActivity.java
private void displayGattServices(List<BluetoothGattService> gattServices) {
if (gattServices == null)
return;
String uuid = null;
String unkNownServiceString = getResources().getString(
R.string.unkNown_service);
String unkNownCharaString = getResources().getString(
R.string.unkNown_characteristic);
ArrayList<HashMap<String,String>>> gattCharacteristicData = new ArrayList<ArrayList<HashMap<String,String>();
uuid = gattService.getUuid().toString();
currentServiceData.put(LIST_NAME,SampleGattAttributes.lookup(uuid,String>> gattCharacteristicGroupData = new ArrayList<HashMap<String,String>>();
List<BluetoothGattCharacteristic> gattcharacteristics = gattService
.getcharacteristics();
ArrayList<BluetoothGattCharacteristic> charas = new ArrayList<BluetoothGattCharacteristic>();
// Loops through available characteristics.
for (BluetoothGattCharacteristic gattCharacteristic : gattcharacteristics) {
charas.add(gattCharacteristic);
HashMap<String,String>();
uuid = gattCharacteristic.getUuid().toString();
currentCharaData.put(LIST_NAME,uuid);
gattCharacteristicGroupData.add(currentCharaData);
}
mGattcharacteristics.add(charas);
gattCharacteristicData.add(gattCharacteristicGroupData);
}
Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(
this,new String[]{
LIST_NAME,android.R.id.text2});
mGattServicesList.setAdapter(gattServiceAdapter);
}
项目:BLE
文件:DeviceControlActivity.java
/**
* 根据GATT服务显示该服务下的所有特征值
*
* @param gattServices GATT服务
* @return
*/
private Simpleexpandablelistadapter displayGattServices(final List<BluetoothGattService> gattServices) {
if (gattServices == null) return null;
String uuid;
final String unkNownServiceString = getResources().getString(R.string.unkNown_service);
final String unkNownCharaString = getResources().getString(R.string.unkNown_characteristic);
final List<Map<String,String>> gattServiceData = new ArrayList<>();
final List<List<Map<String,String>>> gattCharacteristicData = new ArrayList<>();
mGattServices = new ArrayList<>();
mGattcharacteristics = new ArrayList<>();
// Loops through available GATT Services.
for (final BluetoothGattService gattService : gattServices) {
final Map<String,String> currentServiceData = new HashMap<>();
uuid = gattService.getUuid().toString();
currentServiceData.put(LIST_NAME,GattAttributeResolver.getAttributeName(uuid,uuid);
gattServiceData.add(currentServiceData);
final List<Map<String,String>> gattCharacteristicGroupData = new ArrayList<>();
final List<BluetoothGattCharacteristic> gattcharacteristics = gattService.getcharacteristics();
final List<BluetoothGattCharacteristic> charas = new ArrayList<>();
// Loops through available characteristics.
for (final BluetoothGattCharacteristic gattCharacteristic : gattcharacteristics) {
charas.add(gattCharacteristic);
final Map<String,String> currentCharaData = new HashMap<>();
uuid = gattCharacteristic.getUuid().toString();
currentCharaData.put(LIST_NAME,uuid);
gattCharacteristicGroupData.add(currentCharaData);
}
mGattServices.add(gattService);
mGattcharacteristics.add(charas);
gattCharacteristicData.add(gattCharacteristicGroupData);
}
final Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(this,android.R.layout
.simple_expandable_list_item_2,new String[]{LIST_NAME,new
int[]{android.R.id.text1,android.R.id.text2});
return gattServiceAdapter;
}
项目:sample-android-ble
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(R.string.no_data);
}
项目:sample-android-ble
文件:DeviceControlActivity.java
private void displayGattServices(List<BluetoothGattService> gattServices) {
if (gattServices == null) return;
String uuid = null;
String unkNownServiceString = getResources().getString(R.string.unkNown_service);
String unkNownCharaString = getResources().getString(R.string.unkNown_characteristic);
ArrayList<HashMap<String,android.R.id.text2 }
);
mGattServicesList.setAdapter(gattServiceAdapter);
}
/**
* 显示Gatt服务
*
* @param gattServices
*/
protected void displayGattService(List<BluetoothGattService> gattServices) {
if (gattServices == null) {
return;
}
ArrayList<HashMap<String,String>> gattServiceData = new ArrayList<>();
ArrayList<List<HashMap<String,String>>> gattCharacteristicData = new ArrayList<>();
mGattcharacteristics = new ArrayList<>();
String LIST_PROPERTY = "PROPERTIES";
String LIST_UUID = "UUID";
for (BluetoothGattService gattService : gattServices) {
final HashMap<String,String> currentServiceData = new HashMap<>();
String serviceUuid = gattService.getUuid().toString();
currentServiceData.put(LIST_UUID,serviceUuid);
gattServiceData.add(currentServiceData);
final List<HashMap<String,String>> gattCharacteristicGroupData = new ArrayList<>();
final List<BluetoothGattCharacteristic> gattcharacteristics = gattService.getcharacteristics();
final List<BluetoothGattCharacteristic> chars = new ArrayList<>();
for (BluetoothGattCharacteristic gattCharacteristic : gattcharacteristics) {
chars.add(gattCharacteristic);
final HashMap<String,String> currentCharaData = new HashMap<>();
String characteristicUuid = gattCharacteristic.getUuid().toString();
String property = gattCharacteristicPropertySwitch(gattCharacteristic);
currentCharaData.put(LIST_PROPERTY,getString(R.string.ble_property) + property);
currentCharaData.put(LIST_UUID,characteristicUuid);
gattCharacteristicGroupData.add(currentCharaData);
}
mGattcharacteristics.add(chars);
gattCharacteristicData.add(gattCharacteristicGroupData);
}
Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(this,new String[]{LIST_UUID},new int[]{android.R.id.text1},new String[]{LIST_PROPERTY,android.R.id.text2}) {
};
mDeviceService.setAdapter(gattServiceAdapter);
}
项目:AndroidBleManager
文件:DeviceControlActivity.java
private void displayGattServices(final List<BluetoothGattService> gattServices) {
if (gattServices == null) return;
generateExportString(gattServices);
String uuid = null;
final String unkNownServiceString = getResources().getString(R.string.unkNown_service);
final String unkNownCharaString = getResources().getString(R.string.unkNown_characteristic);
final List<Map<String,String>>> gattCharacteristicData = new ArrayList<>();
mGattcharacteristics = new ArrayList<>();
// Loops through available GATT Services.
for (final BluetoothGattService gattService : gattServices) {
final Map<String,uuid.substring(4,8));
System.out.println("---service name:"+currentServiceData.get(LIST_NAME));
System.out.println("---service uuid:" + uuid);
gattServiceData.add(currentServiceData);
final List<Map<String,String> currentCharaData = new HashMap<>();
uuid = gattCharacteristic.getUuid().toString();
String property = getPropertyString(gattCharacteristic.getProperties());
currentCharaData.put(LIST_NAME,8)+" "+property);
System.out.println("-----char name:" + currentCharaData.get(LIST_NAME));
System.out.println("-----chat uuid:"+ uuid);
gattCharacteristicGroupData.add(currentCharaData);
for (BluetoothGattDescriptor gattDescriptor:gattCharacteristic.getDescriptors()){
System.out.println("--------des name:" + gattDescriptor.getUuid());
System.out.println("--------des uuid:" + gattDescriptor.getValue()+" "+gattDescriptor.getPermissions());
}
}
mGattcharacteristics.add(charas);
gattCharacteristicData.add(gattCharacteristicGroupData);
}
final Simpleexpandablelistadapter gattServiceAdapter = new Simpleexpandablelistadapter(
this,android.R.id.text2}
);
mGattServicesList.setAdapter(gattServiceAdapter);
invalidateOptionsMenu();
}
项目:Newton_for_Android_AS
文件:HelpFragment.java
@Override
public void onViewCreated(View view,Bundle savedInstanceState) {
super.onViewCreated(view,savedInstanceState);
ExpandableListView helpEx = (ExpandableListView) findViewById(R.id.helpEx);
// 去掉默认的图标
helpEx.setGroupIndicator(null);
Context context = getActivity();
List<Map<String,String>> groups = new ArrayList<Map<String,String> group1 = new HashMap<String,String>();
group1.put("group",getString(R.string.aboutus));
Map<String,String> group2 = new HashMap<String,String>();
group2.put("group",String> group3 = new HashMap<String,String>();
group3.put("group",String> group4 = new HashMap<String,String>();
group4.put("group",getString(R.string.aboutus));
groups.add(group1);
groups.add(group2);
groups.add(group3);
groups.add(group4);
List<Map<String,String>> child1 = new ArrayList<Map<String,String> child1data1 = new HashMap<String,String>();
child1data1.put("child",getString(R.string.aboutus));
child1.add(child1data1);
List<Map<String,String>> child2 = new ArrayList<Map<String,String> child1data2 = new HashMap<String,String>();
child1data2.put("child",getString(R.string.aboutus));
child2.add(child1data2);
List<Map<String,String>> child3 = new ArrayList<Map<String,String> child1data3 = new HashMap<String,String>();
child1data3.put("child",getString(R.string.aboutus));
child3.add(child1data3);
List<Map<String,String>> child4 = new ArrayList<Map<String,String> child1data4 = new HashMap<String,String>();
child1data4.put("child",getString(R.string.aboutus));
child4.add(child1data4);
List<List<Map<String,String>>> childs = new ArrayList<List<Map<String,String>>>();
childs.add(child1);
childs.add(child2);
childs.add(child3);
childs.add(child4);
Simpleexpandablelistadapter adapter = new Simpleexpandablelistadapter(
context,groups,R.layout.help_group,new String[] { "group" },new int[] { R.id.groupTo },childs,R.layout.help_child,new String[] { "child" },new int[] { R.id.childTo });
helpEx.setAdapter(adapter);
helpEx.setSelector(R.drawable.help_ex_selector);
}
项目:android-diplicity
文件:MainActivity.java
private void setupNavigation() {
navigationRootGroups = new ArrayList<Map<String,String>>() {{
add(new HashMap<String,String>() {{
put("ROOT_NAME",getResources().getString(R.string.games));
}});
add(new HashMap<String,getResources().getString(R.string.users));
}});
}};
navigationChildGroups = new ArrayList<List<Map<String,String>>>();
List<Map<String,String>> childGroupForFirstGroupRow = new ArrayList<Map<String,String>>(){{
add(new HashMap<String,String>() {{
put("CHILD_NAME",getResources().getString(R.string.my_started));
}});
add(new HashMap<String,getResources().getString(R.string.my_staging));
}});
add(new HashMap<String,getResources().getString(R.string.my_finished));
}});
add(new HashMap<String,getResources().getString(R.string.open));
}});
add(new HashMap<String,getResources().getString(R.string.started));
}});
add(new HashMap<String,getResources().getString(R.string.finished));
}});
}};
navigationChildGroups.add(childGroupForFirstGroupRow);
List<Map<String,String>> childGroupForSecondGroupRow = new ArrayList<Map<String,getResources().getString(R.string.top_rated));
}});
add(new HashMap<String,getResources().getString(R.string.top_reliable));
}});
add(new HashMap<String,getResources().getString(R.string.top_quick));
}});
add(new HashMap<String,getResources().getString(R.string.top_hated));
}});
add(new HashMap<String,getResources().getString(R.string.top_hater));
}});
}};
navigationChildGroups.add(childGroupForSecondGroupRow);
Simpleexpandablelistadapter navigationlistadapter = new Simpleexpandablelistadapter(
this,navigationRootGroups,new String[] { "ROOT_NAME" },navigationChildGroups,new String[] { "CHILD_NAME" },new int[] { android.R.id.text1 }
);
ExpandableListView navigationList = (ExpandableListView) findViewById(R.id.nav_list);
navigationList.setAdapter(navigationlistadapter);
connectNavigationList(navigationList);
}
项目:BleDemo
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(R.string.no_data);
}
项目:wearbooksource
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(R.string.no_data);
}
项目:wearbooksource
文件:DeviceControlActivity.java
private void displayGattServices(List<BluetoothGattService> gattServices) {
if (gattServices == null) return;
String uuid = null;
String unkNownServiceString = getResources().getString(R.string.unkNown_service);
String unkNownCharaString = getResources().getString(R.string.unkNown_characteristic);
ArrayList<HashMap<String,android.R.id.text2 }
);
mGattServicesList.setAdapter(gattServiceAdapter);
}
项目:itsnat_droid
文件:TestSetupAssetLayout1.java
private static void defineExpandableListView(TestActivity act,View rootView)
{
// http://stackoverflow.com/questions/17636735/expandable-listview-in-fragment
// Resources res = act.getResources();
ExpandableListView listView = (ExpandableListView) rootView.findViewById(R.id.expanListViewTestId);
final int NUM_GROUPS = 10;
final String NAME = "NAME";
final String IS_EVEN = "IS_EVEN";
List<Map<String,String>>();
for (int i = 0; i < NUM_GROUPS; i++) // 10 grupos
{
Map<String,String>(); // Grupo
groupData.add(curGroupMap);
curGroupMap.put(NAME,"Group " + i);
// Comentamos el segundo texto del item de grupo porque simple_expandable_list_item_1 sólo tiene text1
//curGroupMap.put(IS_EVEN,(i % 2 == 0) ? "This group is even" : "This group is odd"); // No se muestra porque
}
List<List<Map<String,String>>>();
for (int i = 0; i < NUM_GROUPS; i++) // 10 grupos
{
List<Map<String,String>>();
for (int j = 0; j < 2; j++)
{
Map<String,"Child " + i + " " + j);
curChildMap.put(IS_EVEN,(j % 2 == 0) ? "This child is even" : "This child is odd");
}
childData.add(children);
}
// Set up our adapter
Simpleexpandablelistadapter mAdapter = new Simpleexpandablelistadapter(act,// https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/simple_expandable_list_item_1.xml
new String[]{NAME},//new String[] { NAME,// new int[] { android.R.id.text1,// https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/simple_expandable_list_item_2.xml
new String[]{NAME,android.R.id.text2});
listView.setAdapter(mAdapter);
}
项目:binea_project_for_android
文件:DeviceControlActivity.java
private void clearUI() {
mGattServicesList.setAdapter((Simpleexpandablelistadapter) null);
mdatafield.setText(R.string.no_data);
}
项目:binea_project_for_android
文件:DeviceControlActivity.java
private void displayGattServices(List<BluetoothGattService> gattServices) {
if (gattServices == null) return;
String uuid = null;
String unkNownServiceString = getResources().getString(R.string.unkNown_service);
String unkNownCharaString = getResources().getString(R.string.unkNown_characteristic);
ArrayList<HashMap<String,android.R.id.text2 }
);
mGattServicesList.setAdapter(gattServiceAdapter);
}