Qvod, imitating netease Cloud music UI, adopts the overall architecture of RxJava+Retrofit+MVP and supports online video playing, online picture browsing and other functions.

Using third-party open source libraries:

  • ButterKnife: Dependency injection framework
  • Glide: Picture loading
  • Retrofit: Network requests
  • JieCaoVideoPlayer: player

The capture interface is used for data presentation

The renderings are as follows:













The base class:

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 appactivity {/** * whether to immerse the status bar **/ private Boolean isSetStatusBar =false; /** * Whether full screen is allowed **/ private Boolean mAllowFullScreen =false; /** * Whether screen rotation is allowed **/ private Boolean isAllowScreenRotate =false; /** */ private View mContextView = null; /** * protected Final String TAG = this.getClass().getSimplename (); @Override protected 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); } /** * [Immersion status bar] */ private voidsteepStatusBar() {
        if(build.version.sdk_int >= build.version_coders.kitkat) {// Transparent status bar getWindow().addFlags( WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); / / transparent navigation getWindow (). AddFlags (WindowManager. LayoutParams. FLAG_TRANSLUCENT_NAVIGATION); }} /** * [init parameter -- before loading XML view] ** @param bundle */ public abstract void initPrams(bundle bundle); /** * [binding layout] ** @return
     */
    public abstract int bindLayout(); /** * @param view */ public void initView(final view); /** * [bind control] ** @param resId * @return
     */
    protected <T extends View> T $(int resId) {
        return(T) super.findViewById(resId); } /** * [set listener] */ public abstract voidsetListener(); /** * @param mContext */ public abstract voiddoBusiness(Context mContext); @param CLZ */ public void startActivity(Class<? > clz) { startActivity(new Intent(BaseActivity.this, clz)); } public void startActivity(Class<? > clz, Bundle bundle) { Intent intent = new Intent(); intent.setClass(this, clz);if(bundle ! = null) { intent.putExtras(bundle); } startActivity(intent); ** @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); } @Override protected voidonRestart() {
        super.onRestart();
        Log.d(TAG, "onRestart()");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d(TAG, "onStart()");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d(TAG, "onResume()");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d(TAG, "onPause()");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d(TAG, "onStop()");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "onDestroy()"); } /** * @param MSG */ protected void showToast(String MSG) {toast.maketext (this, MSG, Toast.LENGTH_SHORT).show(); } /** * @param MSG */ protected void showToast(int MSG) {toast.maketext (this, MSG, Toast.LENGTH_SHORT).show(); } /** * @param allowFullScreen */ public voidsetAllowFullScreen(boolean allowFullScreen) { this.mAllowFullScreen = allowFullScreen; ** @param isSetStatusBar */ public voidsetSteepStatusBar(boolean isSetStatusBar) { this.isSetStatusBar = isSetStatusBar; } /** * [whether screen rotation is allowed] ** @param isAllowScreenRotate */ public voidsetScreenRoate(boolean isAllowScreenRotate) { this.isAllowScreenRotate = isAllowScreenRotate; }}Copy the code

Author: Zhaomingjian; Github is at https://github.com/zhao-mingjian/qvod



Welcome to follow my wechat public account “Code farming breakthrough”, share Python, Java, big data, machine learning, artificial intelligence and other technologies, pay attention to code farming technology improvement, career breakthrough, thinking transition, 200,000 + code farming growth charge first stop, accompany you have a dream to grow together.