|
| 1 | +package com.commit451.nativestackblur.sample; |
| 2 | + |
| 3 | +import android.os.Bundle; |
| 4 | +import android.support.v7.app.AppCompatActivity; |
| 5 | +import android.view.Menu; |
| 6 | +import android.view.MenuItem; |
| 7 | +import android.widget.ImageView; |
| 8 | + |
| 9 | +import com.squareup.picasso.Picasso; |
| 10 | + |
| 11 | +public class MainActivity extends AppCompatActivity { |
| 12 | + |
| 13 | + ImageView mImage; |
| 14 | + ImageView mBlurredImage; |
| 15 | + |
| 16 | + @Override |
| 17 | + protected void onCreate(Bundle savedInstanceState) { |
| 18 | + super.onCreate(savedInstanceState); |
| 19 | + setContentView(R.layout.activity_main); |
| 20 | + mImage = (ImageView) findViewById(R.id.image); |
| 21 | + mBlurredImage = (ImageView) findViewById(R.id.blurredImage); |
| 22 | + Picasso.with(this) |
| 23 | + .load("https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Android_robot.svg/511px-Android_robot.svg.png") |
| 24 | + .into(mImage); |
| 25 | + |
| 26 | + Picasso.with(this) |
| 27 | + .load("https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Android_robot.svg/511px-Android_robot.svg.png") |
| 28 | + .transform(new BlurTransformation(5)) |
| 29 | + .into(mBlurredImage); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public boolean onCreateOptionsMenu(Menu menu) { |
| 34 | + // Inflate the menu; this adds items to the action bar if it is present. |
| 35 | + getMenuInflater().inflate(R.menu.menu_main, menu); |
| 36 | + return true; |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public boolean onOptionsItemSelected(MenuItem item) { |
| 41 | + // Handle action bar item clicks here. The action bar will |
| 42 | + // automatically handle clicks on the Home/Up button, so long |
| 43 | + // as you specify a parent activity in AndroidManifest.xml. |
| 44 | + int id = item.getItemId(); |
| 45 | + |
| 46 | + //noinspection SimplifiableIfStatement |
| 47 | + if (id == R.id.action_settings) { |
| 48 | + return true; |
| 49 | + } |
| 50 | + |
| 51 | + return super.onOptionsItemSelected(item); |
| 52 | + } |
| 53 | +} |
0 commit comments