當前位置: 首頁>>代碼示例>>Java>>正文


Java RemoteViews.setOnClickFillInIntent方法代碼示例

本文整理匯總了Java中android.widget.RemoteViews.setOnClickFillInIntent方法的典型用法代碼示例。如果您正苦於以下問題:Java RemoteViews.setOnClickFillInIntent方法的具體用法?Java RemoteViews.setOnClickFillInIntent怎麽用?Java RemoteViews.setOnClickFillInIntent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.RemoteViews的用法示例。


在下文中一共展示了RemoteViews.setOnClickFillInIntent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    Log.v(TAG, "getViewAt: position = " + position);

    // Construct a remote views item based on the app widget item XML file,
    // and set the text based on the position.
    RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_list_item);
    Intent fillInIntent = new Intent();
    fillInIntent.putExtra(EXTRA_LIST_VIEW_ROW_NUMBER, position);
    rv.setOnClickFillInIntent(R.id.main_list_item, fillInIntent);

    rv.setTextViewText(R.id.w_author_name, widgetDatas.get(position).getAuthorName());
    rv.setTextViewText(R.id.w_title, widgetDatas.get(position).getTitle());
    Picasso pic = Picasso.with(context);
    try {
        Bitmap map = pic.load(widgetDatas.get(position).getAvatar()).get();
        rv.setImageViewBitmap(R.id.w_github_user_image, map);
    } catch (IOException e) {
        Log.e(TAG, "", e);
    }
    return rv;
}
 
開發者ID:OlgaKuklina,項目名稱:GitJourney,代碼行數:23,代碼來源:StackWidgetService.java

示例2: loadItemOnClickExtras

import android.widget.RemoteViews; //導入方法依賴的package包/類
/**
  * Item設置點擊事件
  * @param rv
  * @param position
  */
 private void loadItemOnClickExtras(RemoteViews rv, int position) {
     /*
      * 為每一個item都設置pendingIntent是很繁瑣的,需要很多很多的pendingIntent,因此不允許這樣做。
* 之前在provider,通過setPendingIntentTemplate()我們已經為整個remote
* list統一設置了item點擊觸發的 pendingintent模板。
* setOnClickFillInIntent()在模板的基礎上為具體的item設置fillInIntent,
* fillInIntent會加入到PendingIntent模板中。
* 每個item觸發,相同的部分在模板,不同的部分在fillInIntent
*/
     Logger.INSTANCE.i(" --> loadItemOnClickExtras");
     Intent intent = new Intent();
     intent.putExtra(AppWidgetNotesProvider.Companion.getNOTES_ITEM_CLICK_ACTION(),
              position);
     rv.setOnClickFillInIntent(R.id.ic_notes_item_ll, intent);
 }
 
開發者ID:lpy19930103,項目名稱:MinimalismJotter,代碼行數:21,代碼來源:NotesRemoteViewsFactory.java

示例3: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews row=new RemoteViews(ctxt.getPackageName(),
            R.layout.widget_tasklist_row);

    Log.d("taskViewsFactory","getViewAt called, data: "+mainList.get(position).getTask()+" "+row+" "+R.id.textView);

    row.setTextViewText(R.id.textView, mainList.get(position).getTask());

    Intent i=new Intent();
    Bundle extras=new Bundle();

    extras.putString(WidgetHandler.EXTRA_WORD, mainList.get(position).getTask());
    i.putExtras(extras);
    row.setOnClickFillInIntent(R.id.textView, i);

    return(row);
}
 
開發者ID:kartik2112,項目名稱:TDList,代碼行數:19,代碼來源:TaskViewsFactory.java

示例4: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.message_list_widget_list_item);
    MailItem item = mailItems.get(position);

    CharSequence sender = item.unread ? bold(item.sender) : item.sender;
    CharSequence subject = item.unread ? bold(item.subject) : item.subject;

    if (senderAboveSubject) {
        remoteView.setTextViewText(R.id.sender, sender);
        remoteView.setTextViewText(R.id.mail_subject, subject);
    } else {
        remoteView.setTextViewText(R.id.sender, subject);
        remoteView.setTextViewText(R.id.mail_subject, sender);
    }
    remoteView.setTextViewText(R.id.mail_date, item.getDateFormatted("%d %s"));
    remoteView.setTextViewText(R.id.mail_preview, item.preview);

    int textColor = item.getTextColor();
    remoteView.setTextColor(R.id.sender, textColor);
    remoteView.setTextColor(R.id.mail_subject, textColor);
    remoteView.setTextColor(R.id.mail_date, textColor);
    remoteView.setTextColor(R.id.mail_preview, textColor);

    if (item.hasAttachment) {
        remoteView.setInt(R.id.attachment, "setVisibility", View.VISIBLE);
    } else {
        remoteView.setInt(R.id.attachment, "setVisibility", View.GONE);
    }

    Intent intent = new Intent();
    intent.setData(item.uri);
    remoteView.setOnClickFillInIntent(R.id.mail_list_item, intent);
    return remoteView;
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:36,代碼來源:MessageListRemoteViewFactory.java

