use of android.content.ComponentName in project Launcher3 by chislon.
the class MemoryDumpActivity method startDump.
public static void startDump(final Context context, final Runnable andThen) {
final ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
Log.v(TAG, "service connected, dumping...");
dumpHprofAndShare(context, ((MemoryTracker.MemoryTrackerInterface) service).getService());
context.unbindService(this);
if (andThen != null)
andThen.run();
}
public void onServiceDisconnected(ComponentName className) {
}
};
Log.v(TAG, "attempting to bind to memory tracker");
context.bindService(new Intent(context, MemoryTracker.class), connection, Context.BIND_AUTO_CREATE);
}
use of android.content.ComponentName in project Launcher3 by chislon.
the class Workspace method updateShortcuts.
void updateShortcuts(ArrayList<AppInfo> apps) {
ArrayList<ShortcutAndWidgetContainer> childrenLayouts = getAllShortcutAndWidgetContainers();
for (ShortcutAndWidgetContainer layout : childrenLayouts) {
int childCount = layout.getChildCount();
for (int j = 0; j < childCount; j++) {
final View view = layout.getChildAt(j);
Object tag = view.getTag();
if (LauncherModel.isShortcutInfoUpdateable((ItemInfo) tag)) {
ShortcutInfo info = (ShortcutInfo) tag;
final Intent intent = info.intent;
final ComponentName name = intent.getComponent();
final int appCount = apps.size();
for (int k = 0; k < appCount; k++) {
AppInfo app = apps.get(k);
if (app.componentName.equals(name)) {
BubbleTextView shortcut = (BubbleTextView) view;
info.updateIcon(mIconCache);
info.title = app.title.toString();
shortcut.applyFromShortcutInfo(info, mIconCache);
}
}
}
}
}
}
use of android.content.ComponentName in project cw-omnibus by commonsguy.
the class Plugin method onReceive.
@Override
public void onReceive(Context ctxt, Intent i) {
if (ACTION_CALL_FOR_PLUGINS.equals(i.getAction())) {
Intent registration = new Intent(ACTION_REGISTER_PLUGIN);
registration.setPackage(HOST_PACKAGE);
registration.putExtra(EXTRA_COMPONENT, new ComponentName(ctxt, getClass()));
ctxt.sendBroadcast(registration);
} else if (ACTION_CALL_FOR_CONTENT.equals(i.getAction())) {
RemoteViews rv = new RemoteViews(ctxt.getPackageName(), R.layout.plugin);
Intent update = new Intent(ACTION_DELIVER_CONTENT);
update.setPackage(HOST_PACKAGE);
update.putExtra(EXTRA_CONTENT, rv);
ctxt.sendBroadcast(update);
}
}
use of android.content.ComponentName in project cw-omnibus by commonsguy.
the class EventDemoActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
getFragmentManager().beginTransaction().add(android.R.id.content, new EventLogFragment()).commit();
JobScheduler jobs = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
ComponentName cn = new ComponentName(this, ScheduledService.class);
JobInfo.Builder b = new JobInfo.Builder(JOB_ID, cn).setRequiredNetworkType(JobInfo.NETWORK_TYPE_NONE).setPeriodic(60000).setPersisted(false).setRequiresCharging(false).setRequiresDeviceIdle(false);
jobs.schedule(b.build());
}
}
use of android.content.ComponentName in project Launcher3 by chislon.
the class LauncherTransitionable method updateVoiceSearchIcon.
protected boolean updateVoiceSearchIcon(boolean searchVisible) {
final View voiceButtonContainer = findViewById(R.id.voice_button_container);
final View voiceButton = findViewById(R.id.voice_button);
// We only show/update the voice search icon if the search icon is enabled as well
final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
ComponentName activityName = null;
if (globalSearchActivity != null) {
// Check if the global search activity handles voice search
Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
intent.setPackage(globalSearchActivity.getPackageName());
activityName = intent.resolveActivity(getPackageManager());
}
if (activityName == null) {
// Fallback: check if an activity other than the global search activity
// resolves this
Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
activityName = intent.resolveActivity(getPackageManager());
}
if (searchVisible && activityName != null) {
int coi = getCurrentOrientationIndexForGlobalIcons();
sVoiceSearchIcon[coi] = updateButtonWithIconFromExternalActivity(R.id.voice_button, activityName, R.drawable.ic_home_voice_search_holo, TOOLBAR_VOICE_SEARCH_ICON_METADATA_NAME);
if (sVoiceSearchIcon[coi] == null) {
sVoiceSearchIcon[coi] = updateButtonWithIconFromExternalActivity(R.id.voice_button, activityName, R.drawable.ic_home_voice_search_holo, TOOLBAR_ICON_METADATA_NAME);
}
if (voiceButtonContainer != null)
voiceButtonContainer.setVisibility(View.VISIBLE);
voiceButton.setVisibility(View.VISIBLE);
updateVoiceButtonProxyVisible(false);
invalidatePressedFocusedStates(voiceButtonContainer, voiceButton);
return true;
} else {
if (voiceButtonContainer != null)
voiceButtonContainer.setVisibility(View.GONE);
if (voiceButton != null)
voiceButton.setVisibility(View.GONE);
updateVoiceButtonProxyVisible(false);
return false;
}
}
Aggregations