当前位置: 首页>>代码示例>>Java>>正文


Java ClipDescription.MIMETYPE_TEXT_PLAIN属性代码示例

本文整理汇总了Java中android.content.ClipDescription.MIMETYPE_TEXT_PLAIN属性的典型用法代码示例。如果您正苦于以下问题:Java ClipDescription.MIMETYPE_TEXT_PLAIN属性的具体用法?Java ClipDescription.MIMETYPE_TEXT_PLAIN怎么用?Java ClipDescription.MIMETYPE_TEXT_PLAIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.content.ClipDescription的用法示例。


在下文中一共展示了ClipDescription.MIMETYPE_TEXT_PLAIN属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLongClick

@Override
public boolean onLongClick(View v) {
    ClipData.Item item = new ClipData.Item("" + v.getTag());
    ClipData dragData = new ClipData("" + v.getTag(), new String[] {ClipDescription.MIMETYPE_TEXT_PLAIN},item);

    View.DragShadowBuilder myShadow = new MyDragShadowBuilder(v);

    showDragBuide();
    v.startDrag(dragData,  // the data to be dragged
            myShadow,  // the drag shadow builder
            null,      // no need to use local data
            0          // flags (not currently used, set to 0)
    );
    v.setAlpha(0.2f);
    return true;
}
 
开发者ID:monthlypub,项目名称:SmingZZick_App,代码行数:16,代码来源:StickerApplyAdapter.java

示例2: startDrag

/**
 * 开始拖拽
 *
 * @param v 当前对象
 */
private void startDrag(View v) {
    // 选项内容
    String optionContent = ((Button) v).getText().toString();
    // 记录当前答案选项的位置
    optionPosition = getOptionPosition(optionContent);
    // 开始拖拽后在列表中隐藏答案选项
    v.setVisibility(INVISIBLE);

    ClipData.Item item = new ClipData.Item(optionContent);
    ClipData data = new ClipData(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}, item);
    v.startDrag(data, new DragShadowBuilder(v), null, 0);
}
 
开发者ID:alidili,项目名称:Demos,代码行数:17,代码来源:DragFillBlankView.java

示例3: onItemLongClick

@Override
public boolean onItemLongClick(AdapterView<?> arg0, View childView,
		int position, long id) {
	
	Person person = controller.getPersonAt(position);

	String text = person.toString();
	ClipData.Item item = new ClipData.Item(text);
	String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
	ClipData data = new ClipData(text, mimeTypes, item);
	DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(childView);

	childView.startDrag(data, shadowBuilder, childView, 0);
	childView.setVisibility(View.INVISIBLE);
	filter.setVisibility(View.GONE);

	buttonBarDropTarget.setVisibility(View.VISIBLE);
	return true;
}
 
开发者ID:markuskreth,项目名称:ClubHelperAndroid,代码行数:19,代码来源:PersonListFragment.java

示例4: onLongClick

@Override
public boolean onLongClick(View v) {
	Object tag = v.getTag();
	long contactId = (Long) tag;
	PersonContact contact = controller.findContactWithId(contactId);
	String text = contact.getType() + " - " + contact.getValue();
	ClipData.Item item = new ClipData.Item(text);
	String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN };
	ClipData data = new ClipData(text, mimeTypes, item);
	DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);

	v.startDrag(data, shadowBuilder, v, 0);
	v.setVisibility(View.INVISIBLE);

	buttonBarMain.setVisibility(View.GONE);
	buttonBarDropContact.setVisibility(View.VISIBLE);
	txtFullNameView.setEnabled(false);
	return true;
}
 
开发者ID:markuskreth,项目名称:ClubHelperAndroid,代码行数:19,代码来源:PersonDetailFragment.java

示例5: onMenuItemLongClick

protected boolean onMenuItemLongClick(AdapterView<?> parent, View view, int position) {
    String packageName = ((ListViewMenuItem) parent.getAdapter()
            .getItem(position)).getPackageName();
    ClipData.Item clipIconType = new ClipData.Item(Desktop.sListViewMenuIcon);
    ClipData.Item clipPackageName = new ClipData.Item(packageName);
    String[] clipDescription = { ClipDescription.MIMETYPE_TEXT_PLAIN };
    ClipData dragData = new ClipData("", clipDescription, clipIconType);
    dragData.addItem(clipPackageName);

    ImageView dragIcon = (ImageView) view.findViewById(R.id.icon);
    ListViewMenuItemDSB shadowBuilder = new ListViewMenuItemDSB(dragIcon,
            mDragShadowSize, mDragShadowSize);
    view.startDrag(dragData, shadowBuilder, view, 0);

    return true;
}
 
