Example usage for android.content Intent CATEGORY_DEFAULT

List of usage examples for android.content Intent CATEGORY_DEFAULT

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_DEFAULT.

Prototype

String CATEGORY_DEFAULT

To view the source code for android.content Intent CATEGORY_DEFAULT.

Click Source Link

Document

Set if the activity should be an option for the default action (center press) to perform on a piece of data.

Usage

From source file:gov.wa.wsdot.android.wsdot.ui.FavoritesFragment.java

@Override
public void onResume() {
    super.onResume();

    // Ferries Route Schedules
    IntentFilter ferriesSchedulesFilter = new IntentFilter(
            "gov.wa.wsdot.android.wsdot.intent.action.FERRIES_SCHEDULES_RESPONSE");
    ferriesSchedulesFilter.addCategory(Intent.CATEGORY_DEFAULT);
    mFerriesSchedulesSyncReceiver = new FerriesSchedulesSyncReceiver();
    getActivity().registerReceiver(mFerriesSchedulesSyncReceiver, ferriesSchedulesFilter);

    // Mountain Passes
    IntentFilter mountainPassesFilter = new IntentFilter(
            "gov.wa.wsdot.android.wsdot.intent.action.MOUNTAIN_PASSES_RESPONSE");
    mountainPassesFilter.addCategory(Intent.CATEGORY_DEFAULT);
    mMountainPassesSyncReceiver = new MountainPassesSyncReceiver();
    getActivity().registerReceiver(mMountainPassesSyncReceiver, mountainPassesFilter);

    // Travel Times
    IntentFilter travelTimesfilter = new IntentFilter(
            "gov.wa.wsdot.android.wsdot.intent.action.TRAVEL_TIMES_RESPONSE");
    travelTimesfilter.addCategory(Intent.CATEGORY_DEFAULT);
    mTravelTimesSyncReceiver = new TravelTimesSyncReceiver();
    getActivity().registerReceiver(mTravelTimesSyncReceiver, travelTimesfilter);
}

From source file:com.kccomy.orgar.ui.note.NoteFragment.java

private void initPopupWindow() {
    View popupWindowView = getActivity().getLayoutInflater().inflate(R.layout.popup_window_share, null);

    //??/*from ww  w .j  a  v  a 2s  .c o  m*/
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.addCategory(Intent.CATEGORY_DEFAULT);
    shareIntent.setType("text/plain");

    PackageManager packageManager = getContext().getPackageManager();
    List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(shareIntent,
            PackageManager.GET_RESOLVED_FILTER);

    // RecyclerAdapter
    RecyclerView recyclerView = (RecyclerView) popupWindowView.findViewById(R.id.popup_widow_share_recycler);
    ShareAdapter shareAdapter = new ShareAdapter(packageManager);
    shareAdapter.setData(resolveInfos);
    shareAdapter.setAppIconClickListener(shareListener);

    recyclerView.setAdapter(shareAdapter);
    recyclerView
            .setLayoutManager(new GridLayoutManager(getContext(), 2, LinearLayoutManager.HORIZONTAL, false));

    // ?PopupWindow
    popupWindowView.setFocusable(true);
    popupWindowView.setFocusableInTouchMode(true);

    PopupWindow popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);

    popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));

    popupWindow.setAnimationStyle(R.style.anim_menu_bottombar);

    setWindowAlpha(0.5f);

    popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
        @Override
        public void onDismiss() {
            setWindowAlpha(1f);
        }
    });

    popupWindow.showAtLocation(getActivity().getLayoutInflater().inflate(R.layout.fragment_note, null),
            Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
}

From source file:com.rickendirk.rsgwijzigingen.MainFragment.java

public void registerReceiver() {
    IntentFilter filter = new IntentFilter(ZoekReceiver.ACTION_RESP);
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    receiver = new ZoekReceiver();
    getActivity().registerReceiver(receiver, filter);
}

From source file:com.krayzk9s.imgurholo.ui.MessagingFragment.java

private void selectItem(int position) {
    Intent intent = new Intent();
    JSONParcelable jsonParcelable = new JSONParcelable();
    jsonParcelable.setJSONObject(messageAdapter.getItem(position).getJSONObject());
    intent.putExtra("data", jsonParcelable);
    intent.setAction(ImgurHoloActivity.MESSAGE_INTENT);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    startActivity(intent);//from w  w w.ja v  a2  s. c o  m
}

From source file:monakhv.android.samlib.MainActivity.java

@Override
protected void onResume() {
    super.onResume();
    pane.openPane();/*from   www  .j ava 2s  . c o m*/
    IntentFilter updateFilter = new IntentFilter(UpdateActivityReceiver.ACTION_RESP);
    IntentFilter downloadFilter = new IntentFilter(DownloadReceiver.ACTION_RESP);

    updateFilter.addCategory(Intent.CATEGORY_DEFAULT);
    downloadFilter.addCategory(Intent.CATEGORY_DEFAULT);

    updateReceiver = new UpdateActivityReceiver();
    downloadReceiver = new DownloadReceiver();
    //getActionBarHelper().setRefreshActionItemState(refreshStatus);
    registerReceiver(updateReceiver, updateFilter);
    registerReceiver(downloadReceiver, downloadFilter);

}

From source file:org.familab.app.supportfiles.IntentIntegrator.java

