diff --git a/demo/build.gradle b/demo/build.gradle index 19784ba..af8a659 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -24,5 +24,5 @@ android { } dependencies { - compile 'com.github.raveeshbhalla:proteus:1.0.2' + compile project(":proteus") } diff --git a/demo/src/main/java/in/raveesh/proteusdemo/MainActivity.java b/demo/src/main/java/in/raveesh/proteusdemo/MainActivity.java index 8ffce42..03d028b 100644 --- a/demo/src/main/java/in/raveesh/proteusdemo/MainActivity.java +++ b/demo/src/main/java/in/raveesh/proteusdemo/MainActivity.java @@ -7,6 +7,7 @@ import java.util.Random; +import in.raveesh.proteus.Button; import in.raveesh.proteus.ImageView; @@ -17,35 +18,35 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - final ImageView imageView = (ImageView)findViewById(R.id.imageView); - final TextView textView = (TextView)findViewById(R.id.textView); - findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { + final ImageView imageView = (ImageView) findViewById(R.id.imageView); + final TextView textView = (TextView) findViewById(R.id.textView); + final Button button = (Button) findViewById(R.id.button); + button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Random random = new Random(); int s = random.nextInt(4 - 0); + int color; switch (s) { case 0: - imageView.setPaintedDrawableFromResource(R.drawable.ic_action_thumbs_up, - android.R.color.holo_blue_bright); + color = android.R.color.holo_blue_bright; textView.setText("Blue"); break; case 1: - imageView.setPaintedDrawableFromResource(R.drawable.ic_action_thumbs_up, - android.R.color.holo_green_light); + color = android.R.color.holo_green_light; textView.setText("Green"); break; case 2: - imageView.setPaintedDrawableFromResource(R.drawable.ic_action_thumbs_up, - android.R.color.holo_orange_light); + color = android.R.color.holo_orange_light; textView.setText("Orange"); break; - case 3: - imageView.setPaintedDrawableFromResource(R.drawable.ic_action_thumbs_up, - android.R.color.holo_purple); + default: + color = android.R.color.holo_purple; textView.setText("Purple"); break; } + imageView.setPaintedDrawableFromResource(R.drawable.ic_action_thumbs_up, color); + button.setPaintResource(color); } }); } diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index 7b77df8..c5e81c8 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -29,11 +29,13 @@ android:textSize="16sp" android:layout_alignBottom="@+id/imageView"/> -