开发者ID:tieto,项目名称:desktop_for_android,代码行数:16,代码来源:ListViewMenu.java

示例6: onLongClick

@Override
public boolean onLongClick(View view) {

    ClipData.Item item = new ClipData.Item((CharSequence) view.getTag());

    String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
    ClipData data = new ClipData(view.getTag().toString(), mimeTypes, item);
    View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);

    view.startDrag(data, shadowBuilder, view, 0);
    view.setVisibility(View.INVISIBLE);
    return false;
}
 
开发者ID:delizondo,项目名称:CursoAndroid,代码行数:13,代码来源:AnimationsActivity.java

示例7: onTouch

@OnTouch(R.id.iv_icon)
public boolean onTouch(View v) {
    ClipData.Item item = new ClipData.Item("我来了");
    ClipData data = new ClipData(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}, item);
    v.startDrag(data, new View.DragShadowBuilder(v), null, 0);
    return true;
}
 
开发者ID:alidili,项目名称:TestDemo,代码行数:7,代码来源:DragActivity.java

示例8: copyToClipboard

private void copyToClipboard(String text, String label) {
    ClipData.Item item = new ClipData.Item(text);
    String[] mimeType = new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN};
    ClipData clipData = new ClipData(new ClipDescription(label, mimeType), item);
    ClipboardManager clipboardManager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    clipboardManager.setPrimaryClip(clipData);
}
 
开发者ID:ichigotake,项目名称:Pyazing,代码行数:7,代码来源:CopyToClipboardService.java

示例9: getMimeType

@Nullable
public static String getMimeType(@NonNull final NdefRecord record) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        return getMimeTypeV16(record);
    }

    /*
     * The below section
     * Copyright (C) 2010 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    switch (record.getTnf()) {
        case NdefRecord.TNF_WELL_KNOWN:
            if (Arrays.equals(record.getType(), NdefRecord.RTD_TEXT)) {
                return ClipDescription.MIMETYPE_TEXT_PLAIN;
            }
            break;
        case NdefRecord.TNF_MIME_MEDIA:
            final String mimeType = new String(record.getType(), StandardCharsets.US_ASCII);
            return Intent.normalizeMimeType(mimeType);
    }
    return null;
}
 
开发者ID:xxv,项目名称:SuperGenPass,代码行数:34,代码来源:NdefUtils.java

示例10: handleNfcIntent

/**
 * Call this from {@link android.app.Activity#onNewIntent(Intent)} to handle NFC intents.
 *
 * @param intent the intent delivered from Android
 */
public void handleNfcIntent(@NonNull final Intent intent) {
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
        final Parcelable[] messages =
                intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);

        if (messages != null && messages.length > 0) {
            for (final Parcelable messageParcelable : messages) {
                for (final NdefRecord record : ((NdefMessage) messageParcelable).getRecords()) {
                    final String type = NdefUtils.getMimeType(record);

                    if (type == null) {
                        return;
                    }

                    switch (type) {
                        case ClipDescription.MIMETYPE_TEXT_PLAIN:
                            onNfcPasswordTag(NdefUtils.decodeNdefText(record));
                            break;
                        case NdefUtils.SGP_NFC_MIME_TYPE:
                            onNfcPasswordTag(NdefUtils.fromNdefRecord(record));
                            break;
                        default:
                            throw new IllegalArgumentException("Unhandled NFC content type");
                    }
                }
            }
        }
    }
}
 
开发者ID:xxv,项目名称:SuperGenPass,代码行数:34,代码来源:NfcFragment.java

示例11: RoomMediaMessage

/**
 * Constructor for a text message.
 *
 * @param text     the text
 * @param htmlText the HTML text
 * @param format   the formatted text format
 */
public RoomMediaMessage(CharSequence text, String htmlText, String format) {
    mClipDataItem = new ClipData.Item(text, htmlText);
    mMimeType = (null == htmlText) ? ClipDescription.MIMETYPE_TEXT_PLAIN : format;
}
 
开发者ID:matrix-org,项目名称:matrix-android-sdk,代码行数:11,代码来源:RoomMediaMessage.java


注:本文中的android.content.ClipDescription.MIMETYPE_TEXT_PLAIN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。