示例5: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
public RemoteViews getViewAt(int position) {

        File file = new File(Environment.getExternalStoragePublicDirectory("/"+mContext.getResources().getString(R.string.app_name)), mWidgetItems.get(position).getId() +mContext.getResources().getString(R.string.jpg) );

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        Bitmap bitmap = BitmapFactory.decodeFile(file.getPath(), options);
        RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
        rv.setImageViewBitmap(R.id.widget_item,Bitmap.createScaledBitmap(bitmap, 450,300, false));
        Bundle extras = new Bundle();
        extras.putInt(StackWidgetProvider.EXTRA_ITEM, position);
        Intent fillInIntent = new Intent();
        fillInIntent.putExtras(extras);
        rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);


        try {
            System.out.println(mContext.getResources().getString(R.string.Loading_view) + position);
            Thread.sleep(500);
        } catch (InterruptedException e) {
            MyApplication.getInstance().trackException(e);

            e.printStackTrace();
        }


        return rv;
    }
 
開發者ID:MuditSrivastava,項目名稱:Canvas-Vision,代碼行數:29,代碼來源:StackWidgetService.java

示例6: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews remoteViews = new RemoteViews(
            context.getPackageName(), R.layout.item_package_for_widget);

    Realm rlm = Realm.getInstance(new RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .name(DATABASE_NAME)
            .build());
    List<Package> results = rlm.copyFromRealm(rlm.where(Package.class)
            .notEqualTo("state", String.valueOf(Package.STATUS_DELIVERED))
            .findAllSorted("timestamp", Sort.DESCENDING));

    Package p = results.get(position);

    if (p.getData() != null && p.getData().size() > 0) {
        int state = Integer.parseInt(p.getState());
        remoteViews.setTextViewText(R.id.textViewStatus,
                String.valueOf(packageStatus[state]) + " - " + p.getData().get(0).getContext());
        remoteViews.setTextViewText(R.id.textViewTime, p.getData().get(0).getTime());
    } else {
        remoteViews.setTextViewText(R.id.textViewTime, "");
        remoteViews.setTextViewText(R.id.textViewStatus, statusError);
    }

    remoteViews.setTextViewText(R.id.textViewPackageName, p.getName());
    remoteViews.setTextViewText(R.id.textViewAvatar, p.getName().substring(0, 1));
    remoteViews.setImageViewResource(R.id.imageViewAvatar, p.getColorAvatar());

    Intent intent = new Intent();
    intent.putExtra(PackageDetailsActivity.PACKAGE_ID, p.getNumber());
    remoteViews.setOnClickFillInIntent(R.id.layoutPackageItemMain, intent);

    return remoteViews;
}
 
開發者ID:TonnyL,項目名稱:Espresso,代碼行數:36,代碼來源:WidgetListFactory.java

示例7: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews rowView = new RemoteViews(_context.getPackageName(), R.layout.widget_file_item);
    rowView.setTextViewText(R.id.widget_note_title, "???");
    if (position < _widgetFilesList.length) {
        File file = _widgetFilesList[position];
        Intent fillInIntent = new Intent().putExtra(DocumentIO.EXTRA_PATH, file);
        rowView.setTextViewText(R.id.widget_note_title, MarkdownTextConverter.MD_EXTENSION_PATTERN.matcher(file.getName()).replaceAll(""));
        rowView.setOnClickFillInIntent(R.id.widget_note_title, fillInIntent);
    }
    return rowView;
}
 
開發者ID:gsantner,項目名稱:markor,代碼行數:13,代碼來源:FilesWidgetFactory.java

