日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

一款使用RxJava+Retrofit+MVP的快播App开源啦!

發布時間:2024/8/1 java 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一款使用RxJava+Retrofit+MVP的快播App开源啦! 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

《快播》,仿網易云音樂UI,整體采用RxJava+Retrofit+MVP的架構,支持在線視頻播放,在線圖片瀏覽等功能。

用到第三方開源庫:

  • ButterKnife:依賴注入框架

  • glide:圖片加載

  • retrofit:網絡請求

  • jieCaoVideoPlayer:播放器

抓取接口用于數據展示

效果圖如下:

基類:

package?com.zmj.qvod.base;import?android.content.Context; import?android.content.Intent; import?android.content.pm.ActivityInfo; import?android.os.Build; import?android.os.Bundle; import?android.support.v7.app.AppCompatActivity; import?android.util.Log; import?android.view.LayoutInflater; import?android.view.View; import?android.view.Window; import?android.view.WindowManager; import?android.widget.Toast;public?abstract?class?BaseActivity?extends?AppCompatActivity?{/***?是否沉浸狀態欄**/private?boolean?isSetStatusBar?=?false;/***?是否允許全屏**/private?boolean?mAllowFullScreen?=?false;/***?是否允許屏幕旋轉**/private?boolean?isAllowScreenRotate?=?false;/***?當前Activity渲染的視圖View**/private?View?mContextView?=?null;/***?日志輸出標志**/protected?final?String?TAG?=?this.getClass().getSimpleName();@Overrideprotected?void?onCreate(Bundle?savedInstanceState)?{super.onCreate(savedInstanceState);Log.d(TAG,?"BaseActivity-->onCreate()");Bundle?bundle?=?getIntent().getExtras();initPrams(bundle);//mContextView?=?LayoutInflater.from(this).inflate(bindLayout(),?null);//if?(mAllowFullScreen)?{requestWindowFeature(Window.FEATURE_NO_TITLE);}//if?(isSetStatusBar)?{steepStatusBar();}//setContentView(bindLayout());//if?(!isAllowScreenRotate)?{setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);}//initView(mContextView);//setListener();//doBusiness(this);}/***?[沉浸狀態欄]*/private?void?steepStatusBar()?{if?(Build.VERSION.SDK_INT?>=?Build.VERSION_CODES.KITKAT)?{//?透明狀態欄getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);//?透明導航欄getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);}}/***?[初始化參數--加載xml視圖之前]**?@param?bundle*/public?abstract?void?initPrams(Bundle?bundle);/***?[綁定布局]**?@return*/public?abstract?int?bindLayout();/***?[初始化控件]**?@param?view*/public?abstract?void?initView(final?View?view);/***?[綁定控件]**?@param?resId*?@return*/protected?<T?extends?View>?T?$(int?resId)?{return?(T)?super.findViewById(resId);}/***?[設置監聽]*/public?abstract?void?setListener();/***?[業務操作]**?@param?mContext*/public?abstract?void?doBusiness(Context?mContext);/***?[頁面跳轉]**?@param?clz*/public?void?startActivity(Class<?>?clz)?{startActivity(new?Intent(BaseActivity.this,?clz));}/***?[攜帶數據的頁面跳轉]**?@param?clz*?@param?bundle*/public?void?startActivity(Class<?>?clz,?Bundle?bundle)?{Intent?intent?=?new?Intent();intent.setClass(this,?clz);if?(bundle?!=?null)?{intent.putExtras(bundle);}startActivity(intent);}/***?[含有Bundle通過Class打開編輯界面]**?@param?cls*?@param?bundle*?@param?requestCode*/public?void?startActivityForResult(Class<?>?cls,?Bundle?bundle,int?requestCode)?{Intent?intent?=?new?Intent();intent.setClass(this,?cls);if?(bundle?!=?null)?{intent.putExtras(bundle);}startActivityForResult(intent,?requestCode);}@Overrideprotected?void?onRestart()?{super.onRestart();Log.d(TAG,?"onRestart()");}@Overrideprotected?void?onStart()?{super.onStart();Log.d(TAG,?"onStart()");}@Overrideprotected?void?onResume()?{super.onResume();Log.d(TAG,?"onResume()");}@Overrideprotected?void?onPause()?{super.onPause();Log.d(TAG,?"onPause()");}@Overrideprotected?void?onStop()?{super.onStop();Log.d(TAG,?"onStop()");}@Overrideprotected?void?onDestroy()?{super.onDestroy();Log.d(TAG,?"onDestroy()");}/***?[簡化Toast]**?@param?msg*/protected?void?showToast(String?msg)?{Toast.makeText(this,?msg,?Toast.LENGTH_SHORT).show();}/***?[簡化Toast]**?@param?msg*/protected?void?showToast(int?msg)?{Toast.makeText(this,?msg,?Toast.LENGTH_SHORT).show();}/***?[是否允許全屏]**?@param?allowFullScreen*/public?void?setAllowFullScreen(boolean?allowFullScreen)?{this.mAllowFullScreen?=?allowFullScreen;}/***?[是否設置沉浸狀態欄]**?@param?isSetStatusBar*/public?void?setSteepStatusBar(boolean?isSetStatusBar)?{this.isSetStatusBar?=?isSetStatusBar;}/***?[是否允許屏幕旋轉]**?@param?isAllowScreenRotate*/public?void?setScreenRoate(boolean?isAllowScreenRotate)?{this.isAllowScreenRotate?=?isAllowScreenRotate;}}

Github開源地址:點擊【閱讀原文】,喜歡的話,順手star下哦!

總結

以上是生活随笔為你收集整理的一款使用RxJava+Retrofit+MVP的快播App开源啦!的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。