use of android.widget.ExpandableListView in project Thrift-box by Sash0k.
the class ExpandableListFragment method ensureList.
private void ensureList() {
if (mExpandableList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
if (root instanceof ExpandableListView) {
mExpandableList = (ExpandableListView) root;
} else {
mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID);
if (mStandardEmptyView == null) {
mEmptyView = root.findViewById(android.R.id.empty);
} else {
mStandardEmptyView.setVisibility(View.GONE);
}
mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
mExpandableListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID);
View rawExpandableListView = root.findViewById(android.R.id.list);
if (!(rawExpandableListView instanceof ExpandableListView)) {
if (rawExpandableListView == null) {
throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
}
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
}
mExpandableList = (ExpandableListView) rawExpandableListView;
if (mEmptyView != null) {
mExpandableList.setEmptyView(mEmptyView);
} else if (mEmptyText != null) {
mStandardEmptyView.setText(mEmptyText);
mExpandableList.setEmptyView(mStandardEmptyView);
}
}
mExpandableListShown = true;
mExpandableList.setOnItemClickListener(mOnClickListener);
// add invisible indicator
mExpandableList.setGroupIndicator(getResources().getDrawable(R.drawable.expandable_list_icon_selector));
if (mAdapter != null) {
ExpandableListAdapter adapter = mAdapter;
mAdapter = null;
setListAdapter(adapter);
} else {
// have our data right away and start with the progress indicator.
if (mProgressContainer != null) {
setListShown(false, false);
}
}
mHandler.post(mRequestFocus);
}
use of android.widget.ExpandableListView in project Thrift-box by Sash0k.
the class ExpensesFragment method onActivityCreated.
// ============================================================================
@Override
public void onActivityCreated(Bundle savedState) {
super.onActivityCreated(savedState);
setEmptyText(getString(R.string.list_empty));
setHasOptionsMenu(false);
setListShown(false);
// styling listView
final ExpandableListView list = getListView();
final Drawable divider = getResources().getDrawable(R.drawable.empty_divider);
list.setChildDivider(divider);
list.setOnChildClickListener(this);
LoaderManager lm = getLoaderManager();
if (lm != null)
lm.initLoader(LOADER_ID, null, this);
}
use of android.widget.ExpandableListView in project packages_apps_AicpExtras by AICP.
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 mobile-messaging-sdk-android by infobip.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
totalReceivedTextView = findViewById(R.id.totalReceivedTextView);
ExpandableListView messagesListView = findViewById(R.id.messagesListView);
assert messagesListView != null;
listAdapter = new ExpandableListAdapter(this, onMessageExpandedListener);
messagesListView.setAdapter(listAdapter);
initializeMobileMessaging();
registerReceivers();
registerPreferenceChangeListener();
clearNotifications();
// handle event started from SDK from background
Intent intent = getIntent();
if (InteractiveEvent.NOTIFICATION_ACTION_TAPPED.getKey().equals(intent.getAction())) {
onNotificationActionTapped(intent);
}
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
String[] permissions = { Manifest.permission.ACCESS_FINE_LOCATION };
ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE);
return;
}
activateGeofencing();
}
use of android.widget.ExpandableListView in project AnExplorer by 1hakr.
the class RootsFragment method restoreExpandedState.
private void restoreExpandedState(ArrayList<Long> expandedIds) {
this.expandedIds = expandedIds;
if (expandedIds != null) {
ExpandableListView list = mList;
ExpandableListAdapter adapter = mAdapter;
if (adapter != null) {
for (int i = 0; i < adapter.getGroupCount(); i++) {
long id = adapter.getGroupId(i);
if (expandedIds.contains(id))
list.expandGroup(i);
}
}
}
}
Aggregations