Java Code Examples for android.widget.ProgressBar#setIndeterminateDrawable()
The following examples show how to use
android.widget.ProgressBar#setIndeterminateDrawable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From samples with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress); PathProgressDrawable pathProgressDrawable = new PathProgressDrawable(); pathProgressDrawable.setAnimatedPoints(10); progressBar.setIndeterminateDrawable(pathProgressDrawable); progressBar.setIndeterminate(true); RectProgressDrawable drawable = new RectProgressDrawable(); drawable.setPoints(7); ProgressBar progressBar2 = (ProgressBar) findViewById(R.id.progress2); progressBar2.setIndeterminateDrawable(drawable); progressBar2.setIndeterminate(true); CircleProgressDrawable drawableCircle = new CircleProgressDrawable(); drawableCircle.setPoints(6); drawableCircle.setAnimatedPoints(20); ProgressBar progressBar3 = (ProgressBar) findViewById(R.id.progress3); progressBar3.setIndeterminateDrawable(drawableCircle); progressBar3.setIndeterminate(true); }
Example 2
Source File: Buildable.java From KUtils-master with Apache License 2.0 | 6 votes |
protected BuildBean buildLoadingHorizontal(BuildBean bean) { Dialog dialog = new Dialog(bean.mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); bean.dialog = dialog; View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null); View llBg = (View) root.findViewById(R.id.dialogui_ll_bg); ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg); TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg); tvMsg.setText(bean.msg); if (bean.isWhiteBg) { llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress)); tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black)); } else { llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light)); tvMsg.setTextColor(Color.WHITE); } bean.dialog.setContentView(root); return bean; }
Example 3
Source File: CommonPtrDefView.java From FamilyChat with Apache License 2.0 | 6 votes |
private void initUI(Context context) { inflate(context, R.layout.layout_ptrview_def_view, this); setWillNotDraw(false); mAnimRotateDown = AnimationUtils.loadAnimation(context, R.anim.arrow_rotate_down); mAnimRotateUp = AnimationUtils.loadAnimation(context, R.anim.arrow_rotate_up); mTvStatus = (TextView) findViewById(R.id.tv_ptrview_def_view_status); mImgStatus = (ImageView) findViewById(R.id.img_ptrview_def_view_status); mPgbLoading = (ProgressBar) findViewById(R.id.pgb_ptrview_def_view_loading); mImgArrow = (ImageView) findViewById(R.id.img_ptrview_def_view_arrow); mTvStatus.setTextColor(mTvColor); mPgbLoading.setIndeterminateDrawable(getResources().getDrawable(mPgbDrawable)); }
Example 4
Source File: Buildable.java From KUtils-master with Apache License 2.0 | 6 votes |
protected BuildBean buildMdLoadingHorizontal(BuildBean bean) { AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext); View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null); View llBg = (View) root.findViewById(R.id.dialogui_ll_bg); ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg); TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg); tvMsg.setText(bean.msg); if (bean.isWhiteBg) { llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress)); tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black)); } else { llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light)); tvMsg.setTextColor(Color.WHITE); } builder.setView(root); AlertDialog dialog = builder.create(); bean.alertDialog = dialog; return bean; }
Example 5
Source File: Buildable.java From KUtils with Apache License 2.0 | 6 votes |
protected BuildBean buildMdLoadingHorizontal(BuildBean bean) { AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext); View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null); View llBg = (View) root.findViewById(R.id.dialogui_ll_bg); ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg); TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg); tvMsg.setText(bean.msg); if (bean.isWhiteBg) { llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress)); tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black)); } else { llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light)); tvMsg.setTextColor(Color.WHITE); } builder.setView(root); AlertDialog dialog = builder.create(); bean.alertDialog = dialog; return bean; }
Example 6
Source File: Buildable.java From KUtils with Apache License 2.0 | 6 votes |
protected BuildBean buildLoadingVertical(BuildBean bean) { Dialog dialog = new Dialog(bean.mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); bean.dialog = dialog; View root = View.inflate(bean.mContext, R.layout.dialogui_loading_vertical, null); View llBg = (View) root.findViewById(R.id.dialogui_ll_bg); ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg); TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg); tvMsg.setText(bean.msg); if (bean.isWhiteBg) { llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum)); tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black)); } else { llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light)); tvMsg.setTextColor(Color.WHITE); } bean.dialog.setContentView(root); return bean; }
Example 7
Source File: Buildable.java From KUtils with Apache License 2.0 | 6 votes |
protected BuildBean buildLoadingHorizontal(BuildBean bean) { Dialog dialog = new Dialog(bean.mContext); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); bean.dialog = dialog; View root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null); View llBg = (View) root.findViewById(R.id.dialogui_ll_bg); ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg); TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg); tvMsg.setText(bean.msg); if (bean.isWhiteBg) { llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress)); tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black)); } else { llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner); pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress_light)); tvMsg.setTextColor(Color.WHITE); } bean.dialog.setContentView(root); return bean; }
Example 8
Source File: PRTHeader.java From GithubApp with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 9
Source File: UIProgressDialog.java From UIWidget with Apache License 2.0 | 5 votes |
@Override public View createProgressView() { mProgressBar = new ProgressBar(mContext); mProgressBar.setLayoutParams(new ViewGroup.LayoutParams(mLoadingSize, mLoadingSize)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mIndeterminateDrawable == null) { mProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mLoadingColor)); } if (mIndeterminateDrawable != null) { mProgressBar.setIndeterminateDrawable(mIndeterminateDrawable); } return mProgressBar; }
Example 10
Source File: PRTHeader.java From Social with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 11
Source File: PRTHeader.java From BaoKanAndroid with MIT License | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = ResHelper.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 12
Source File: PRTHeader.java From HHComicViewer with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 13
Source File: PRTHeader.java From fingerpoetry-android with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = R.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = R.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = R.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 14
Source File: PRTHeader.java From YiZhi with Apache License 2.0 | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = ResHelper.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 15
Source File: PRTHeader.java From POCenter with MIT License | 5 votes |
public PRTHeader(Context context) { super(context); int[] size = ResHelper.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
Example 16
Source File: FolderPickerActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreate() start"); super.onCreate(savedInstanceState); setContentView(R.layout.files_folder_picker); if (savedInstanceState == null) { createFragments(); } fpToolbar = (Toolbar) findViewById(R.id.toolbar); if (fpToolbar != null) { setSupportActionBar(fpToolbar); } // sets callback listeners for UI elements initControls(); // Action bar setup ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mProgressBar.setIndeterminateDrawable( getResources().getDrawable( R.drawable.actionbar_progress_indeterminate_horizontal)); mProgressBar.setIndeterminate(mSyncInProgress); // always AFTER setContentView(...) ; to work around bug in its implementation // sets message for empty list of folders setBackgroundText(); Log_OC.d(TAG, "onCreate() end"); }
Example 17
Source File: MainActivity.java From android-animatedscaledrawable with Apache License 2.0 | 4 votes |
@SuppressWarnings("deprecation") @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = mViews[position]; if(convertView == null){ AnimatedScaleDrawable drawable = new AnimatedScaleDrawable( parent.getContext().getResources().getDrawable(R.drawable.heart)); drawable.setInterpolator(new BounceInterpolator()); drawable.setInvertTransformation(true); drawable.setDuration(500); FrameLayout frame = (FrameLayout)LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_frame, parent, false); if(position == 0){ // ProgressBar example ProgressBar progress = (ProgressBar)LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_progress, frame, false); progress.setIndeterminateDrawable(drawable); frame.addView(progress); } else{ if(position == 1 || position == 2){ // Background drawable example frame.setBackgroundDrawable(drawable); if(position == 2){ drawable.setUseBounds(false); } }else{ // Foreground's with Gravity example frame.setForeground(drawable); frame.setForegroundGravity(mGravity[position - 3]); } // no need to call drawable.start() for ProgressBar widgets drawable.start(); } TextView textView = (TextView)frame.findViewById(R.id.text); textView.setText(String.format("#%02d %s", position, mNames[position])); convertView = frame; } return convertView; }
Example 18
Source File: ActionUtil.java From AppPlus with MIT License | 4 votes |
private static void copyFile(final Activity activity,File srcFile, final File exportFile) { View view = LayoutInflater.from(activity).inflate(R.layout.dialog_progress, null); ProgressBar progressBar = (ProgressBar) view.findViewById(android.R.id.progress); TextView textView = (TextView) view.findViewById(R.id.content); //改变Progress的背景为MaterialDesigner规范的样式 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { progressBar.setIndeterminateDrawable(new CircularProgressDrawable(Utils.getColorWarp(activity, R.color.colorAccent), activity.getResources().getDimension(R.dimen.loading_border_width))); } final AlertDialog progressDialog = DialogUtil.getProgressDialog(activity,activity.getString(R.string.title_point),activity.getString(R.string.please_wait)); progressDialog.show(); try { FileUtil.copyFileUsingFileChannelsAsyn(srcFile, exportFile) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Boolean>() { @Override public void call(Boolean aBoolean) { progressDialog.dismiss(); String contentInfo = String.format(activity.getString(R.string.dialog_message_export_finish), exportFile.getName(), exportFile.getParentFile().getAbsolutePath()); new AlertDialog.Builder(activity) .setTitle(R.string.title_export_finish) .setMessage(contentInfo) .setPositiveButton(R.string.dialog_confirm_watch, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { RxBus.getInstance().send(new RxEvent(EEvent.OPEN_EXPORT_DIR)); if(!(activity instanceof MainActivity)){ activity.finish(); } } }) .setNegativeButton(R.string.dialog_cancel_watch, null) .show(); } }); } catch (IOException e) { e.printStackTrace(); } }
Example 19
Source File: FileDisplayActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { Log_OC.v(TAG, "onCreate() start"); super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account // is valid /// grant that FileObserverService is watching favorite files if (savedInstanceState == null) { Intent initObserversIntent = FileObserverService.makeInitIntent(this); startService(initObserversIntent); } /// Load of saved instance state if (savedInstanceState != null) { mWaitingToPreview = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mWaitingToSend = savedInstanceState.getParcelable(FileDisplayActivity.KEY_WAITING_TO_SEND); } else { mWaitingToPreview = null; mSyncInProgress = false; mWaitingToSend = null; } // Shared application prefrences mAppPreferences = PreferenceManager.getDefaultSharedPreferences(this); // Layout View // Set layout icon if not alrady set if (mAppPreferences.getInt("layoutMode", 0) == 0) { SharedPreferences.Editor editor = mAppPreferences.edit(); editor.putInt("layoutMode", R.drawable.ic_list); editor.apply(); } /// USER INTERFACE // Inflate and set the layout view setContentView(R.layout.files); // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { // set toolbar and navigation drawer setSupportActionBar(toolbar); } // Navigation Drawer initDrawer(); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mProgressBar.setIndeterminateDrawable( ContextCompat.getDrawable(this, R.drawable.actionbar_progress_indeterminate_horizontal)); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); if (savedInstanceState == null) { createMinFragments(); } // Action bar setup if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); // mandatory since Android ICS, } mProgressBar.setIndeterminate(mSyncInProgress); // always AFTER setContentView(...) ; to work around bug in its implementation setBackgroundText(); Log_OC.v(TAG, "onCreate() end"); }
Example 20
Source File: CustomPullDownRefreshListView.java From NewXmPluginSDK with Apache License 2.0 | 4 votes |
public void setProgressDrawable(Drawable drawable){ ProgressBar prog = (ProgressBar)findViewById(R.id.pull_header_prog); prog.setIndeterminateDrawable(drawable); }