The entry point of Android Image Edit. Basically controls the flow of data: If we have a current image, it displays it, if not, we get a gallery view. @author Ben Augarten
| 15 | * |
| 16 | */ |
| 17 | public class Main extends Activity { |
| 18 | |
| 19 | static final String PREFS_FILE = "image_edit"; |
| 20 | |
| 21 | /** The URI of the Image to display. */ |
| 22 | private Uri imageUri; |
| 23 | |
| 24 | private int _wait; |
| 25 | |
| 26 | /** Called when the activity is first created. */ |
| 27 | @Override |
| 28 | public void onCreate(Bundle savedInstanceState) { |
| 29 | super.onCreate(savedInstanceState); |
| 30 | this.setContentView(R.layout.main_screen); |
| 31 | _wait = 1000; |
| 32 | |
| 33 | imageUri = null; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | protected void onResume() { |
| 38 | super.onResume(); |
| 39 | if (_wait != 0) { |
| 40 | |
| 41 | new CountDownTimer(_wait, _wait) { |
| 42 | @Override |
| 43 | public void onFinish() { |
| 44 | if (imageUri != null) { |
| 45 | Intent viewActivity = new Intent(Main.this, Viewer.class); |
| 46 | viewActivity.putExtra("image", imageUri); |
| 47 | startActivity(viewActivity); |
| 48 | } else { |
| 49 | startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), 0); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public void onTick(long millisUntilFinished) { |
| 55 | |
| 56 | } |
| 57 | |
| 58 | }.start(); |
| 59 | _wait = 0; |
| 60 | } else { |
| 61 | if (imageUri != null) { |
| 62 | Intent viewActivity = new Intent(this, Viewer.class); |
| 63 | viewActivity.putExtra("image", imageUri); |
| 64 | startActivity(viewActivity); |
| 65 | } else { |
| 66 | startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), 0); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | protected void onPause() { |
| 73 | super.onPause(); |
| 74 | imageUri = null; |
nothing calls this directly
no outgoing calls
no test coverage detected