Search in sources :

Example 1 with MaterialProgressDrawable

use of net.steamcrafted.loadtoast.MaterialProgressDrawable in project loadtoast by code-mc.

the class MainActivity method onCreate.

// Example activity
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final String text = "";
    final LoadToast lt = new LoadToast(this).setProgressColor(Color.RED).setText(text).setTranslationY(100).show();
    //lt.success();
    final ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
    View v = new View(this);
    v.setBackgroundColor(Color.RED);
    //root.addView(v, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 400));
    findViewById(R.id.show).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            lt.show();
        }
    });
    findViewById(R.id.error).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            lt.error();
        }
    });
    findViewById(R.id.success).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            lt.success();
        }
    });
    findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            View v = new View(MainActivity.this);
            v.setBackgroundColor(Color.rgb((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)));
        //root.addView(v, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 400));
        }
    });
    ImageView progressView = ((ImageView) findViewById(R.id.progressdrawable));
    MaterialProgressDrawable drawable = new MaterialProgressDrawable(this, progressView);
}
Also used : ViewGroup(android.view.ViewGroup) LoadToast(net.steamcrafted.loadtoast.LoadToast) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) MaterialProgressDrawable(net.steamcrafted.loadtoast.MaterialProgressDrawable)

Aggregations

View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 LoadToast (net.steamcrafted.loadtoast.LoadToast)1 MaterialProgressDrawable (net.steamcrafted.loadtoast.MaterialProgressDrawable)1