use of android.widget.ExpandableListView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ShortcutPickHelper method processShortcut.
private void processShortcut(final Intent intent, int requestCodeApplication, int requestCodeShortcut) {
// Handle case where user selected "Applications"
String applicationName = mParent.getString(R.string.profile_applist_title);
String application2name = mParent.getString(R.string.picker_activities);
String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
if (applicationName != null && applicationName.equals(shortcutName)) {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
startFragmentOrActivity(pickIntent, requestCodeApplication);
} else if (application2name != null && application2name.equals(shortcutName)) {
final List<PackageInfo> pInfos = mPackageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES);
ExpandableListView appListView = new ExpandableListView(mParent);
AppExpandableAdapter appAdapter = new AppExpandableAdapter(pInfos, mParent);
appListView.setAdapter(appAdapter);
appListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Intent shortIntent = new Intent(Intent.ACTION_MAIN);
String pkgName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.packageName;
String actName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.activities[childPosition].name;
shortIntent.setClassName(pkgName, actName);
completeSetCustomApp(shortIntent);
mAlertDialog.dismiss();
return true;
}
});
Builder builder = new Builder(mParent);
builder.setView(appListView);
mAlertDialog = builder.create();
mAlertDialog.setTitle(mParent.getString(R.string.select_custom_activity_title));
mAlertDialog.show();
mAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mListener.shortcutPicked(null, null, false);
}
});
} else {
startFragmentOrActivity(intent, requestCodeShortcut);
}
}
use of android.widget.ExpandableListView in project little-bear-dictionary by daimajia.
the class ExpandableListActivity method onContentChanged.
@Override
public void onContentChanged() {
super.onContentChanged();
View emptyView = findViewById(R.id.empty);
mList = (ExpandableListView) findViewById(android.R.id.list);
if (mList == null) {
throw new RuntimeException("Your content must have a ExpandableListView whose id attribute is " + "'android.R.id.list'");
}
if (emptyView != null) {
mList.setEmptyView(emptyView);
}
mList.setOnChildClickListener(this);
mList.setOnGroupExpandListener(this);
mList.setOnGroupCollapseListener(this);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mFinishedStart = true;
}
use of android.widget.ExpandableListView in project android by owncloud.
the class ExpandableUploadListAdapter method getGroupView.
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
// force group to stay unfolded
ExpandableListView listView = (ExpandableListView) parent;
listView.expandGroup(groupPosition);
listView.setGroupIndicator(null);
UploadGroup group = (UploadGroup) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mParentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.upload_list_group, null);
// Allow or disallow touches with other visible windows
convertView.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(mParentActivity));
}
TextView tvGroupName = convertView.findViewById(R.id.uploadListGroupName);
TextView tvFileCount = convertView.findViewById(R.id.textViewFileCount);
AppCompatButton clear = convertView.findViewById(R.id.uploadListGroupButtonClear);
AppCompatButton retry = convertView.findViewById(R.id.uploadListGroupButtonRetry);
int stringResFileCount = group.getGroupCount() == 1 ? R.string.uploads_view_group_file_count_single : R.string.uploads_view_group_file_count;
String fileCountText = String.format(mParentActivity.getString(stringResFileCount), group.getGroupCount());
tvGroupName.setText(group.getGroupName());
tvFileCount.setText(fileCountText);
if (group.name.equals(mParentActivity.getString(R.string.uploads_view_group_failed_uploads))) {
clear.setVisibility(View.VISIBLE);
clear.setText(mParentActivity.getString(R.string.action_upload_clear));
clear.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.CLEAR_FAILED));
retry.setVisibility(View.VISIBLE);
retry.setText(mParentActivity.getString(R.string.action_upload_retry));
retry.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.RETRY_FAILED));
} else if (group.name.equals(mParentActivity.getString(R.string.uploads_view_group_finished_uploads))) {
clear.setVisibility(View.VISIBLE);
clear.setText(mParentActivity.getString(R.string.action_upload_clear));
clear.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.CLEAR_SUCCESSFUL));
retry.setVisibility(View.GONE);
} else {
clear.setVisibility(View.GONE);
retry.setVisibility(View.GONE);
}
return convertView;
}
use of android.widget.ExpandableListView in project BleSensorTag by StevenRudenko.
the class DeviceServicesActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.device_services_activity);
gattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
gattServicesList.setOnChildClickListener(this);
final View emptyView = findViewById(R.id.empty_view);
gattServicesList.setEmptyView(emptyView);
dataCharacteristic = (TextView) findViewById(R.id.data_characteristic_uuid);
dataValue = (TextView) findViewById(R.id.data_characteristic_value);
// noinspection ConstantConditions
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar actionBar = getSupportActionBar();
final String deviceName = getDeviceName();
if (TextUtils.isEmpty(deviceName)) {
// noinspection ConstantConditions
actionBar.setTitle(getDeviceAddress());
} else {
// noinspection ConstantConditions
actionBar.setTitle(deviceName);
actionBar.setSubtitle(getDeviceAddress());
}
actionBar.setDisplayHomeAsUpEnabled(true);
}
use of android.widget.ExpandableListView in project ETSMobile-Android2 by ApplETS.
the class BottinFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_bottin, container, false);
mSwipeRefreshLayout = v.findViewById(R.id.swipe_refresh_layout);
mSwipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(getContext(), R.color.ets_red));
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (!Utility.isNetworkAvailable(getActivity())) {
afficherMsgHorsLigne();
mSwipeRefreshLayout.setRefreshing(false);
} else {
afficherRafraichissementEtRechargerBottin();
}
}
});
// get the listview
expListView = v.findViewById(R.id.expandableListView_service_employe);
// Ouverture du détail
expListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
FicheEmploye ficheEmploye = (FicheEmploye) listAdapter.getChild(groupPosition, childPosition);
Intent i = new Intent(getActivity(), BottinDetailsActivity.class);
i.putExtra("nom", ficheEmploye.Nom);
i.putExtra("prenom", ficheEmploye.Prenom);
i.putExtra("telBureau", ficheEmploye.TelBureau);
i.putExtra("emplacement", ficheEmploye.Emplacement);
i.putExtra("courriel", ficheEmploye.Courriel);
i.putExtra("service", ficheEmploye.Service);
i.putExtra("titre", ficheEmploye.Titre);
getActivity().startActivity(i);
return true;
}
});
// create empty data
listDataChild = new HashMap<>();
listDataHeader = new ArrayList<>();
// create custom adapter
listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
updateUI();
return v;
}
Aggregations