diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ListArticles.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ListArticles.java index bc0b359..409bc80 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ListArticles.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ListArticles.java @@ -7,6 +7,7 @@ import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import android.os.Build; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; @@ -24,6 +25,15 @@ public class ListArticles extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + try { + getActionBar().setDisplayHomeAsUpEnabled(true); + } catch (Exception e) { + // + } + } + setupDB(); setupList(false); } @@ -55,7 +65,10 @@ public class ListArticles extends Activity { ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(this); helper.truncateTables(database); setupList(false); - super.onOptionsItemSelected(item); + return super.onOptionsItemSelected(item); + case android.R.id.home: + this.finish(); + return super.onOptionsItemSelected(item); default: return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ReadArticle.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ReadArticle.java index bc722c5..39a54c8 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ReadArticle.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ReadArticle.java @@ -14,7 +14,9 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import android.os.Build; import android.os.Bundle; +import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; @@ -43,6 +45,15 @@ public class ReadArticle extends Activity { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.article); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + try { + getActionBar().setDisplayHomeAsUpEnabled(true); + } catch (Exception e) { + // + } + } + view = (ScrollView) findViewById(R.id.scroll); ArticlesSQLiteOpenHelper helper = new ArticlesSQLiteOpenHelper(getApplicationContext()); database = helper.getWritableDatabase(); @@ -137,5 +148,15 @@ public class ReadArticle extends Activity { super.onDestroy(); database.close(); } - + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + this.finish(); + return super.onOptionsItemSelected(item); + default: + return super.onOptionsItemSelected(item); + } + } } diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/Settings.java b/app/src/main/java/fr/gaulupeau/apps/Poche/Settings.java index 35f6f9b..7cbd66b 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/Settings.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/Settings.java @@ -4,7 +4,9 @@ import static fr.gaulupeau.apps.Poche.Helpers.PREFS_NAME; import fr.gaulupeau.apps.InThePoche.R; import android.app.Activity; import android.content.SharedPreferences; +import android.os.Build; import android.os.Bundle; +import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; @@ -23,6 +25,15 @@ public class Settings extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + try { + getActionBar().setDisplayHomeAsUpEnabled(true); + } catch (Exception e) { + // + } + } + SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); String pocheUrl = settings.getString("pocheUrl", "http://"); String apiUsername = settings.getString("APIUsername", ""); @@ -52,4 +63,15 @@ public class Settings extends Activity { // } } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + this.finish(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } }