From b18f0d24a921cfb841ddbfbe9c3974a01f37b969 Mon Sep 17 00:00:00 2001 From: Ye Lin Aung Date: Fri, 6 Dec 2013 22:08:23 +0630 Subject: [PATCH 1/2] Added Back Button at DetailActivity for Demo. --- .../colorart/demo/DetailsActivity.java | 16 +++++++++++----- demo/src/main/project.properties | 16 ++++++++++++++++ library/src/main/project.properties | 15 +++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 demo/src/main/project.properties create mode 100644 library/src/main/project.properties diff --git a/demo/src/main/java/org/michaelevans/colorart/demo/DetailsActivity.java b/demo/src/main/java/org/michaelevans/colorart/demo/DetailsActivity.java index 8e5ff0b..921bed2 100644 --- a/demo/src/main/java/org/michaelevans/colorart/demo/DetailsActivity.java +++ b/demo/src/main/java/org/michaelevans/colorart/demo/DetailsActivity.java @@ -37,9 +37,12 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); + getActionBar().setHomeButtonEnabled(true); + getActionBar().setDisplayHomeAsUpEnabled(true); + int position = 0; Bundle extras = getIntent().getExtras(); - if(extras != null) + if (extras != null) position = extras.getInt("position"); Bitmap album = BitmapFactory.decodeResource(getResources(), SampleData.imageIds[position]); @@ -62,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public boolean onCreateOptionsMenu(Menu menu) { - + // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.details, menu); return true; @@ -73,17 +76,20 @@ public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); if (id == R.id.action_fade) { - if(item.isChecked()){ + if (item.isChecked()) { mImageView.setFadeEnabled(true); item.setChecked(false); - }else{ + } else { mImageView.setFadeEnabled(false); item.setChecked(true); } return true; + } else if (id == android.R.id.home) { + onBackPressed(); } return super.onOptionsItemSelected(item); } -} +} \ No newline at end of file diff --git a/demo/src/main/project.properties b/demo/src/main/project.properties new file mode 100644 index 0000000..f85a810 --- /dev/null +++ b/demo/src/main/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-15 +android.library.reference.1=../../../library/src/main + diff --git a/library/src/main/project.properties b/library/src/main/project.properties new file mode 100644 index 0000000..91d2b02 --- /dev/null +++ b/library/src/main/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 +android.library=true From f67c9102b1b67f20d5df267fc0b0d51adc525747 Mon Sep 17 00:00:00 2001 From: Ye Lin Aung Date: Tue, 10 Dec 2013 07:11:11 +0630 Subject: [PATCH 2/2] Project target to be 19. --- demo/src/main/project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/src/main/project.properties b/demo/src/main/project.properties index f85a810..5365aaf 100644 --- a/demo/src/main/project.properties +++ b/demo/src/main/project.properties @@ -11,6 +11,6 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-15 +target=android-19 android.library.reference.1=../../../library/src/main