示例8: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews remoteViews = new RemoteViews(mContext.getPackageName(), R.layout.queue_widget_listview_layout);
    if (position <= getCount()) {

        String songTitle = songs.get(position)._title;

        ImageSize imageSize = new ImageSize(75, 75);

        long songDurationInMillis = 0;
        try {
            songDurationInMillis = songs.get(position)._duration;
        } catch (Exception e) {
        }

        remoteViews.setTextViewText(R.id.listViewSubText, songTitle);
        remoteViews.setTextViewText(R.id.listViewRightSubText, MusicUtils.convertMillisToMinsSecs(songDurationInMillis));


        Bitmap bitmap = ImageLoader.getInstance().loadImageSync(String.valueOf(MusicUtils.getAlbumArtUri(mApp.getService().getSongList().get(position)._albumId)), imageSize);
        if (bitmap != null) {
            remoteViews.setImageViewBitmap(R.id.listViewLeftIcon, bitmap);
        } else {
            remoteViews.setImageViewResource(R.id.listViewLeftIcon, R.mipmap.ic_launcher);
        }

    }


  /* This intent latches itself onto the pendingIntentTemplate from
 * LargeWidgetProvider.java and adds the extra "INDEX" argument to it. */
    Intent fillInIntent = new Intent();
    fillInIntent.putExtra("INDEX", position);
    remoteViews.setOnClickFillInIntent(R.id.listViewParent, fillInIntent);

    return remoteViews;
}
 
開發者ID:reyanshmishra,項目名稱:Rey-MusicPlayer,代碼行數:38,代碼來源:QueueWidgetService.java

示例9: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews remoteViews = new RemoteViews(applicationContext.getPackageName(),
            R.layout.ingredients_widget_list_item);

    remoteViews.setTextViewText(R.id.ingredient_list_item_text_view,
            ingredientsDescription.get(position));

    Intent fillIntent = new Intent();
    remoteViews.setOnClickFillInIntent(R.id.ingredient_list_item_text_view, fillIntent);

    return remoteViews;
}
 
開發者ID:ecarrara-araujo,項目名稱:yabaking,代碼行數:14,代碼來源:RemoteIngredientsListViewsFactory.java

示例10: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, "getViewAt", position);

    Note note = null;
    if (mCursor.moveToPosition(position)) {
        note = NotesClient.fromCursor(mCursor);
    }

    RemoteViews row = new RemoteViews(mContext.getPackageName(), R.layout.item_list_widget);

    if (note != null) {
        setContent(row, note);

        final Intent openIntent = new Intent();
        openIntent.putExtra(AppIntent.EXTRA_CLICK_TYPE, ListWidgetProvider.OPEN_CLICK_TYPE);
        openIntent.putExtra(AppIntent.EXTRA_NOTE_ID, note.getId());
        openIntent.putExtra(AppIntent.EXTRA_BOOK_ID, note.getPosition().getBookId());
        row.setOnClickFillInIntent(R.id.item_list_widget_layout, openIntent);

        final Intent doneIntent = new Intent();
        doneIntent.putExtra(AppIntent.EXTRA_CLICK_TYPE, ListWidgetProvider.DONE_CLICK_TYPE);
        doneIntent.putExtra(AppIntent.EXTRA_NOTE_ID, note.getId());
        row.setOnClickFillInIntent(R.id.item_list_widget_done, doneIntent);
    }

    return row;
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:29,代碼來源:ListWidgetViewsFactory.java

示例11: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews row = new RemoteViews(mContext.getPackageName(), R.layout.widget_profile_item);

    row.setTextViewText(R.id.text, mItems.get(position).getName());

    Intent i = new Intent();
    Bundle extras = new Bundle();

    extras.putInt(ITEM_ARG, position);
    i.putExtras(extras);
    row.setOnClickFillInIntent(R.id.text, i);

    return (row);
}
 
開發者ID:morogoku,項目名稱:MTweaks-KernelAdiutorMOD,代碼行數:16,代碼來源:Widget.java

示例12: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
    public RemoteViews getViewAt(int position) {
        RemoteViews remoteView = new RemoteViews(mContext.getPackageName(), R.layout.desktop_widget_item);
        Schedule item = mData.get(position);
        remoteView.setTextViewText(R.id.widget_item_name, item.getName());
        remoteView.setTextViewText(R.id.widget_item_time, item.getStartSec()+"-"+item.getEndSec());
        remoteView.setTextViewText(R.id.widget_item_location, item.getLocation());

//        item點擊事件調到app,setOnClickFillInIntent的第一個id為item布局的根布局,需要先在CourseAppWidgetProvider調用了setPendingIntentTemplate才生效
        Intent intent = new Intent(mContext, MainActivity.class);
        remoteView.setOnClickFillInIntent(R.id.desktop_widget_layout_item, intent);
        return remoteView;
    }
 
開發者ID:WeGdufe,項目名稱:MovingGdufe-Android,代碼行數:14,代碼來源:WidgetListProviderFactory.java

