mirror of
https://github.com/moparisthebest/android-app
synced 2024-12-24 23:48:48 -05:00
articleView: moving MarkAsRead-button to actionBar (see issue #53)
This commit is contained in:
parent
e982dfb1b6
commit
038139b5b4
@ -4,6 +4,9 @@ import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.webkit.WebView;
|
||||
@ -25,7 +28,6 @@ import static fr.gaulupeau.apps.Poche.ArticlesSQLiteOpenHelper.MY_ID;
|
||||
|
||||
public class ReadArticle extends BaseActionBarActivity {
|
||||
WebView webViewContent;
|
||||
Button btnMarkRead;
|
||||
SQLiteDatabase database;
|
||||
String id = "";
|
||||
ScrollView view;
|
||||
@ -86,19 +88,27 @@ public class ReadArticle extends BaseActionBarActivity {
|
||||
webViewContent = (WebView) findViewById(R.id.webViewContent);
|
||||
webViewContent.loadDataWithBaseURL("file:///android_asset/", htmlHeader + htmlContent + htmlFooter, "text/html", "utf-8", null);
|
||||
|
||||
btnMarkRead = (Button) findViewById(R.id.btnMarkRead);
|
||||
btnMarkRead.setOnClickListener(new OnClickListener() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.option_article, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
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();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,43 +7,9 @@
|
||||
android:id="@+id/scroll"
|
||||
tools:context="fr.gaulupeau.apps.Poche.ReadArticle" >
|
||||
|
||||
<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>
|
||||
|
4
app/src/main/res/menu/option_article.xml
Normal file
4
app/src/main/res/menu/option_article.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?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" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user