|
|
@@ -5,8 +5,13 @@ import android.appwidget.AppWidgetManager;
|
|
|
import android.appwidget.AppWidgetProvider;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
+import android.util.Log;
|
|
|
import android.widget.RemoteViews;
|
|
|
|
|
|
+import com.bumptech.glide.Glide;
|
|
|
+import com.bumptech.glide.request.RequestOptions;
|
|
|
+import com.bumptech.glide.request.target.AppWidgetTarget;
|
|
|
+
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.activity.MainActivity;
|
|
|
|
|
|
@@ -15,12 +20,28 @@ import kr.co.zumo.app.lifeplus.activity.MainActivity;
|
|
|
*/
|
|
|
public class LifeplusWidget extends AppWidgetProvider {
|
|
|
|
|
|
+ private static String REFRESH_CLICK = "refresh_click";
|
|
|
+
|
|
|
+
|
|
|
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
|
|
|
int appWidgetId) {
|
|
|
// Construct the RemoteViews object
|
|
|
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.lifeplus_widget);
|
|
|
- Intent main = new Intent(context, MainActivity.class);
|
|
|
- views.setOnClickPendingIntent(R.id.image_view_bi, PendingIntent.getActivity(context, 0, main, 0));
|
|
|
+
|
|
|
+ Intent mainIntent = new Intent(context, MainActivity.class);
|
|
|
+ views.setOnClickPendingIntent(R.id.image_view_bi, PendingIntent.getActivity(context, 0, mainIntent, 0));
|
|
|
+
|
|
|
+ views.setTextViewText(R.id.text_view_title, "test Title");
|
|
|
+ views.setTextViewText(R.id.text_view_sub_title, "test Sub Title");
|
|
|
+
|
|
|
+
|
|
|
+ AppWidgetTarget backgroundImage = new AppWidgetTarget(context, R.id.image_view_background, views, appWidgetId);
|
|
|
+
|
|
|
+ Glide.with(context)
|
|
|
+ .asBitmap()
|
|
|
+ .apply(new RequestOptions().centerCrop())
|
|
|
+ .load("http://210.216.157.64:38080/resources/contents/bucket/bg/img_bestbucket_1.jpg")
|
|
|
+ .into(backgroundImage);
|
|
|
|
|
|
appWidgetManager.updateAppWidget(appWidgetId, views);
|
|
|
|
|
|
@@ -30,6 +51,8 @@ public class LifeplusWidget extends AppWidgetProvider {
|
|
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
|
|
// There may be multiple widgets active, so update all of them
|
|
|
|
|
|
+ Log.e("APP# LifeplusWidget | onUpdate", "|" + appWidgetIds.length);
|
|
|
+
|
|
|
for (int appWidgetId : appWidgetIds) {
|
|
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
|
|
}
|