/**
 * Initiates a scan only for a certain set of barcode types, given as strings corresponding
 * to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
 * like {@link #PRODUCT_CODE_TYPES} for example.
 *
 * @return the {@link android.app.AlertDialog} that was shown to the user prompting them to download the app
 *   if a prompt was needed, or null otherwise
 */// w w  w.j  a  va 2s  .c  om
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
    Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);

    // check which types of codes to scan for
    if (desiredBarcodeFormats != null) {
        // set the desired barcode types
        StringBuilder joinedByComma = new StringBuilder();
        for (String format : desiredBarcodeFormats) {
            if (joinedByComma.length() > 0) {
                joinedByComma.append(',');
            }
            joinedByComma.append(format);
        }
        intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
    }

    String targetAppPackage = findTargetAppPackage(intentScan);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intentScan.setPackage(targetAppPackage);
    intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intentScan);
    startActivityForResult(intentScan, REQUEST_CODE);
    return null;
}

From source file:com.android.audiorecorder.ui.ImageViewActvity.java

private void camera() {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction("com.dahuatech.application.dhcamera.INNER_START_CAMERA");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:com.sean.nanastudio.taoyuanstreetparking.MainActivity.java

public static void startInstalledAppDetailsActivity(final Activity context) {
    if (context == null) {
        return;/*from ww  w  .  ja  v a  2 s .c om*/
    }
    final Intent i = new Intent();
    i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setData(Uri.parse("package:" + context.getPackageName()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(i);
}

From source file:com.enstage.wibmo.sdk.inapp.InAppInitActivity.java

public static void startInAppFlowInApp(Activity activity, WPayInitRequest wPayInitRequest,
        WPayInitResponse wPayInitResponse) {
    Intent intent = new Intent(WibmoSDK.getWibmoIntentActionPackage() + ".InApp");
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.putExtra("WPayInitRequest", wPayInitRequest);
    intent.putExtra("WPayInitResponse", wPayInitResponse);

    /*/*from www.j ava 2 s  .c  o  m*/
    String targetAppPackage = WibmoSDK.getWibmoPackage();
    boolean flag = WibmoSDK.isPackageExisted(activity, targetAppPackage);
    if (flag==false) {
    WibmoSDK.showDownloadDialog(activity);
    }
    */
    if (readyPackage != null) {
        intent.setPackage(readyPackage);
    }

    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); //causes to iap to be cancelled when app returned by icon launch

    activity.startActivityForResult(intent, WibmoSDK.REQUEST_CODE_IAP_PAY);
}

From source file:com.tomclaw.appteka.main.view.AppsView.java

private void showActionDialog(final AppItem appItem) {
    ListAdapter menuAdapter = new MenuAdapter(getContext(), R.array.app_actions_titles,
            R.array.app_actions_icons);// w w  w.ja v a  2  s .co m
    new AlertDialog.Builder(getContext()).setAdapter(menuAdapter, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case 0: {
                FlurryAgent.logEvent("App menu: run");
                PackageManager packageManager = getContext().getPackageManager();
                Intent launchIntent = packageManager.getLaunchIntentForPackage(appItem.getPackageName());
                if (launchIntent == null) {
                    Snackbar.make(recyclerView, R.string.non_launchable_package, Snackbar.LENGTH_LONG).show();
                } else {
                    startActivity(launchIntent);
                }
                break;
            }
            case 1: {
                FlurryAgent.logEvent("App menu: share");
                TaskExecutor.getInstance()
                        .execute(new ExportApkTask(getContext(), appItem, ExportApkTask.ACTION_SHARE));
                break;
            }
            case 2: {
                FlurryAgent.logEvent("App menu: extract");
                TaskExecutor.getInstance()
                        .execute(new ExportApkTask(getContext(), appItem, ExportApkTask.ACTION_EXTRACT));
                break;
            }
            case 3: {
                FlurryAgent.logEvent("App menu: upload");
                Intent intent = new Intent(getContext(), UploadActivity.class);
                intent.putExtra(UploadActivity.UPLOAD_ITEM, appItem);
                startActivity(intent);
                break;
            }
            case 4: {
                FlurryAgent.logEvent("App menu: bluetooth");
                TaskExecutor.getInstance()
                        .execute(new ExportApkTask(getContext(), appItem, ExportApkTask.ACTION_BLUETOOTH));
                break;
            }
            case 5: {
                FlurryAgent.logEvent("App menu: Google Play");
                String packageName = appItem.getPackageName();
                openGooglePlay(getContext(), packageName);
                break;
            }
            case 6: {
                FlurryAgent.logEvent("App menu: permissions");
                try {
                    PackageInfo packageInfo = appItem.getPackageInfo();
                    List<String> permissions = Arrays.asList(packageInfo.requestedPermissions);
                    Intent intent = new Intent(getContext(), PermissionsActivity.class).putStringArrayListExtra(
                            PermissionsActivity.EXTRA_PERMISSIONS, new ArrayList<>(permissions));
                    startActivity(intent);
                } catch (Throwable ex) {
                    Snackbar.make(recyclerView, R.string.unable_to_get_permissions, Snackbar.LENGTH_LONG)
                            .show();
                }
                break;
            }
            case 7: {
                FlurryAgent.logEvent("App menu: details");
                setRefreshOnResume();
                final Intent intent = new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                        .addCategory(Intent.CATEGORY_DEFAULT)
                        .setData(Uri.parse("package:" + appItem.getPackageName()))
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                break;
            }
            case 8: {
                FlurryAgent.logEvent("App menu: remove");
                setRefreshOnResume();
                Uri packageUri = Uri.parse("package:" + appItem.getPackageName());
                Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);
                startActivity(uninstallIntent);
                break;
            }
            }
        }
    }).show();
}