Android Open Source - Tree-Task Tree Task Progress Bar






From Project

Back to project page Tree-Task.

License

The source code is released under:

Apache License

If you think the Android project Tree-Task listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ghsoft.treetaskapp;
//  w  ww  .j  a va 2  s  .  c o m
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.ProgressBar;

import com.ghsoft.treetask.R;

public class TreeTaskProgressBar extends ProgressBar {


  public TreeTaskProgressBar(Context context) {
    super(context);
    setupColor();
  }
  
  public TreeTaskProgressBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    setupColor();
  }
  
  public TreeTaskProgressBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setupColor();
  }

  private void setupColor() {
    LayerDrawable progressDrawable = (LayerDrawable) this.getProgressDrawable();
    
    SharedPreferences general = PreferenceManager.getDefaultSharedPreferences(getContext());
    int color = general.getInt("prog_color", getResources().getColor(R.color.progDefault));

    Drawable drawable = new ColorDrawable(color);
    ClipDrawable cd = new ClipDrawable(drawable, Gravity.LEFT, ClipDrawable.HORIZONTAL);
    progressDrawable.setDrawableByLayerId(android.R.id.progress, cd);

    Drawable bgdfraw = new ColorDrawable(Color.parseColor("#111111"));
    progressDrawable.setDrawableByLayerId(android.R.id.background, bgdfraw);
  }

}




Java Source Code List

com.ghsoft.treetask.MetaData.java
com.ghsoft.treetask.TaskDummy.java
com.ghsoft.treetask.TaskHead.java
com.ghsoft.treetask.TaskLeaf.java
com.ghsoft.treetask.TaskManager.java
com.ghsoft.treetask.TaskNode.java
com.ghsoft.treetask.Task.java
com.ghsoft.treetask.TextTreeBuilder.java
com.ghsoft.treetaskapp.About.java
com.ghsoft.treetaskapp.EditTask.java
com.ghsoft.treetaskapp.ExportView.java
com.ghsoft.treetaskapp.HtmlTreeBuilder.java
com.ghsoft.treetaskapp.MainListItem.java
com.ghsoft.treetaskapp.MainViewFragment.java
com.ghsoft.treetaskapp.Main.java
com.ghsoft.treetaskapp.ModifyTaskActivity.java
com.ghsoft.treetaskapp.NewTask.java
com.ghsoft.treetaskapp.NewTreeTask.java
com.ghsoft.treetaskapp.NewTreeView.java
com.ghsoft.treetaskapp.Settings.java
com.ghsoft.treetaskapp.TaskViewListItem.java
com.ghsoft.treetaskapp.TaskView.java
com.ghsoft.treetaskapp.TreeTaskProgressBar.java
com.ghsoft.treetaskapp.TreeView.java