示例13: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
public RemoteViews getViewAt(int position) {
    // position will always range from 0 to getCount() - 1.

    // We construct a remote views item based on our widget item xml file, and set the
    // text based on the position.
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
    rv.setTextViewText(R.id.widget_item, mWidgetItems.get(position).text);

    // Next, we set a fill-intent which will be used to fill-in the pending intent template
    // which is set on the collection view in StackWidgetProvider.
    Bundle extras = new Bundle();
    extras.putInt(StackWidgetProvider.EXTRA_ITEM, position);
    Intent fillInIntent = new Intent();
    fillInIntent.putExtras(extras);
    rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);

    // You can do heaving lifting in here, synchronously. For example, if you need to
    // process an image, fetch something from the network, etc., it is ok to do it here,
    // synchronously. A loading view will show up in lieu of the actual contents in the
    // interim.
    try {
        System.out.println("Loading view " + position);
        Thread.sleep(500);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    // Return the remote views object.
    return rv;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:31,代碼來源:StackWidgetService.java

示例14: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
public RemoteViews getViewAt(int position) {
    // Get the data for this position from the content provider
    String day = "Unknown Day";
    int temp = 0;
    if (mCursor.moveToPosition(position)) {
        final int dayColIndex = mCursor.getColumnIndex(WeatherDataProvider.Columns.DAY);
        final int tempColIndex = mCursor.getColumnIndex(
                WeatherDataProvider.Columns.TEMPERATURE);
        day = mCursor.getString(dayColIndex);
        temp = mCursor.getInt(tempColIndex);
    }

    // Return a proper item with the proper day and temperature
    final String formatStr = mContext.getResources().getString(R.string.item_format_string);
    final int itemId = R.layout.widget_item;
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId);
    rv.setTextViewText(R.id.widget_item, String.format(formatStr, temp, day));

    // Set the click intent so that we can handle it and show a toast message
    final Intent fillInIntent = new Intent();
    final Bundle extras = new Bundle();
    extras.putString(WeatherWidgetProvider.EXTRA_DAY_ID, day);
    fillInIntent.putExtras(extras);
    rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);

    return rv;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:28,代碼來源:WeatherWidgetService.java

示例15: getViewAt

import android.widget.RemoteViews; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
    if (position < mItems.size()) {
        String category = mItems.get(position).getCategory();
        if (category == null || category.equals("")) {
            rv.setTextViewText(R.id.category, getString(R.string.edit_category_empty));
        } else {
            rv.setTextViewText(R.id.category, category);
        }
        String type = mItems.get(position).getType();
        if (type == null || type.equals("")) {
            rv.setTextViewText(R.id.type, getString(R.string.edit_type_empty));
        } else {
            rv.setTextViewText(R.id.type, type);
        }
        String colour = mItems.get(position).getMainColour();
        if (colour == null || colour.equals("")) {
            rv.setTextViewText(R.id.colour, getString(R.string.edit_main_colour_empty));
        } else {
            rv.setTextViewText(R.id.colour, colour);
        }
        long expiry = mItems.get(position).getExpiry();
        if (expiry == -1) {
            setTextColourPrimary(rv);
            rv.setTextViewText(R.id.expiry, getString(R.string.edit_expiry_date_empty));
        } else {
            Calendar expiryDate = Calendar.getInstance();
            expiryDate.setTimeInMillis(expiry);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(getString(
                    R.string.edit_date_format),
                    Locale.ENGLISH);
            String expiryString = simpleDateFormat.format(expiryDate.getTime());
            rv.setTextViewText(R.id.expiry, expiryString);
            Calendar almostExpiredDate = Calendar.getInstance();
            almostExpiredDate.add(Calendar.MONTH, 1);
            if (expiryDate.compareTo(Calendar.getInstance()) < 1) {
                rv.setInt(R.id.expiry, "setTextColor", ContextCompat.getColor(mContext,
                        R.color.red));
            } else if (expiryDate.compareTo(almostExpiredDate) < 1) {
                rv.setInt(R.id.expiry, "setTextColor", ContextCompat.getColor(mContext,
                        R.color.orange));
            } else {
                setTextColourPrimary(rv);
            }
        }
        int price = mItems.get(position).getPricePaid();
        String priceString;
        if (price == -1) {
            priceString = getString(R.string.edit_price_paid_empty);
        } else {
            priceString = getString(R.string.edit_price_paid_prefix)
                    + getPriceFromTotalCents(price);
        }
        rv.setTextViewText(R.id.paid, priceString);

        Intent fillInIntent = new Intent();
        fillInIntent.putExtra(EXTRA_ITEM_ID, mItems.get(position).getId());
        rv.setOnClickFillInIntent(R.id.widget_item, fillInIntent);
    }
    return rv;
}
 
開發者ID:mvescovo,項目名稱:item-reaper,代碼行數:63,代碼來源:WidgetListService.java


注:本文中的android.widget.RemoteViews.setOnClickFillInIntent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。