Example usage for android.widget ListView setSelectionFromTop

List of usage examples for android.widget ListView setSelectionFromTop

Introduction

In this page you can find the example usage for android.widget ListView setSelectionFromTop.

Prototype

public void setSelectionFromTop(int position, int y) 

Source Link

Document

Sets the selected item and positions the selection y pixels from the top edge of the ListView.

Usage

From source file:com.juick.android.MessagesFragment.java

private void init(final boolean moveToTop) {
    if (implicitlyCreated)
        return;//from  w ww .j a  va  2s  .c om

    parent.imagePreviewHelper = listAdapter.imagePreviewHelper = new ImagePreviewHelper(
            (ViewGroup) getView().findViewById(R.id.imagepreview_container), parent);

    final MessageListBackingData savedMainList = JuickAdvancedApplication.instance.getSavedList(getActivity());
    final ListView lv = getListView();
    boolean canUseMainList = getActivity() instanceof MainActivity; //
    if (savedMainList != null && canUseMainList) {
        messagesSource = savedMainList.messagesSource;
        initListWithMessages(savedMainList.messages);
        int selectItem = 0;
        ListAdapter wrappedAdapter = lv.getAdapter();
        for (int i = 0; i < wrappedAdapter.getCount(); i++) {
            Object ai = wrappedAdapter.getItem(i);
            if (ai != null && ai instanceof JuickMessage) {
                if (((JuickMessage) ai).getMID().equals(savedMainList.topMessageId)) {
                    selectItem = i;
                }
            }
        }
        lv.setSelectionFromTop(selectItem, savedMainList.topMessageScrollPos);
        JuickAdvancedApplication.instance.setSavedList(null, false);
    } else {
        final MessagesLoadNotification messagesLoadNotification = new MessagesLoadNotification(getActivity(),
                handler);
        Thread thr = new Thread("Download messages (init)") {

            public void run() {
                final MessagesLoadNotification notification = messagesLoadNotification;
                final Utils.Function<Void, RetainedData> then = new Utils.Function<Void, RetainedData>() {
                    @Override
                    public Void apply(final RetainedData mespos) {
                        handler.post(new Runnable() {
                            @Override
                            public void run() {
                                notification.statusText.setText("Filter and format..");
                            }
                        });
                        Log.w("com.juick.advanced", "getFirst: before filter");
                        final ArrayList<JuickMessage> messages = filterMessages(mespos.messages);
                        Log.w("com.juick.advanced", "getFirst: after filter");
                        Boolean ownView = null;
                        if (!JuickMessagesAdapter.dontKeepParsed(parent)) {
                            for (JuickMessage juickMessage : messages) {
                                if (ownView == null) {
                                    MicroBlog blog = MainActivity.microBlogs
                                            .get(juickMessage.getMID().getMicroBlogCode());
                                    ownView = blog instanceof OwnRenderItems;
                                }
                                if (!ownView) {
                                    juickMessage.parsedText = JuickMessagesAdapter.formatMessageText(parent,
                                            juickMessage, false);
                                }
                            }
                        }
                        final Parcelable listPosition = mespos.viewState;
                        if (isAdded()) {
                            if (messages.size() == 0) {
                                handler.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        if (notification.lastError == null) {
                                            notification.statusText
                                                    .setText(parent.getString(R.string.EmptyList));
                                        } else {
                                            notification.statusText.setText(
                                                    "Error obtaining messages: " + notification.lastError);

                                        }
                                        notification.progressBar.setVisibility(View.GONE);
                                    }
                                });
                            }
                            final Activity activity = getActivity();
                            if (activity != null) {
                                final Parcelable finalListPosition = listPosition;
                                activity.runOnUiThread(new Runnable() {

                                    public void run() {
                                        try {
                                            if (isAdded()) {
                                                lastPrepareMessages(messages, new Runnable() {
                                                    @Override
                                                    public void run() {
                                                        if (!hasListView()) {
                                                            handler.postDelayed(this, 300);
                                                            return;
                                                        }
                                                        initListWithMessages(messages);
                                                        if (moveToTop) {
                                                            lv.setSelection(0);
                                                        } else {
                                                            if (finalListPosition != null) {
                                                                lv.onRestoreInstanceState(finalListPosition);
                                                            } else {
                                                                //setSelection(messagesSource.supportsBackwardRefresh() ? 1 : 0);
                                                                setSelection(0);
                                                            }
                                                        }
                                                        Log.w("com.juick.advanced", "getFirst: end.");
                                                        handler.postDelayed(new Runnable() {
                                                            @Override
                                                            public void run() {
                                                                onListLoaded();
                                                            }
                                                        }, 10);
                                                    }
                                                });
                                            }
                                        } catch (IllegalStateException e) {
                                            Toast.makeText(activity, e.toString(), Toast.LENGTH_LONG).show();
                                        }
                                    }
                                });
                            }
                        } else {
                            Log.w("com.juick.advanced", "getFirst: not added!");
                        }
                        return null;
                    }
                };
                if (getActivity() != null)
                    messagesSource.setContext(getActivity());
                if (restoreData == null) {
                    messagesSource.getFirst(notification, new Utils.Function<Void, ArrayList<JuickMessage>>() {
                        @Override
                        public Void apply(ArrayList<JuickMessage> juickMessages) {
                            return then.apply(new RetainedData(juickMessages, null));
                        }
                    });
                } else {
                    then.apply((RetainedData) restoreData);
                    restoreData = null;
                }
            }
        };
        thr.setPriority(Thread.MIN_PRIORITY);
        thr.start();
    }
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

