Skip to content

Commit

Permalink
Merge pull request #57 from kevmeyer/dev
Browse files Browse the repository at this point in the history
article view improvements
  • Loading branch information
tcitworld committed Jan 12, 2015
2 parents eea88f0 + e5de4d0 commit d031703
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
20 changes: 16 additions & 4 deletions app/src/main/java/fr/gaulupeau/apps/Poche/ReadArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,23 @@ public void onCreate(Bundle savedInstanceState) {
webViewContent = (WebView) findViewById(R.id.webViewContent);
webViewContent.loadDataWithBaseURL("file:///android_asset/", htmlHeader + htmlContent + htmlFooter, "text/html", "utf-8", null);

Button btnMarkRead = (Button) findViewById(R.id.btnMarkRead);
btnMarkRead.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
markAsReadAndClose();
}
});
}

private void markAsReadAndClose() {
ContentValues values = new ContentValues();
values.put(ARCHIVE, 1);
database.update(ARTICLE_TABLE, values, MY_ID + "=" + id, null);
finish();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
Expand All @@ -101,10 +116,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuArticleMarkAsRead:
ContentValues values = new ContentValues();
values.put(ARCHIVE, 1);
database.update(ARTICLE_TABLE, values, MY_ID + "=" + id, null);
finish();
markAsReadAndClose();
return true;
default:
return super.onOptionsItemSelected(item);
Expand Down
42 changes: 38 additions & 4 deletions app/src/main/res/layout/article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,43 @@
android:id="@+id/scroll"
tools:context="fr.gaulupeau.apps.Poche.ReadArticle" >

<WebView
android:id="@+id/webViewContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="WebViewLayout" >

<WebView
android:id="@+id/webViewContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="15sp"
android:paddingRight="15sp" >

<View
android:id="@+id/view1"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_marginBottom="5sp"
android:layout_marginTop="5sp"
android:background="#000000" />

<Button
android:id="@+id/btnMarkRead"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@string/btnMarkRead" />

</LinearLayout>


</LinearLayout>


</ScrollView>
7 changes: 6 additions & 1 deletion app/src/main/res/menu/option_article.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menuArticleMarkAsRead" android:title="@string/btnMarkRead" />
<item
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/menuArticleMarkAsRead"
android:title="@string/btnMarkRead"
android:icon="@android:drawable/checkbox_on_background"
app:showAsAction="always" />
</menu>

0 comments on commit d031703

Please sign in to comment.