use of android.widget.ExpandableListView in project android_packages_apps_crDroidSettings by crdroidandroid.
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 android_packages_apps_DU-Tweaks by DirtyUnicorns.
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 androidquery by androidquery.
the class Common method onScrollStateChanged.
private void onScrollStateChanged(ExpandableListView elv, int scrollState) {
elv.setTag(AQuery.TAG_NUM, scrollState);
if (scrollState == SCROLL_STATE_IDLE) {
int first = elv.getFirstVisiblePosition();
int last = elv.getLastVisiblePosition();
int count = last - first;
ExpandableListAdapter ela = elv.getExpandableListAdapter();
for (int i = 0; i <= count; i++) {
long packed = elv.getExpandableListPosition(i + first);
int group = ExpandableListView.getPackedPositionGroup(packed);
int child = ExpandableListView.getPackedPositionChild(packed);
if (group >= 0) {
View convertView = elv.getChildAt(i);
Long targetPacked = (Long) convertView.getTag(AQuery.TAG_NUM);
if (targetPacked != null && targetPacked.longValue() == packed) {
if (child == -1) {
ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
} else {
ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);
}
convertView.setTag(AQuery.TAG_NUM, null);
} else {
// AQUtility.debug("skip!");
}
}
}
}
}
use of android.widget.ExpandableListView in project androidquery by androidquery.
the class AbstractAQuery method adapter.
/**
* Set the adapter of an ExpandableListView.
*
* @param adapter adapter
* @return self
*/
public T adapter(ExpandableListAdapter adapter) {
if (view instanceof ExpandableListView) {
ExpandableListView av = (ExpandableListView) view;
av.setAdapter(adapter);
}
return self();
}
use of android.widget.ExpandableListView in project AndroidDevMetrics by frogermcs.
the class Dagger2MetricsFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.adm_fragment_dagger2_metrics, container, false);
lvMetrics = (ExpandableListView) view.findViewById(R.id.lvMetrics);
tvEmpty = (TextView) view.findViewById(R.id.tvEmpty);
interceptorList = AndroidDevMetrics.singleton().interceptors();
if (interceptorList.size() > 1) {
btnMenu = (Button) view.findViewById(R.id.btnMenu);
btnMenu.setVisibility(View.VISIBLE);
btnMenu.setText(interceptorList.get(0).getName());
btnMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showUIInterceptorMenu();
}
});
}
return view;
}
Aggregations