Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Android to realize the effect of pull-up and suction

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

< 5) { alpha = 0; } LogUtil2.log("滑动高度--off" + y + "--" + height + "--"); if (y height && y < height * 1.5) { rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); tv_title.setTextColor(mContext.getResources().getColor(R.color.text_000000)); ll_search.setBackground(mContext.getResources().getDrawable(R.drawable.shape_search_product)); iv_msg.setBackground(mContext.getResources().getDrawable(R.mipmap.home_message_black)); rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); rl_top.setBackgroundColor(Color.argb((int) 127, 255, 255, 255)); StatusBarUtil.setStatusBarDarkTheme(getActivity(), true); } else if (y >

Height * 1.5) {rl_top.setBackgroundColor (mContext.getResources () .getColor (R.color.white)); tv_title.setTextColor (mContext.getResources () .getColor (R.color.text_000000)); ll_search.setBackground (mContext.getResources () .getDrawable (R.drawable.shape_search_product)) Iv_msg.setBackground (mContext.getResources (). GetDrawable (R.mipmap.home_message_black)); rl_top.setBackgroundColor (Color.argb ((int) 255,255,255,255); StatusBarUtil.setStatusBarDarkTheme (getActivity (), true);}) MXrvProduct.addOnScrollListener (new RecyclerView.OnScrollListener () {@ Override public void onScrolled (@ NonNull RecyclerView recyclerView, int dx, int dy) {super.onScrolled (recyclerView, dx, dy); LinearLayoutManager manager = (LinearLayoutManager) recyclerView.getLayoutManager (); / / get the index int firstVisibleItemPosition = manager.findFirstVisibleItemPosition () for the currently visible entry Int lastVisibleItemPosition = manager.findLastCompletelyVisibleItemPosition (); / / get the itemView View firstView = manager.findViewByPosition (firstVisibleItemPosition) of the currently visible item; / / get the height of the itemView of the currently visible item height = firstView.getHeight () / / get the offset of the current visible item y = (firstVisibleItemPosition) * height-firstView.getTop (); int alpha = 255y / (height); if (alpha > 255) {alpha = 255;} if (alpha)

< 5) { alpha = 0; } float scale = (float) dy / height; float alphat = (255 * scale); LogUtil2.log("滑动高度--" + y + "--" + height + "--"); if (y == height) { tv_title.setTextColor(mContext.getResources().getColor(R.color.white)); ll_search.setBackground(mContext.getResources().getDrawable(R.drawable.yuanjiao24whire)); iv_msg.setBackground(mContext.getResources().getDrawable(R.mipmap.home_message_white)); rl_top.setBackgroundColor(Color.argb((int) 0, 255, 255, 255));//AGB由相关工具获得,或者美工提供 StatusBarUtil.setStatusBarDarkTheme(getActivity(), false); } else if (y >

Height & & y

< height * 1.5) { rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); tv_title.setTextColor(mContext.getResources().getColor(R.color.text_000000)); ll_search.setBackground(mContext.getResources().getDrawable(R.drawable.shape_search_product)); iv_msg.setBackground(mContext.getResources().getDrawable(R.mipmap.home_message_black)); rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); rl_top.setBackgroundColor(Color.argb((int) 127, 255, 255, 255)); StatusBarUtil.setStatusBarDarkTheme(getActivity(), true); } else if (y >

Height * 1.5) {rl_top.setBackgroundColor (mContext.getResources () .getColor (R.color.white)); tv_title.setTextColor (mContext.getResources () .getColor (R.color.text_000000)); ll_search.setBackground (mContext.getResources () .getDrawable (R.drawable.shape_search_product)) Iv_msg.setBackground (mContext.getResources (). GetDrawable (R.mipmap.home_message_black)); rl_top.setBackgroundColor (Color.argb ((int) 255,255,255,255); StatusBarUtil.setStatusBarDarkTheme (getActivity (), true);}) } public void setpopLoad () {try {localVersionLoad = Utils.getVersionName (mContext);} catch (Exception e) {e.printStackTrace ();} key = "show_home_load" + localVersion; LogUtil2.log ("= > key" + key); LogUtil2.log ("= > AccountUtils.getVersioncode ()" + AccountUtils.getVersioncode ()) / / is it the first time if (! AccountUtils.getVersioncodeHomeLoad (). Equals (key)) {AccountUtils.putVersioncodeHomeLoad (key); dialog = new CustomDialog (mContext, R.layout.pop_home_load, R.style.CustomDialogTheme); dialog.setCancelable (false); dialog.setCanceledOnTouchOutside (false) ImageView iv_one_button = (ImageView) dialog.findViewById (R.id.iv_one_button); iv_one_button.setOnClickListener (new View.OnClickListener () {@ Override public void onClick (View v) {/ / TODO Auto-generated method stub dialog.dismiss ();}}) Dialog.show ();}} private void changeStatusBarTextColor (boolean isBlack) {if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {if (isBlack) {getActivity (). GetWindow (). GetDecorView (). SetSystemUiVisibility (View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) / / set the status bar black font} else {getActivity () .getWindow () .getDecorView () .setSystemUiVisibility (View.SYSTEM_UI_FLAG_VISIBLE); / / restore the status bar white font} / * to determine whether it is a full screen * / private volatile static boolean mHasCheckAllScreen; private volatile static boolean mIsAllScreenDevice Public static boolean isAllScreenDevice (Context context) {if (mHasCheckAllScreen) {return mIsAllScreenDevice;} mHasCheckAllScreen = true; mIsAllScreenDevice = false; / / anything lower than API 21 will not have a full screen. If (Build.VERSION.SDK_INT

< Build.VERSION_CODES.LOLLIPOP) { return false; } WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) { Display display = windowManager.getDefaultDisplay(); Point point = new Point(); display.getRealSize(point); float width, height; if (point.x < point.y) { width = point.x; height = point.y; } else { width = point.y; height = point.x; } if (height / width >

= 1.97f) {mIsAllScreenDevice = true;}} return mIsAllScreenDevice;} private int dip2px (Context context, float dipValue) {Resources r = context.getResources (); return (int) TypedValue.applyDimension (TypedValue.COMPLEX_UNIT_DIP, dipValue, r.getDisplayMetrics ()) } / / determine whether Activity is Destroy public static boolean isDestroy (Activity activity) {if (activity = = null | | activity.isFinishing () | | (Build.VERSION.SDK_INT > = Build.VERSION_CODES.JELLY_BEAN_MR1 & & activity.isDestroyed () {return true;} else {return false }} private void initListeners () {mXrvProduct.addOnScrollListener (new RecyclerView.OnScrollListener () {@ Override public void onScrollStateChanged (RecyclerView recyclerView, int newState) {super.onScrollStateChanged (recyclerView, newState); switch (newState) {case 0: LogUtil2.log ("recyclerview has stopped scrolling") If (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong2) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact) New Handler () .postDelayed (new Runnable () {@ Override public void run () {Glide.with (getActivity ()) .load (R.mipmap.jingzhi) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact)) }, 1500); / / Glide.with (getActivity ()) .load (R.mipmap.jingzhi). AsGif (). DiskCacheStrategy (DiskCacheStrategy.SOURCE) .into (iv_contact); break Case 1: LogUtil2.log ("recyclerview is being dragged"); if (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact) } break; case 2: LogUtil2.log ("recyclerview is rolling on inertia") If (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact);} break } @ Override public void onScrolled (RecyclerView recyclerView, int dx, int dy) {super.onScrolled (recyclerView, dx, dy);}});} @ Override public void initData () {super.initData ();} @ Override public void onResume () {super.onResume () } / * the full name of IMEI is International Mobile Equipment Identity, which is translated into international mobile equipment identification code in Chinese. The so-called mobile phone serial number, which is used to identify each independent mobile phone in the mobile phone network, is an internationally recognized mobile phone serial number, which is equivalent to the ID card of the mobile phone. The serial number has a total of 15 digits. Bit (TAC) is the model approval number? * represents the type of mobile phone. Pick up? Bit (FAC) is the "?" assembly number, which represents the origin. The last 6 digits (SNR) are serial numbers, which represent the production sequence number. The most awkward? The SP is generally 0, which is the "?" code. * the international mobile equipment identification code is generally affixed to the back of the body and the outer package, and it also exists in the mobile phone memory. You can query the mobile phone by typing * * @ param * @ return * / @ Override public void onHiddenChanged (boolean hidden) {super.onHiddenChanged (hidden). If (! hidden) {hidden2 = hidden; LogUtil2.log ("= = > onHiddenChangedHome" + hidden); loopLayout.stopLoop (); / / stop loopLayout.startLoop (); StatusBarUtil.setTranslucentStatus (getActivity ()); if (y height & & y) when the page is destroyed

< height * 1.5) { rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); tv_title.setTextColor(mContext.getResources().getColor(R.color.text_000000)); ll_search.setBackground(mContext.getResources().getDrawable(R.drawable.shape_search_product)); iv_msg.setBackground(mContext.getResources().getDrawable(R.mipmap.home_message_black)); rl_top.setBackgroundColor(mContext.getResources().getColor(R.color.white)); rl_top.setBackgroundColor(Color.argb((int) 127, 255, 255, 255));// changeStatusBarTextColor(false);// BarUtils.setColorNoTranslucent(getActivity(), getResources().getColor(R.color.transparent));// BarUtils.setRootViewFitsSystemWindows(getActivity(), false); StatusBarUtil.setStatusBarDarkTheme(getActivity(), true); } else if (y >

Height * 1.5) {rl_top.setBackgroundColor (mContext.getResources () .getColor (R.color.white)); tv_title.setTextColor (mContext.getResources () .getColor (R.color.text_000000)); ll_search.setBackground (mContext.getResources () .getDrawable (R.drawable.shape_search_product)) Iv_msg.setBackground (mContext.getResources (). GetDrawable (R.mipmap.home_message_black)); rl_top.setBackgroundColor (Color.argb ((int) 255,255,255,255)); / / changeStatusBarTextColor (true); / / BarUtils.setColorNoTranslucent (getActivity (), getResources () .getColor (R.color.transparent)) / / BarUtils.setRootViewFitsSystemWindows (getActivity (), false); StatusBarUtil.setStatusBarDarkTheme (getActivity (), true);}} else {hidden2 = hidden; LogUtil2.log ("= = > onHiddenChanged" + hidden); loopLayout.stopLoop (); / / mHomeAdapter.setIsStop (true) is required when the page is destroyed } @ Override public void onRequestPermissionsResult (int requestCode, String permissions [], int [] grantResults) {if (requestCode = = 1000) {if ((grantResults.length > 0) & & (grantResults [0] = = PackageManager.PERMISSION_GRANTED)) {UserBean query = UserBeanDao.query ();} else {Toast.makeText (mContext, "Mobile IMEI permission is not enabled!" , Toast.LENGTH_LONG) .show ();}} public boolean checkIme () {int permissionCheck = ContextCompat.checkSelfPermission (mContext, Manifest.permission.READ_PHONE_STATE); if (permissionCheck! = PackageManager.PERMISSION_GRANTED) {ActivityCompat.requestPermissions ((Activity) mContext, new String [] {Manifest.permission.READ_PHONE_STATE}, 1000); return false } else {/ / TODO return true;}} @ Override protected void initListener () {super.initListener (); iv_back_top.setOnClickListener (new View.OnClickListener () {@ Override public void onClick (View v) {appbar.setExpanded (true, false) Iv_back_top.setVisibility (View.GONE); EventManager.post (new RefreshHomeArticleEvent ());}}); ll_search.setOnClickListener (new View.OnClickListener () {@ Override public void onClick (View view) {if (! isLogin ()) {UIHelper.showLogin (mContext)) Return;} UIHelper.showProductSearch (mContext);} @ Override protected void onSuccess (String response, int id) {super.onSuccess (response, id); switch (id) {case 100: LogUtil2.log ("= > 100" + response.toString ()) MXrvProduct.refreshComplete (); / / refreshLayout.finishRefresh (2000); / / input false indicates refresh failed HomeBean homeBean = GsonUtils.toObject (response, HomeBean.class); mHomePagePlatAdList = homeBean.homePagePlatAdList; if (null! = mHomePagePlatAdList & &! mHomePagePlatAdList.isEmpty ()) {setBannerLoop (mHomePagePlatAdList) } break; case 600 LogUtil2.log / selected products setRecommendData (response); break; case 700: LogUtil2.log ("= > > 700" + response.toString ()); setHomeBeanADV (response); break Case 800 setRecommendDatas / reminder Center setHomeBeanRemind (response); break; case 601 / Cloud College recommended window list setRecommendDatas (response); setRecommendDatas: RecommendListBean recommendListBean = GsonUtils.toObject (response, RecommendListBean.class) If (recommendListBean.recommendList! = null) {if (recommendListBean.recommendList.size () > 0) {tv_search.setText (recommendListBean.recommendList.get (0));}} break Case 604 response / scroll headline LogUtil2.log ("Home article-Scroll bar" + response.toString ()); setHomeAdviance (response); break; case 605 setHomeAdviance hand / article title LogUtil2.log ("Home article-article title" + response.toString ()) Ll_tab.setVisibility (View.VISIBLE); setHomeArticle (response); break;}} private void setHomeArticle (String response) {if (TextUtils.isEmpty (response)) {return;} final FindClassifysBean bean = GsonUtils.toObject (response, FindClassifysBean.class) If {if (! isFirstTab) {if (articleClassifyList! = null & & bean.articleClassifyList.size () = = articleClassifyList.size ()) {for (int I = 0; I)

< bean.articleClassifyList.size(); i++) { for (int j = 0; j < articleClassifyList.size(); j++) { if (bean.articleClassifyList.get(i).uuid.equals(articleClassifyList.get(j).uuid)) { isSame = false; } } } } } LogUtil2.log("第一次加载--"+isSame+"---"+isFirstTab+"--"+isRemind+"---"+isHoutai); if (isRemind) { isRemind=false; if (!isSame) { isSame = true; return; } }else { appbar.setExpanded(true, false); iv_back_top.setVisibility(View.GONE); } } isFirstTab=false; articleClassifyList = bean.articleClassifyList; // mHomeAdapter.setHomeArticle(bean); if (bean.articleClassifyList != null && bean.articleClassifyList.size() >

0) {mFragments.clear (); mTitles.clear (); for (int I = 0; I

< bean.articleClassifyList.size(); i++) { ArticleClassifyListBean bean2 = bean.articleClassifyList.get(i); mTitles.add(bean2.name); Bundle b = new Bundle(); b.putSerializable("bean", bean.articleClassifyList.get(i)); b.putInt("positionClick", i); b.putSerializable("company",companyBaseBean); Fragment f = new ArticleHomeFragment()/*ArticleHomeFragment()*/; f.setArguments(b); mFragments.add(f); } if (getActivity() != null) { viewpager.setAdapter(mAdapter); tl_9.setViewPager(viewpager,mTitles); tl_9.setCurrentTab(0); viewpager.setCurrentItem(0); setTab(); if (!isFirstLay){ LogUtil2.log("刷新--"); mAdapter.setNewFragments(); } isFirstLay = false; } } } @Override public void onPause() { super.onPause(); Log.i("滚动高度--onPause", "展开"); } @Override public void onStop() { super.onStop(); Log.i("滚动高度--onStop", "展开"); if (isRemind){ isOther=true; } if (appbarState == 1) { Log.i("滚动高度--", "展开"); //展开状态 } else if (appbarState == 2) { Log.i("滚动高度--", "折叠"); //折叠状态 } else if (appbarState ==3){ Log.i("滚动高度--", "中间"); //中间状态 } } public void setTab() { tl_9.setTextUnselectColor(getResources().getColor(R.color.text_000000)); tl_9.setTextSelectColor(getResources().getColor(R.color.white)); tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_1A75FF)); tl_9.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelect(int position) { if (position % 9 == 0) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_1A75FF));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_1A75FF)); } else if (position % 9 == 1) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_F05F12));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_F05F12)); } else if (position % 9 == 2) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_DD8033));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_DD8033)); } else if (position % 9 == 3) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_14BEDF));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_14BEDF)); } else if (position % 9 == 4) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_2B2EF5));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_2B2EF5)); } else if (position % 9 == 5) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_EEB01F));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_EEB01F)); } else if (position % 9 == 6) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_E92A4B));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_E92A4B)); } else if (position % 9 == 7) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_00C99E));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_00C99E)); } else if (position % 9 == 8) { tl_9.setIndicatorColor(mContext.getResources().getColor(R.color.name_299BF5));// tab_head.setIndicatorColor(mContext.getResources().getColor(R.color.name_299BF5)); } } @Override public void onTabReselect(int position) { } }); viewpager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i1) { } @Override public void onPageSelected(int position) {// tab_head.setCurrentTab(position);// if (!isFirstLay){ if (mFragments != null && mFragments.size() >

0 & & articleClassifyList! = null & & articleClassifyList.size () > 0) {ArticleHomeFragment fragment = (ArticleHomeFragment) mFragments.get (position); fragment.setRefresh (position, articleClassifyList.get (position)) } / /} / / if (position% 9 = = 0) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_1A75FF)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_1A75FF)) } else if (position% 9 = = 1) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_F05F12)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_F05F12)) } else if (position% 9 = = 2) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_DD8033)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_DD8033)) } else if (position% 9 = = 3) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_14BEDF)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_14BEDF)) } else if (position% 9 = = 4) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_2B2EF5)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_2B2EF5)) } else if (position% 9 = = 5) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_EEB01F)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_EEB01F)) } else if (position% 9 = = 6) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_E92A4B)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_E92A4B)) } else if (position% 9 = = 7) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_00C99E)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_00C99E)) } else if (position% 9 = = 8) {tl_9.setIndicatorColor (mContext.getResources () .getColor (R.color.name_299BF5)); / / tab_head.setIndicatorColor (mContext.getResources () .getColor (R.color.name_299BF5)) } @ Override public void onPageScrollStateChanged (int I) {}});} @ Override public void onClickArticle (boolean isremind) {LogUtil2.log ("isRemind----" + isremind); isRemind=isremind;} private class MyPagerAdapter extends FragmentPagerAdapter {private List tags;// marks the tag private FragmentManager fragmentManager of fragment Public MyPagerAdapter (FragmentManager fm) {super (fm); this.tags = new ArrayList (); this.fragmentManager = fm;} / / public MyPagerAdapter (FragmentManager fm) {/ / super (fm); / /} @ Override public int getCount () {return mFragments.size () } @ Override public CharSequence getPageTitle (int position) {return mTitles.get (position);} @ Override public Fragment getItem (int position) {return mFragments.get (position);} @ Override public int getItemPosition (@ NonNull Object object) {return POSITION_NONE } / / forget about private String makeFragmentName (int viewId, long id) {return "android:switcher:" + viewId + ":" + id;} @ NonNull @ Override public Object instantiateItem (@ NonNull ViewGroup container, int position) {tags.add (container.getId (), getItemId (position) Fragment fragment = (Fragment) super.instantiateItem (container, position); this.fragmentManager.beginTransaction (). Show (fragment). CommitAllowingStateLoss (); return fragment;} / / find cached fragment according to tag, remove cached fragment and replace it with new public void setNewFragments () {if (this.tags! = null) {FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction () For (int I = 0; I

< tags.size(); i++) { fragmentTransaction.remove(fragmentManager.findFragmentByTag(tags.get(i))); } fragmentTransaction.commitAllowingStateLoss(); fragmentManager.executePendingTransactions(); tags.clear(); } notifyDataSetChanged(); } } private void setBannerLoop(List mHomePagePlatAdList) { // 准备数据 ArrayList bannerInfos = new ArrayList(); List bgList = new ArrayList(); for (int i = 0; i < mHomePagePlatAdList.size(); i++) { bannerInfos.add(new BannerInfo(mHomePagePlatAdList.get(i).imageUrl, mHomePagePlatAdList.get(i).url)); bgList.add(mHomePagePlatAdList.get(i).imageColour); } if (bannerInfos.size() == 0) { return; } if (bgList.size() == 0) { return; } loopLayout.setLoopData(bannerInfos);// 设置轮播数据 if (bgList != null && mContext != null) { container.setBannerBackBg(mContext, bgList);// 背景容器设置轮播图片 } loopLayout.setBannerBgContainer(container); loopLayout.stopLoop(); loopLayout.startLoop(); } private void setRecommendDatas(String response) { if (TextUtils.isEmpty(response)) { return; } FaXianListsBean bean = GsonUtils.toObject(response, FaXianListsBean.class);// KeChengRecommendsBean recommendsBean=bean.courseRecommends.get(0); mHomeAdapter.setHomeKeCheng(bean); } public static List getObjectList(String jsonString, Class cls) { List list = new ArrayList(); try { Gson gson = new Gson(); JsonArray arry = new JsonParser().parse(jsonString).getAsJsonArray(); for (JsonElement jsonElement : arry) { list.add(gson.fromJson(jsonElement, cls)); } } catch (Exception e) { e.printStackTrace(); } return list; } private void setRecommendData(String response) { if (TextUtils.isEmpty(response)) { return; } HomeProductBean homeProductBean = GsonUtils.toObject(response, HomeProductBean.class);// List homeBean =/*GsonUtils.toList*/getObjectList(response, HomeBottomProductBean.class); mHomeAdapter.setHomeBean(homeProductBean); } private void setHomeBeanADV(String response) { HomeBean homeBean2 = GsonUtils.toObject(response, HomeBean.class); mHomeAdapter.setHomeBeanADV(homeBean2); } private void setHomeBeanRemind(String response) { if (TextUtils.isEmpty(response)) { return; } final KaoShiStatussBean bean = GsonUtils.toObject(response, KaoShiStatussBean.class); mHomeAdapter.setHomeRemind(bean); } private void setHomeAdviance(String response) { if (TextUtils.isEmpty(response)) { return; } final HeadHomeBean bean = GsonUtils.toObject(response, HeadHomeBean.class); mHomeAdapter.setHomeAdviance(bean); } @Override public void onTabReselect() { LogUtil.e(LogUtil.CQ, "onTabReselect HomeFragment"); } /** * 生成一个0 到 count 之间的随机数 * * @param endNum * @return */ public int getNum(int endNum) { if (endNum >

0) {Random random = new Random (); return random.nextInt (endNum);} return 0;} / * * banner Click event * * @ param position position * / @ Override public void onItemClick (int position) {} @ Override public void onDestroy () {super.onDestroy (); EventManager.unregister (this) LoopLayout.stopLoop (); / / stop mHomeAdapter.setIsStop (true) when the page is destroyed; if (iv_contact! = null & &! getActivity (). IsDestroyed ()) {Glide.with (getContext ()) .clear (iv_contact); iv_contact = null;}} @ Override public void onDestroyView () {super.onDestroyView () } public static SetOnclickInterface listenersTOP @ Override public void onRefresh () {} @ Override public void onLoadMore () {} / * banner rolling carousel * * @ param position * @ param banner * / @ Override public void onBannerClick (int position, ArrayList banner) {} @ Override public void onChildScroll (RecyclerView recyclerView) Int newState) {switch (newState) {case 0: LogUtil2.log ("recyclerview has stopped scrolling") If (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong2) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact) New Handler () .postDelayed (new Runnable () {@ Override public void run () {Glide.with (getActivity ()) .load (R.mipmap.jingzhi) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact)) }, 1500);} break; case 1: LogUtil2.log ("recyclerview is being dragged") If (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact);} break; case 2: LogUtil2.log ("recyclerview is rolling by inertia") If (getActivity ()! = null) {Glide.with (getActivity ()) .load (R.mipmap.huadong) / * .asGif () .diskCacheStrategy (DiskCacheStrategy.SOURCE) * / .into (iv_contact);} break;} Thank you for reading! This is the end of this article on "how to use Android to achieve pull-up effect". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report