Back to project page AdvancedPlayer.
The source code is released under:
Apache License
If you think the Android project AdvancedPlayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.huilan.library_videoplay.util; //from w ww . j a v a2 s . com import android.content.Context; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import com.huilan.library_videoplay.R; /** * Created by liujigang on 2014/12/15 0015. */ public class ViewController { private Context context; private Toast mToast; private ProgressBar mProgressbar; private ImageView mImage; /** * ?????? * * @param context ??? */ public ViewController(Context context) { this.context = context; init(); } private void init() { mToast = new Toast(context); View view = LayoutInflater.from(context).inflate(R.layout.layout_controller, null); mImage = (ImageView) view.findViewById(R.id.iv_image); mProgressbar = (ProgressBar) view.findViewById(R.id.pb_progressbar); mToast.setView(view); mToast.setGravity(Gravity.CENTER, 0, 0); mToast.setDuration(Toast.LENGTH_SHORT); } /** * ???????????? * * @param context ??? * @param resId ?????ID * @param max ????????? */ public ViewController(Context context, int resId, int max) { this.context = context; init(); mImage.setImageResource(resId); mProgressbar.setMax(max); } public void show(int progress) { mProgressbar.setProgress(progress); mToast.show(); } public void setMax(int max) { mProgressbar.setMax(max); } public void setImage(int resId) { mImage.setImageResource(resId); } public void cancel() { mToast.cancel(); } }