private void handleIntent() {
    if (!m_app.isAuthenticated()) {
        Log.v(TAG, "handleIntent: not authenticated");
        startLogin();/*from   w  w  w. j av a 2 s .co m*/
        return;
    }
    if (!m_app.initialSyncDone()) {
        m_sync_dialog = new ProgressDialog(this, m_app.getActiveTheme());
        m_sync_dialog.setIndeterminate(true);
        m_sync_dialog.setMessage("Initial Dropbox sync in progress, please wait....");
        m_sync_dialog.setCancelable(false);
        m_sync_dialog.show();
    } else if (m_sync_dialog != null) {
        m_sync_dialog.cancel();
    }

    mFilter = new ActiveFilter();

    m_leftDrawerList = (ListView) findViewById(R.id.left_drawer);
    m_rightDrawerList = (ListView) findViewById(R.id.right_drawer_list);

    m_drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    // Set the list's click listener
    m_leftDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    if (m_drawerLayout != null) {
        m_drawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
                m_drawerLayout, /* DrawerLayout object */
                R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
                R.string.changelist, /* "open drawer" description */
                R.string.app_label /* "close drawer" description */
        ) {

            /**
             * Called when a drawer has settled in a completely closed
             * state.
             */
            public void onDrawerClosed(View view) {
                // setTitle(R.string.app_label);
            }

            /** Called when a drawer has settled in a completely open state. */
            public void onDrawerOpened(View drawerView) {
                // setTitle(R.string.changelist);
            }
        };

        // Set the drawer toggle as the DrawerListener
        m_drawerLayout.setDrawerListener(m_drawerToggle);
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeButtonEnabled(true);
        }
        m_drawerToggle.syncState();
    }

    // Show search or filter results
    Intent intent = getIntent();
    if (Constants.INTENT_START_FILTER.equals(intent.getAction())) {
        mFilter.initFromIntent(intent);
        Log.v(TAG, "handleIntent: launched with filter" + mFilter);
        Log.v(TAG, "handleIntent: saving filter in prefs");
        mFilter.saveInPrefs(TodoApplication.getPrefs());
    } else {
        // Set previous filters and sort
        Log.v(TAG, "handleIntent: from m_prefs state");
        mFilter.initFromPrefs(TodoApplication.getPrefs());
    }

    // Initialize Adapter
    if (m_adapter == null) {
        m_adapter = new TaskAdapter(getLayoutInflater());
    }
    m_adapter.setFilteredTasks();

    getListView().setAdapter(this.m_adapter);

    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    lv.setMultiChoiceModeListener(new ActionBarListener());
    lv.setClickable(true);
    lv.setOnItemClickListener(this);
    // If we were started with a selected task,
    // select it now and clear it from the intent
    String selectedTask = intent.getStringExtra(Constants.INTENT_SELECTED_TASK);
    if (!Strings.isEmptyOrNull(selectedTask)) {
        String[] parts = selectedTask.split(":", 2);
        setSelectedTask(Integer.valueOf(parts[0]), parts[1]);
        intent.removeExtra(Constants.INTENT_SELECTED_TASK);
        setIntent(intent);
    } else {
        // Set the adapter for the list view
        updateDrawers();
    }
    if (m_savedInstanceState != null) {
        ArrayList<String> selection = m_savedInstanceState.getStringArrayList("selection");
        int position = m_savedInstanceState.getInt("position");
        if (selection != null) {
            for (String selected : selection) {
                String[] parts = selected.split(":", 2);
                setSelectedTask(Integer.valueOf(parts[0]), parts[1]);
            }
        }
        lv.setSelectionFromTop(position, 0);
    }
}

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

