diff --git a/MessageBar b/MessageBar
index 6c90cb7e..7a99ea20 160000
--- a/MessageBar
+++ b/MessageBar
@@ -1 +1 @@
-Subproject commit 6c90cb7ea5272cfd509270059125ca38ea01cf01
+Subproject commit 7a99ea2008e44d53ae1bef5cc7769054b5b69451
diff --git a/News-Android-App/News-Android-App-News-Android-App.iml b/News-Android-App/News-Android-App-News-Android-App.iml
index 009ef0ae..733a1596 100644
--- a/News-Android-App/News-Android-App-News-Android-App.iml
+++ b/News-Android-App/News-Android-App-News-Android-App.iml
@@ -55,7 +55,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,13 +84,13 @@
-
+
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetProvider.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetProvider.java
index 0578fbe9..23794347 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetProvider.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetProvider.java
@@ -38,6 +38,8 @@ import de.luhmer.owncloudnewsreader.Constants;
import de.luhmer.owncloudnewsreader.NewsDetailActivity;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.R;
+import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
+import de.luhmer.owncloudnewsreader.database.model.RssItem;
public class WidgetProvider extends AppWidgetProvider {
@@ -46,6 +48,7 @@ public class WidgetProvider extends AppWidgetProvider {
public static final String ACTION_WIDGET_CONFIGURE = "ConfigureWidget";
public static final String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget";
public static final String ACTION_LIST_CLICK = "ACTION_LIST_CLICK";
+ public static final String ACTION_CHECKED_CLICK = "ACTION_CHECKED_CLICK";
public static final String RSS_ITEM_ID = "RSS_ITEM_ID";
public static final String EXTRA_ITEM = null;
@@ -60,11 +63,11 @@ public class WidgetProvider extends AppWidgetProvider {
appWidgetId = new int[] { intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) };
else
appWidgetId = new int[] { AppWidgetManager.INVALID_APPWIDGET_ID };
-
- if(Constants.debugModeWidget)
- Log.d(TAG, "onRecieve - WidgetID: " + appWidgetId);
String action = intent.getAction();
+
+ Log.v(TAG, "onRecieve - WidgetID: " + appWidgetId + " - " + action);
+
for(int i = 0; i < appWidgetId.length; i++) {
if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
if (appWidgetId[i] != AppWidgetManager.INVALID_APPWIDGET_ID) {
@@ -83,14 +86,29 @@ public class WidgetProvider extends AppWidgetProvider {
try
{
Long rssItemId = intent.getExtras().getLong(RSS_ITEM_ID);
- //Intent intentToDoListAct = new Intent(context, TodoListActivity.class);
- Intent intentToDoListAct = new Intent(context, NewsDetailActivity.class);
- intentToDoListAct.putExtra(RSS_ITEM_ID, rssItemId);
- intentToDoListAct.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intentToDoListAct);
- if(Constants.debugModeWidget)
- Log.d(TAG, "ListItem Clicked Starting Activity for Item: " + rssItemId);
+
+ if(intent.hasExtra(ACTION_CHECKED_CLICK)) {
+ DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(context);
+ RssItem rssItem = dbConn.getRssItemById(rssItemId);
+ rssItem.setRead_temp(!rssItem.getRead_temp());
+ //rssItem.setRead_temp(true);
+
+
+
+ AppWidgetManager.getInstance(context)
+ .notifyAppWidgetViewDataChanged(appWidgetId[i], R.id.list_view);
+
+ Log.v(TAG, "I'm here!!! It fucking works!");
+ } else {
+ //Intent intentToDoListAct = new Intent(context, TodoListActivity.class);
+ Intent intentToDoListAct = new Intent(context, NewsDetailActivity.class);
+ intentToDoListAct.putExtra(RSS_ITEM_ID, rssItemId);
+ intentToDoListAct.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(intentToDoListAct);
+ }
+
+ Log.v(TAG, "ListItem Clicked Starting Activity for Item: " + rssItemId);
}
catch(Exception ex)
{
@@ -170,7 +188,15 @@ public class WidgetProvider extends AppWidgetProvider {
onListClickIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
rv.setPendingIntentTemplate(R.id.list_view, onListClickPendingIntent);
-
+
+
+ /*
+ Intent intentWidget = new Intent(context, WidgetProvider.class);
+ PendingIntent pendingWidgetIntent = PendingIntent.getBroadcast(context, 0, intentWidget, PendingIntent.FLAG_UPDATE_CURRENT);
+ rv.setOnClickPendingIntent(R.id.cb_lv_item_read_wrapper, pendingWidgetIntent);
+ */
+
+
Intent intentToDoListAct = new Intent(context, NewsReaderListActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intentToDoListAct, 0);
rv.setOnClickPendingIntent(R.id.tV_widget_header, pendingIntent);
diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetTodoViewsFactory.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetTodoViewsFactory.java
index 91d4f424..645baec1 100644
--- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetTodoViewsFactory.java
+++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/widget/WidgetTodoViewsFactory.java
@@ -85,13 +85,21 @@ public class WidgetTodoViewsFactory implements RemoteViewsService.RemoteViewsFac
// combination with the app widget item XML file to construct a RemoteViews object.
@SuppressLint("SimpleDateFormat")
public RemoteViews getViewAt(int position) {
+ RssItem rssItem = rssItems.get(position);
+
//RemoteViews rv = new RemoteViews(context.getPackageName(), android.R.layout.simple_list_item_2);
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_item);
- RssItem rssItem = rssItems.get(position);
+
+ /*
+ if(rssItem.getRead_temp())
+ rv = new RemoteViews(context.getPackageName(), R.layout.widget_item);
+ else
+ rv = new RemoteViews(context.getPackageName(), R.layout.widget_item_unread);
+ */
+
try
{
-
String header = rssItem.getFeed().getFeedTitle();
String colorString = rssItem.getFeed().getAvgColour();
@@ -99,8 +107,6 @@ public class WidgetTodoViewsFactory implements RemoteViewsService.RemoteViewsFac
header += authorOfArticle == null ? "" : " - " + authorOfArticle.trim();
String title = Html.fromHtml(rssItem.getTitle()).toString();
long id = rssItem.getId();
- //rv.setTextViewText(android.R.id.text1, header);
- //rv.setTextViewText(android.R.id.text2, title);
Date date = rssItem.getPubDate();
String dateString = "";
@@ -115,10 +121,20 @@ public class WidgetTodoViewsFactory implements RemoteViewsService.RemoteViewsFac
rv.setTextViewText(R.id.feed_title, title);
+
+ if(rssItem.getRead_temp()) {
+ rv.setInt(R.id.cb_lv_item_read, "setBackgroundResource", R.drawable.btn_check_on_holo_dark);
+ }
+ else {
+ rv.setInt(R.id.cb_lv_item_read, "setBackgroundResource", R.drawable.btn_check_off_holo_dark);
+ }
+
+
+
//View viewColor = view.findViewById(R.id.color_line_feed);
if(colorString != null)
rv.setInt(R.id.color_line_feed, "setBackgroundColor", Integer.parseInt(colorString));
- //rv.set(R.id.color_line_feed, Integer.parseInt(colorString));
+
//Get a fresh new intent
@@ -127,6 +143,16 @@ public class WidgetTodoViewsFactory implements RemoteViewsService.RemoteViewsFac
ei.putExtra(WidgetProvider.RSS_ITEM_ID, id);
//Set it on the list remote view
rv.setOnClickFillInIntent(R.id.ll_root_view_widget_row, ei);
+
+ //Get a fresh new intent
+ Intent iCheck = new Intent();
+ //Load it with whatever extra you want
+ iCheck.putExtra(WidgetProvider.RSS_ITEM_ID, id);
+ iCheck.putExtra(WidgetProvider.ACTION_CHECKED_CLICK, true);
+ rv.setOnClickFillInIntent(R.id.cb_lv_item_read, iCheck);
+
+
+
} catch(Exception ex) {
Log.d(TAG, ex.getLocalizedMessage());
}
diff --git a/News-Android-App/src/main/res/layout/widget_item.xml b/News-Android-App/src/main/res/layout/widget_item.xml
index dd3153b0..77215d2f 100644
--- a/News-Android-App/src/main/res/layout/widget_item.xml
+++ b/News-Android-App/src/main/res/layout/widget_item.xml
@@ -1,9 +1,7 @@
@@ -16,6 +14,7 @@
android:orientation="horizontal" />
@@ -50,7 +49,7 @@
android:gravity="center_vertical"
android:singleLine="true"
android:textIsSelectable="false"
- android:text="cdskfjds"
+ android:text="Feed name"
android:textSize="16sp" />
-
+
+
-
+ android:layout_height="match_parent"
+ android:gravity="right|center_vertical"
+ android:clickable="true"
+ android:paddingLeft="@dimen/listview_row_margin_left"
+ android:paddingRight="@dimen/listview_row_margin_right">
+
+
+
+
+
\ No newline at end of file