Example usage for android.content ComponentName flattenToString

List of usage examples for android.content ComponentName flattenToString

Introduction

In this page you can find the example usage for android.content ComponentName flattenToString.

Prototype

public @NonNull String flattenToString() 

Source Link

Document

Return a String that unambiguously describes both the package and class names contained in the ComponentName.

Usage

From source file:Main.java

/**
 * Creates the configuration intent./*from w w  w.ja  v  a  2  s . c  om*/
 * 
 * @param component
 *            the component
 * @param type
 *            the type
 * 
 * @return the intent
 */
public static Intent createConfigurationIntent(ComponentName component, String type) {
    return new Intent(CONFIGURE_ACTION).addCategory(component.getClassName())
            .putExtra(SERVICE_KEY, component.flattenToString()).putExtra(TYPE_KEY, type);
}

From source file:Main.java

/**
 * Creates the lobby intent./*from w w  w  .  j  av  a2  s .  com*/
 * 
 * @param service
 *            the service
 * @param session
 *            the session
 * @param type
 *            the type
 * @param layout
 *            the layout
 * 
 * @return the intent
 */
public static Intent createLobbyIntent(ComponentName service, int session, String type, int layout) {
    return new Intent(LOBBY_ACTION).putExtra(SESSION_ID_KEY, session).setType(type)
            .putExtra(SERVICE_KEY, service.flattenToString()).putExtra(BOARD_LAYOUT_ID_KEY, layout);
}

From source file:Main.java

public static String getVoiceSearchIMId(Context context) {
    ComponentName voiceInputComponent = new ComponentName("com.google.android.voicesearch",
            "com.google.android.voicesearch.ime.VoceInputMethdServce");
    if (DEBUG)// ww w  .j  av a  2 s. c o  m
        Log.i(TAG, "getVoiceSearchIMId(), Comonent name = " + voiceInputComponent.flattenToString() + ", id = "
                + voiceInputComponent.flattenToShortString());
    return voiceInputComponent.flattenToShortString();
}

From source file:Main.java

/**
 * Creates the in game intent.//from  w ww .j a va 2  s.  co  m
 * 
 * @param service
 *            the service
 * @param session
 *            the session
 * @param gameId
 *            the game id
 * @param type
 *            the type
 * @param layout
 *            the layout
 * @param player
 *            the player
 * 
 * @return the intent
 */
public static Intent createInGameIntent(ComponentName service, int session, int gameId, String type, int layout,
        byte player) {
    return new Intent(IN_GAME_ACTION).putExtra(GAME_ID_KEY, gameId).putExtra(SESSION_ID_KEY, session)
            .setType(type).putExtra(SERVICE_KEY, service.flattenToString())
            .putExtra(BOARD_LAYOUT_ID_KEY, layout).putExtra(PLAYER_KEY, player);
}

From source file:org.opensilk.music.ui2.loader.PluginLoader.java

public void writeDisabledPlugins(List<ComponentName> plugins) {
    StringWriter sw = new StringWriter(100);
    JsonWriter jw = new JsonWriter(sw);
    try {/*  ww  w  .ja  va  2 s  . c  o  m*/
        jw.beginArray();
        for (ComponentName cn : plugins) {
            jw.value(cn.flattenToString());
        }
        jw.endArray();
        Timber.v("Write disabled plugins=" + sw.toString());
        settings.putString(PREF_DISABLED_PLUGINS, sw.toString());
    } catch (IOException e) {
        settings.remove(PREF_DISABLED_PLUGINS);
    } finally {
        IOUtils.closeQuietly(jw);
    }
}

From source file:arun.com.chromer.settings.widgets.AppPreferenceCardView.java

public void updatePreference(@Nullable final ComponentName componentName) {
    final String flatComponent = componentName == null ? null : componentName.flattenToString();
    switch (preferenceType) {
    case CUSTOM_TAB_PROVIDER:
        if (componentName != null) {
            Preferences.get(getContext()).customTabPackage(componentName.getPackageName());
        }//from   ww w  . j  av a2  s . c  o m
        break;
    case SECONDARY_BROWSER:
        Preferences.get(getContext()).secondaryBrowserComponent(flatComponent);
        break;
    case FAVORITE_SHARE:
        Preferences.get(getContext()).favShareComponent(flatComponent);
        break;
    }
    refreshState();
}

From source file:org.envirocar.app.application.service.DeviceInRangeService.java

private void bindToBackgroundService() {
    if (!bindService(new Intent(this, BackgroundServiceImpl.class), new ServiceConnection() {

        @Override//from  ww  w  .jav a2  s. co m
        public void onServiceDisconnected(ComponentName name) {
            logger.info(String.format("BackgroundService %S disconnected!", name.flattenToString()));
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            backgroundService = (BackgroundServiceInteractor) service;
        }
    }, 0)) {
        logger.warn("Could not connect to BackgroundService.");
    }
}

From source file:com.androidzeitgeist.dashwatch.dashclock.ExtensionManager.java

private void destroyExtensionData(ComponentName componentName) {
    mValuesPreferences.edit().remove(componentName.flattenToString()).commit();
}

From source file:com.google.android.apps.dashclock.ExtensionManager.java

private void destroyExtensionData(ComponentName componentName) {
    mValuesPreferences.edit().remove(componentName.flattenToString()).apply();
}

From source file:com.androidzeitgeist.dashwatch.dashclock.ExtensionManager.java

private void serializeExtensionData(ComponentName componentName, ExtensionData extensionData) {
    try {/* ww  w . j a  va  2 s  . c om*/
        mValuesPreferences.edit()
                .putString(componentName.flattenToString(), extensionData.serialize().toString()).commit();
    } catch (JSONException e) {
        Log.e(TAG, "Error storing extension data cache for " + componentName + ".", e);
    }
}