Tag Archives: web app

Android’s viewpager slides to determine whether the current stop page is the last page

Step 1: write several global variables to record:

   /**
     * Record if the sliding page is the last page
     */
    private boolean isHomeLastPage = false;
    private boolean isHomeDragPage = false;

The second step is to get the last element by implementing the listening onpageselected() in VP

@Override
	     public void onPageSelected(int position) {
	            super.onPageSelected(position);
	
	            Log.e("videoPositionposition", position + "");
	            //get the last page/position equals the last element
	            isHomeLastPage = position == datas.size() - 1;
	      }

The third step is to implement the listening onpagescrollstatechanged() in VP to determine whether the current sliding state is in,

   @Override
            public void onPageScrollStateChanged(int state) {
                // 0: do nothing 1: start sliding 2: end sliding Scrolling listener
                isHomeDragPage = state == ViewPager2.SCROLL_STATE_DRAGGING;
                //judge that the last one will not be loaded
            }

The fourth step is to implement onpagescrolled() 1.
1. Judge whether it is the last element
2. Whether it is in sliding state,
3. The offset of posionoffsetpixels is 0.
the work is done, and the judgment of VP sliding to the last page has been done

 @Override
 public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

       //Determine the last element and slide state, and the offset is 0
       Log.e("vp2CCC", "vp2CCC" + isHomeLastPage + " " + isHomeDragPage + " " + positionOffsetPixels);
       if (isHomeLastPage && isHomeDragPage && positionOffsetPixels == 0) { //the current page is the last page and is dragging and the pixel offset is 0
           Toast.makeText(getActivity(), "The current page is the last page", Toast.LENGTH_SHORT).show();
       } else {
       }
   }

It is invalid to submit the content directly after pasting it on the mobile terminal of Vue HTML5 editor

Modify the source code vue-html5-editor.js
Directory:

open this file, search for contenteditable, add id = “container”

and then search for Keyup
comment code

 // content.addEventListener('keyup', function () {
 //     this$1.$emit('change', content.innerHTML);
 //     this$1.saveCurrentRange();
 // }, false);

Add code

const handleListenChange = (mutationsList, observer) => {
 this$1.$emit('change', content.innerHTML);
 this$1.saveCurrentRange();
}
const mutationObserver = new MutationObserver(handleListenChange)
const element = document.querySelector('#container')
const options = {
 attributes: true,
 childList: true,
 subtree: true,
 characterData: true
}

It’s like this on the whole

I’ve looked at others and modified it myself. This question is more detailed than that of the blogger. Link to attach. If you have any other questions, take a look
CSDN of Dashen

[Vue Run Error] Module build failed: Error: Couldn‘t resolve parser “babylon“

This is because the parser names of different versions of prettier are not the same, so it cannot be parsed. You just need to   node_ Modules in Vue loader   The parser in the prettier configuration file can be changed from Babylon to Babel.

Step 12345 as shown in the figure below