Search in sources :

Example 76 with ExpandableListView

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);
    }
}
Also used : DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Intent(android.content.Intent) ArrayList(java.util.ArrayList) List(java.util.List) TextView(android.widget.TextView) View(android.view.View) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 77 with ExpandableListView

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;
}
Also used : View(android.view.View) ExpandableListView(android.widget.ExpandableListView)

Example 78 with ExpandableListView

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;
}
Also used : OnDatatransferProgressListener(com.owncloud.android.lib.common.network.OnDatatransferProgressListener) Observer(java.util.Observer) ImageButton(android.widget.ImageButton) ThumbnailsCacheManager(com.owncloud.android.datamodel.ThumbnailsCacheManager) Arrays(java.util.Arrays) DateUtils(android.text.format.DateUtils) ProgressBar(android.widget.ProgressBar) Uri(android.net.Uri) ImageView(android.widget.ImageView) OCFile(com.owncloud.android.datamodel.OCFile) PreferenceUtils(com.owncloud.android.utils.PreferenceUtils) BaseExpandableListAdapter(android.widget.BaseExpandableListAdapter) CancelUploadWithIdUseCase(com.owncloud.android.usecases.CancelUploadWithIdUseCase) View(android.view.View) DisplayUtils(com.owncloud.android.utils.DisplayUtils) PREF__CAMERA_UPLOADS_DEFAULT_PATH(com.owncloud.android.db.PreferenceManager.PREF__CAMERA_UPLOADS_DEFAULT_PATH) DataSetObserver(android.database.DataSetObserver) RetryUploadFromContentUriUseCase(com.owncloud.android.usecases.RetryUploadFromContentUriUseCase) TransferRequester(com.owncloud.android.files.services.TransferRequester) Account(android.accounts.Account) UploadStatus(com.owncloud.android.datamodel.UploadsStorageManager.UploadStatus) AppCompatButton(androidx.appcompat.widget.AppCompatButton) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) OCUpload(com.owncloud.android.datamodel.OCUpload) TextView(android.widget.TextView) OwnCloudAccount(com.owncloud.android.lib.common.OwnCloudAccount) MainApp(com.owncloud.android.MainApp) DocumentFile(androidx.documentfile.provider.DocumentFile) UploadResult(com.owncloud.android.db.UploadResult) FileUploader(com.owncloud.android.files.services.FileUploader) Snackbar(com.google.android.material.snackbar.Snackbar) R(com.owncloud.android.R) MimetypeIconUtil(com.owncloud.android.utils.MimetypeIconUtil) Context(android.content.Context) FileActivity(com.owncloud.android.ui.activity.FileActivity) UploadsStorageManager(com.owncloud.android.datamodel.UploadsStorageManager) WorkManager(androidx.work.WorkManager) UploadListFragment(com.owncloud.android.ui.fragment.UploadListFragment) WeakReference(java.lang.ref.WeakReference) LayoutInflater(android.view.LayoutInflater) AccountUtils(com.owncloud.android.authentication.AccountUtils) File(java.io.File) OptionsInUploadListClickListener(com.owncloud.android.ui.fragment.OptionsInUploadListClickListener) Bitmap(android.graphics.Bitmap) ExpandableListView(android.widget.ExpandableListView) Comparator(java.util.Comparator) Observable(java.util.Observable) OnClickListener(android.view.View.OnClickListener) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ExpandableListView(android.widget.ExpandableListView) AppCompatButton(androidx.appcompat.widget.AppCompatButton)

Example 79 with ExpandableListView

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);
}
Also used : View(android.view.View) TextView(android.widget.TextView) ExpandableListView(android.widget.ExpandableListView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 80 with ExpandableListView

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;
}
Also used : ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) ExpandableListAdapter(ca.etsmtl.applets.etsmobile.ui.adapter.ExpandableListAdapter) FicheEmploye(ca.etsmtl.applets.etsmobile.model.FicheEmploye) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout) View(android.view.View) SearchView(androidx.appcompat.widget.SearchView) ExpandableListView(android.widget.ExpandableListView) BottinDetailsActivity(ca.etsmtl.applets.etsmobile.ui.activity.BottinDetailsActivity) OnChildClickListener(android.widget.ExpandableListView.OnChildClickListener) ExpandableListView(android.widget.ExpandableListView)

Aggregations

ExpandableListView (android.widget.ExpandableListView)86 View (android.view.View)59 TextView (android.widget.TextView)30 AdapterView (android.widget.AdapterView)18 Intent (android.content.Intent)16 ListView (android.widget.ListView)16 ArrayList (java.util.ArrayList)16 AbsListView (android.widget.AbsListView)14 DialogInterface (android.content.DialogInterface)11 ImageView (android.widget.ImageView)11 List (java.util.List)11 Builder (android.app.AlertDialog.Builder)9 ViewGroup (android.view.ViewGroup)9 ExpandableListAdapter (android.widget.ExpandableListAdapter)7 AbsSpinner (android.widget.AbsSpinner)6 QuickContactBadge (android.widget.QuickContactBadge)6 TabHost (android.widget.TabHost)6 AdapterBinding (com.android.ide.common.rendering.api.AdapterBinding)6 ResourceReference (com.android.ide.common.rendering.api.ResourceReference)6 SessionParams (com.android.ide.common.rendering.api.SessionParams)6