mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Merge pull request #1255 from caleb-allen/widget-tap-story
add touch intent to widget initialization instead of only refresh
This commit is contained in:
commit
1eff2f1e3b
1 changed files with 17 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
|||
package com.newsblur.widget;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -106,6 +108,7 @@ public class ConfigureWidgetActivity extends NbActivity {
|
|||
Intent intent = new Intent(this, BlurWidgetRemoteViewsService.class);
|
||||
// Add the app widget ID to the intent extras.
|
||||
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||
|
||||
PrefsUtils.setWidgetFeed(this, appWidgetId, selectedFeed.feedId, selectedFeed.title);
|
||||
|
||||
|
@ -113,6 +116,20 @@ public class ConfigureWidgetActivity extends NbActivity {
|
|||
rv.setRemoteAdapter(R.id.widget_list, intent);
|
||||
rv.setEmptyView(R.id.widget_list, R.id.empty_view);
|
||||
|
||||
|
||||
Intent touchIntent = new Intent(this, NewsBlurWidgetProvider.class);
|
||||
// Set the action for the intent.
|
||||
// When the user touches a particular view, it will have the effect of
|
||||
// broadcasting TOAST_ACTION.
|
||||
touchIntent.setAction(NewsBlurWidgetProvider.ACTION_OPEN_STORY);
|
||||
touchIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
|
||||
PendingIntent touchIntentTemplate = PendingIntent.getBroadcast(this, 0, touchIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
rv.setPendingIntentTemplate(R.id.widget_list, touchIntentTemplate);
|
||||
|
||||
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, rv);
|
||||
|
||||
Intent resultValue = new Intent();
|
||||
|
|
Loading…
Add table
Reference in a new issue