private static void hackListViewSetPosition(final ListView listView, final int position, final int top) {
    try {//  w  ww.j av a  2 s .c om
        listView.setSelectionFromTop(position, top);
        AppearanceUtils.callWhenLoaded(listView, new Runnable() {
            @Override
            public void run() {
                try {
                    int setPosition = listView.getFirstVisiblePosition();
                    int setTop = listView.getChildAt(0).getTop();
                    int incTop = listView.getChildCount() < 2 ? 0
                            : Math.max(0, -listView.getChildAt(1).getTop());
                    if (setPosition != position || setTop != top || incTop > 0) {
                        listView.setSelectionFromTop(position, top + incTop);
                    }
                } catch (Exception e) {
                    Logger.e(TAG, e);
                }
            }
        });
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void scrollListToPosition(final AbsListView absListView, final int position, final int offset) {
    if (absListView == null)
        return;/*ww w .  ja  va 2  s  . c  om*/
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        if (absListView instanceof ListView) {
            final ListView listView = ((ListView) absListView);
            listView.setSelectionFromTop(position, offset);
        } else {
            absListView.setSelection(position);
        }
        stopListView(absListView);
    } else {
        stopListView(absListView);
        if (absListView instanceof ListView) {
            final ListView listView = ((ListView) absListView);
            listView.setSelectionFromTop(position, offset);
        } else {
            absListView.setSelection(position);
        }
    }
}

From source file:edu.cmu.cylab.starslinger.view.SlingerFragment.java

private void drawContactData(TextView textViewUserName, ListView listViewContactFields,
        ImageView imageViewPhoto) {
    // order: name, photo, phone, im, email, url, postal, title, org

    // make sure view is already inflated...
    if (listViewContactFields == null) {
        return;// ww w.  ja  va 2s . c  o  m
    }

    mContactFields = new ArrayList<ContactField>();
    ContactFieldAdapter mAdapter;

    // draw name
    if (mContact.name != null && !TextUtils.isEmpty(mContact.name.toString())) {
        textViewUserName.setText(mContact.name.toString());
    } else {
        textViewUserName.setText("");
    }

    // draw photo
    imageViewPhoto.setBackgroundColor(Color.TRANSPARENT);
    try {
        if (mContact.photoBytes != null) {
            Bitmap bm = BitmapFactory.decodeByteArray(mContact.photoBytes, 0, mContact.photoBytes.length, null);
            imageViewPhoto.setImageBitmap(bm);
            imageViewPhoto.setAdjustViewBounds(true);

            mContactFields.add(new ContactField( //
                    R.drawable.ic_ks_photo, //
                    getString(R.string.label_Photo), //
                    ""));
        } else {
            imageViewPhoto.setImageDrawable(getResources().getDrawable(R.drawable.ic_silhouette));
        }
    } catch (OutOfMemoryError e) {
        imageViewPhoto.setImageDrawable(null);
    }

    // draw from phones
    if (mContact.phoneList != null)
        for (PhoneData m : mContact.phoneList) {

            mContactFields.add(new ContactField( //
                    R.drawable.ic_ks_phone, //
                    getPhoneTypeLabel(m.type, m.label), //
                    m.data));
        }

    // draw from contact methods
    if (mContact.contactmethodList != null) {

        // ims
        for (ContactMethod i : mContact.contactmethodList) {
            switch (i.kind) {
            case Contacts.KIND_IM:

                boolean isCustom = (i.kind == Contacts.KIND_IM) && mAccessor.isCustomIm(i.label);
                String data = i.data;
                String typeDisplay = "";
                int iconid = 0;
                boolean forceCheck = false;

                if (isCustom) {
                    iconid = R.drawable.ic_ks_key;
                    data = i.label;
                    typeDisplay = "";
                    forceCheck = true;
                } else {
                    iconid = R.drawable.ic_ks_im;
                    typeDisplay = mAccessor.getDesc(i.kind, i.type, i.label);
                }

                mContactFields.add(new ContactField( //
                        iconid, //
                        typeDisplay, //
                        delimitedString(data), forceCheck));
                break;
            default:
                break;
            }
        }

        // emails
        for (ContactMethod e : mContact.contactmethodList) {
            switch (e.kind) {
            case Contacts.KIND_EMAIL:
                String data = e.data;
                String typeDisplay = "";
                int iconid = 0;
                boolean forceCheck = false;

                iconid = R.drawable.ic_ks_email;
                typeDisplay = getEmailTypeLabel(e.type, e.label);

                mContactFields.add(new ContactField( //
                        iconid, //
                        typeDisplay, //
                        delimitedString(data), forceCheck));
                break;
            default:
                break;
            }
        }

        // urls
        for (ContactMethod u : mContact.contactmethodList) {
            switch (u.kind) {
            case Contacts.KIND_URL:

                String data = u.data;
                String typeDisplay = "";
                int iconid = 0;
                boolean forceCheck = false;

                iconid = R.drawable.ic_ks_url;

                mContactFields.add(new ContactField( //
                        iconid, //
                        typeDisplay, //
                        delimitedString(data), forceCheck));
                break;
            default:
                break;
            }
        }
    }

    // draw from addresses
    if (mContact.addressList != null)
        for (Address m : mContact.addressList) {

            mContactFields.add(new ContactField( //
                    R.drawable.ic_ks_postal, //
                    getStructuredPostalTypeLabel(m.getType(), m.getLabel()), //
                    delimitedString(m.toString())));
        }

    mAdapter = new ContactFieldAdapter(getActivity(), mContactFields);
    listViewContactFields.setAdapter(mAdapter);

    // restore list position
    listViewContactFields.setSelectionFromTop(mListVisiblePos, mListTopOffset);
}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceActionProfile.java

private void restoreViewContents(final SavedViewContents sv) {
    final EditText dlg_prof_name_et = (EditText) mDialog.findViewById(R.id.edit_profile_action_profile_et_name);
    final CheckBox cb_active = (CheckBox) mDialog.findViewById(R.id.edit_profile_action_enabled);
    final CheckBox cb_enable_env_parms = (CheckBox) mDialog
            .findViewById(R.id.edit_profile_action_enable_env_parms);

    final TextView tv_sound_filename = (TextView) mDialog
            .findViewById(R.id.edit_profile_action_exec_sound_file_name);
    final CheckBox cb_music_vol = (CheckBox) mDialog
            .findViewById(R.id.edit_profile_action_profile_sound_use_volume);
    final SeekBar sb_music_vol = (SeekBar) mDialog.findViewById(R.id.edit_profile_action_profile_sound_volume);
    final CheckBox cb_ringtone_vol = (CheckBox) mDialog
            .findViewById(R.id.edit_profile_action_profile_ringtone_use_volume);
    final SeekBar sb_ringtone_vol = (SeekBar) mDialog
            .findViewById(R.id.edit_profile_action_profile_ringtone_volume);
    final Spinner spinnerActionType = (Spinner) mDialog.findViewById(R.id.edit_profile_action_action_type);
    final Spinner spinnerActivityName = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_exec_activity_name);
    final Spinner spinnerActivityDataType = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_exec_activity_data_type);
    final Spinner spinnerRingtoneType = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_exec_ringtone_type);
    final Spinner spinnerRingtoneName = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_exec_ringtone_name);
    final Spinner spinnerCompareType = (Spinner) mDialog.findViewById(R.id.edit_profile_action_compare_type);
    final EditText et_comp_value1 = (EditText) mDialog.findViewById(R.id.edit_profile_action_compare_value1);
    final EditText et_comp_value2 = (EditText) mDialog.findViewById(R.id.edit_profile_action_compare_value2);
    final ListView lv_comp_data = (ListView) mDialog
            .findViewById(R.id.edit_profile_action_compare_value_listview);
    final Spinner spinnerCompareResult = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_compare_result);
    final Spinner spinnerCompareTarget = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_compare_target);
    final Spinner spinnerMessageType = (Spinner) mDialog.findViewById(R.id.edit_profile_action_message_type);
    final EditText et_msg_text = (EditText) mDialog.findViewById(R.id.edit_profile_action_message_message);
    final CheckBox cb_vib_used = (CheckBox) mDialog.findViewById(R.id.edit_profile_action_message_vibration);
    final CheckBox cb_led_used = (CheckBox) mDialog.findViewById(R.id.edit_profile_action_message_led);
    final RadioButton rb_msg_blue = (RadioButton) mDialog
            .findViewById(R.id.edit_profile_action_message_led_blue);
    final RadioButton rb_msg_red = (RadioButton) mDialog.findViewById(R.id.edit_profile_action_message_led_red);
    final RadioButton rb_msg_green = (RadioButton) mDialog
            .findViewById(R.id.edit_profile_action_message_led_green);
    final Spinner spinnerTimeType = (Spinner) mDialog.findViewById(R.id.edit_profile_action_time_type);
    final Spinner spinnerTimeTarget = (Spinner) mDialog.findViewById(R.id.edit_profile_action_time_target);
    final Spinner spinnerTaskType = (Spinner) mDialog.findViewById(R.id.edit_profile_action_task_type);
    final Spinner spinnerTaskTarget = (Spinner) mDialog.findViewById(R.id.edit_profile_action_task_target);
    final Spinner spinnerWaitTarget = (Spinner) mDialog.findViewById(R.id.edit_profile_action_wait_target);
    final Spinner spinnerWaitTimeoutType = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_wait_timeout);
    final Spinner spinnerWaitTimeoutValue = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_wait_timeout_value);
    final Spinner spinnerWaitTimeoutUnits = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_wait_timeout_units);
    final EditText et_bsh_script = (EditText) mDialog
            .findViewById(R.id.edit_profile_action_dlg_bsh_script_text);
    final Spinner spinnerBshMethod = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_dlg_bsh_add_method);
    final Spinner spinnerCatMethod = (Spinner) mDialog
            .findViewById(R.id.edit_profile_action_dlg_bsh_cat_method);

    final EditText uri_data = (EditText) mDialog.findViewById(R.id.edit_profile_action_exec_activity_uri_data);
    final ListView lv_aed = (ListView) mDialog
            .findViewById(R.id.edit_profile_action_exec_activity_extra_data_listview);

    dlg_prof_name_et.setText(sv.dlg_prof_name_et);
    dlg_prof_name_et.setSelection(sv.dlg_prof_name_et_spos, sv.dlg_prof_name_et_epos);
    cb_active.setChecked(sv.cb_active);/*w w w.ja v a  2 s.  c o m*/
    tv_sound_filename.setText(sv.tv_sound_filename);
    cb_music_vol.setChecked(sv.cb_music_vol);
    sb_music_vol.setProgress(sv.sb_music_vol);
    cb_ringtone_vol.setChecked(sv.cb_ringtone_vol);
    sb_ringtone_vol.setProgress(sv.sb_ringtone_vol);
    et_comp_value1.setText(sv.et_comp_value1);
    et_comp_value2.setText(sv.et_comp_value2);
    lv_comp_data.setSelectionFromTop(sv.lv_comp_data[0], sv.lv_comp_data[1]);
    et_msg_text.setText(sv.et_msg_text);
    cb_vib_used.setChecked(sv.cb_vib_used);
    cb_led_used.setChecked(sv.cb_led_used);
    if (sv.rb_msg_blue)
        rb_msg_blue.setChecked(sv.rb_msg_blue);
    if (sv.rb_msg_red)
        rb_msg_red.setChecked(sv.rb_msg_red);
    if (sv.rb_msg_green)
        rb_msg_green.setChecked(sv.rb_msg_green);
    et_bsh_script.setText(sv.et_bsh_script);
    uri_data.setText(sv.uri_data);
    lv_aed.setSelectionFromTop(sv.lv_aed[0], sv.lv_aed[1]);
    cb_enable_env_parms.setChecked(sv.cb_enable_env_parms);

    for (int i = 0; i < mGlblParms.activityExtraDataEditListAdapter.getCount(); i++)
        mGlblParms.activityExtraDataEditListAdapter.remove(0);
    for (int i = 0; i < sv.aed_adapter_list.size(); i++)
        mGlblParms.activityExtraDataEditListAdapter.add(sv.aed_adapter_list.get(i));
    mGlblParms.activityExtraDataEditListAdapter.notifyDataSetChanged();

    for (int i = 0; i < mGlblParms.actionCompareDataAdapter.getCount(); i++)
        mGlblParms.actionCompareDataAdapter.remove(0);
    for (int i = 0; i < sv.data_array_adapter_list.size(); i++)
        mGlblParms.actionCompareDataAdapter.add(sv.data_array_adapter_list.get(i));
    mGlblParms.actionCompareDataAdapter.notifyDataSetChanged();

    spinnerActionType.setSelection(sv.spinnerActionType);
    spinnerActivityName.setSelection(sv.spinnerActivityName);
    spinnerActivityDataType.setSelection(sv.spinnerActivityDataType);
    spinnerRingtoneType.setSelection(sv.spinnerRingtoneType);
    spinnerRingtoneName.setSelection(sv.spinnerRingtoneName);
    spinnerCompareType.setSelection(sv.spinnerCompareType);
    spinnerCompareResult.setSelection(sv.spinnerCompareResult);
    spinnerCompareTarget.setSelection(sv.spinnerCompareTarget);
    spinnerMessageType.setSelection(sv.spinnerMessageType);
    spinnerTimeType.setSelection(sv.spinnerTimeType);
    spinnerTimeTarget.setSelection(sv.spinnerTimeTarget);
    spinnerTaskType.setSelection(sv.spinnerTaskType);
    spinnerTaskTarget.setSelection(sv.spinnerTaskTarget);
    spinnerWaitTarget.setSelection(sv.spinnerWaitTarget);
    spinnerWaitTimeoutType.setSelection(sv.spinnerWaitTimeoutType);
    spinnerWaitTimeoutValue.setSelection(sv.spinnerWaitTimeoutValue);
    spinnerWaitTimeoutUnits.setSelection(sv.spinnerWaitTimeoutUnits);
    spinnerBshMethod.setSelection(sv.spinnerBshMethod);
    spinnerCatMethod.setSelection(sv.spinnerCatMethod);

    //       Handler hndl1=new Handler();
    //       hndl1.postDelayed(new Runnable(){
    //         @Override
    //         public void run() {
    //
    //            Handler hndl2=new Handler();
    //             hndl2.postDelayed(new Runnable(){
    //               @Override
    //               public void run() {
    //               }
    //             },50);
    //         }
    //       },50);
}