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


Java ComponentName.getClassName方法代碼示例

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


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

示例1: schedule

import android.content.ComponentName; //導入方法依賴的package包/類
@Override
public int schedule(JobInfo job) throws RemoteException {
    int vuid = VBinder.getCallingUid();
    int id = job.getId();
    ComponentName service = job.getService();
    JobId jobId = new JobId(vuid, service.getPackageName(), id);
    JobConfig config = mJobStore.get(jobId);
    if (config == null) {
        config = new JobConfig(mGlobalJobId++, service.getClassName(), job.getExtras());
        mJobStore.put(jobId, config);
    } else {
        config.serviceName = service.getClassName();
        config.extras = job.getExtras();
    }
    saveJobs();
    mirror.android.app.job.JobInfo.jobId.set(job, config.virtualJobId);
    mirror.android.app.job.JobInfo.service.set(job, mJobProxyComponent);
    return mScheduler.schedule(job);
}
 
開發者ID:codehz,項目名稱:container,代碼行數:20,代碼來源:VJobSchedulerService.java

示例2: getShortClassName

import android.content.ComponentName; //導入方法依賴的package包/類
public static String getShortClassName(Intent intent) {
    if (intent == null) {
        return "";
    }
    ComponentName mComponentName = intent.getComponent();
    if (mComponentName == null) {
        String mString = intent.getAction();
        if (isEmpty(mString)) {
            return "";
        }
        return mString;
    }
    String mPackageClassName = mComponentName.getClassName();
    if (isEmpty(mPackageClassName)) {
        return "";
    }
    return mPackageClassName.substring(mPackageClassName.lastIndexOf(".") + 1);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:TextUtils.java

示例3: ServiceRecord

import android.content.ComponentName; //導入方法依賴的package包/類
ServiceRecord(ComponentName cn, Intent.FilterComparison fi, ServiceInfo si) {
    name = cn;
    plugin = cn.getPackageName();
    className = cn.getClassName();
    shortName = name.flattenToShortString();
    intent = fi;
    serviceInfo = si;
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:9,代碼來源:ServiceRecord.java

示例4: whichShare

import android.content.ComponentName; //導入方法依賴的package包/類
public static String whichShare(Intent realIntent){
        final String a; //temp
        final ComponentName b; //temp
        final String c; //temp
        if ((a = realIntent.getScheme()) != null) { //使用||的話會莫名其妙的空指針,改成遍曆數組
            for(String each: TargetIntentSchemes) { //遍曆數組
                if (each.equals(a)) {
                    return each;
                }
            }
        }

        else if((b = realIntent.getComponent()) != null){ //新微信
            final String packageName = b.getPackageName();
            final String className = b.getClassName(); //debug用的土方法
            if ("com.tencent.mm".equals(packageName) && "com.tencent.mm.plugin.base.stub.WXEntryActivity".equals(className)
                    && realIntent.getIntExtra("_wxapi_command_type",0) == 2 //命令1是調用微信登錄,隻有命令2是分享到微博
                    )
                return "weixin";
        }

        /*else if((c = realIntent.getAction()) != null){
            if("com.sina.weibo.sdk.action.ACTION_WEIBO_ACTIVITY".equals(c))
                return "weibo";
        }*/

    return null; //不是分享
}
 
開發者ID:CwithW,項目名稱:PretendSharing_Xposed,代碼行數:29,代碼來源:Detector.java

示例5: getApp

import android.content.ComponentName; //導入方法依賴的package包/類
public AppLauncher getApp(ComponentName appname) {

        String actvname = appname.getClassName();
        String pkgname =  appname.getPackageName();

        AppLauncher appLauncher = null;
        SQLiteDatabase db = this.getReadableDatabase();

        Cursor cursor = db.query(APP_TABLE, appcolumns, ACTVNAME + "=? and " + PKGNAME + "=?", new String[]{actvname, pkgname}, null, null, null);
        try {
            if (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
                //pkgname = cursor.getString(1);
                String label = cursor.getString(cursor.getColumnIndex(LABEL));
                String catID = cursor.getString(cursor.getColumnIndex(CATID));
                boolean widget = cursor.getShort(cursor.getColumnIndex(ISWIDGET)) == 1;
                String customlabel = cursor.getString(cursor.getColumnIndex(CUSTOMLABEL));

                // Log.d("LaunchDB", "getApp " + pkgname + " " + catID);
                appLauncher = AppLauncher.createAppLauncher(actvname, pkgname, customlabel==null?label:customlabel, catID, widget);
            }
        } finally {
            cursor.close();
        }
        return appLauncher;
    }
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:26,代碼來源:DB.java

示例6: appHasCustomLabel

import android.content.ComponentName; //導入方法依賴的package包/類
public boolean appHasCustomLabel(ComponentName appname) {
    String actvname = appname.getClassName();
    String pkgname =  appname.getPackageName();

    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.query(APP_TABLE, new String [] {CUSTOMLABEL}, ACTVNAME + "=? and " + PKGNAME + "=?", new String[]{actvname, pkgname}, null, null, null);
    try {
        if (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
            String customlabel = cursor.getString(cursor.getColumnIndex(CUSTOMLABEL));
            if (customlabel!=null && !customlabel.isEmpty()) {
                return true;
            }
        }
    } finally {
        cursor.close();
    }
    return false;
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:19,代碼來源:DB.java

示例7: getAppCategory

import android.content.ComponentName; //導入方法依賴的package包/類
public String getAppCategory(ComponentName appname) {
    String actvname = appname.getClassName();
    String pkgname =  appname.getPackageName();

    String catID = null;
    SQLiteDatabase db = this.getReadableDatabase();

    Cursor cursor = db.query(APP_TABLE, new String[]{CATID}, ACTVNAME + "=? and " + PKGNAME + "=?", new String[]{actvname, pkgname}, null, null, null);
    try {
        if (cursor.moveToNext()) { //ACTVNAME, PKGNAME, LABEL, CATID
            catID = cursor.getString(cursor.getColumnIndex(CATID));
        }
    } finally {
        cursor.close();
    }
    return catID;
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:18,代碼來源:DB.java

示例8: handleCreate

import android.content.ComponentName; //導入方法依賴的package包/類
final void handleCreate(String plugin, Activity activity, String container) {
    ComponentName cn = activity.getComponentName();
    if (cn != null) {
        container = cn.getClassName();
    }
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "PACM: activity created h=" + activity.hashCode() + " class=" + activity.getClass().getName() + " container=" + container);
    }
    synchronized (mLock) {
        HashMap<String, ActivityState> map = mStates;
        ActivityState state = map.get(container);
        if (state != null) {
            state.create(plugin, activity);
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:17,代碼來源:PluginContainers.java

示例9: getAppShortcutInfo

import android.content.ComponentName; //導入方法依賴的package包/類
/**
 * Make an ShortcutInfo object for a shortcut that is an application.
 */
public ShortcutInfo getAppShortcutInfo(
        Intent intent, boolean allowMissingTarget, boolean useLowResIcon) {
    if (user == null) {
        return null;
    }

    ComponentName componentName = intent.getComponent();
    if (componentName == null) {
        return null;
    }

    Intent newIntent = new Intent(Intent.ACTION_MAIN, null);
    newIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    newIntent.setComponent(componentName);
    LauncherActivityInfo lai = LauncherAppsCompat.getInstance(mContext)
            .resolveActivity(newIntent, user);
    if ((lai == null) && !allowMissingTarget) {
        return null;
    }

    final ShortcutInfo info = new ShortcutInfo();
    info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
    info.user = user;
    info.intent = newIntent;

    mIconCache.getTitleAndIcon(info, lai, useLowResIcon);
    if (mIconCache.isDefaultIcon(info.iconBitmap, user)) {
        Bitmap icon = loadIcon(info);
        info.iconBitmap = icon != null ? icon : info.iconBitmap;
    }

    if (lai != null && PackageManagerHelper.isAppSuspended(lai.getApplicationInfo())) {
        info.isDisabled = ShortcutInfo.FLAG_DISABLED_SUSPENDED;
    }

    // from the db
    if (TextUtils.isEmpty(info.title)) {
        info.title = getTitle();
    }

    // fall back to the class name of the activity
    if (info.title == null) {
        info.title = componentName.getClassName();
    }

    info.contentDescription = mUserManager.getBadgedLabelForUser(info.title, info.user);
    return info;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:52,代碼來源:LoaderCursor.java

示例10: startActivity

import android.content.ComponentName; //導入方法依賴的package包/類
/**
 * 開啟一個插件的Activity <p>
 * 其中Intent的ComponentName的Key應為插件名(而不是包名),可使用createIntent方法來創建Intent對象
 *
 * @param context Context對象
 * @param intent  要打開Activity的Intent,其中ComponentName的Key必須為插件名
 * @return 插件Activity是否被成功打開?
 * FIXME 是否需要Exception來做?
 * @see #createIntent(String, String)
 * @since 1.0.0
 */
public static boolean startActivity(Context context, Intent intent) {
    // TODO 先用舊的開啟Activity方案,以後再優化
    ComponentName cn = intent.getComponent();
    if (cn == null) {
        // TODO 需要支持Action方案
        return false;
    }
    String plugin = cn.getPackageName();
    String cls = cn.getClassName();
    return PluginFactory.startActivityWithNoInjectCN(context, intent, plugin, cls, IPluginManager.PROCESS_AUTO);
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:23,代碼來源:RePlugin.java

示例11: startUniversalCopy

import android.content.ComponentName; //導入方法依賴的package包/類
private void startUniversalCopy(){
    Log.e(TAG,"startUniversalCopy");
    Activity topActivity=null;
    ActivityManager activityManager= (ActivityManager) mActivities.get(0).getApplication().getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningTaskInfo> taskInfos=activityManager.getRunningTasks(1);
    if (taskInfos.size()>0){
        ComponentName top=taskInfos.get(0).topActivity;
        if (top!=null){
            String name=top.getClassName();
            for (Activity activity:mActivities){
                if (activity.getClass().getName().equals(name)){
                    topActivity=activity;
                    break;
                }
            }
        }
    }
    if (topActivity==null){
        if (mActivities.size()>0) {
            topActivity = mActivities.get(mActivities.size() - 1);
            if (topActivity.isFinishing()){
                topActivity=null;
            }
        }
    }
    UniversalCopy(topActivity);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:28,代碼來源:XposedUniversalCopyHandler.java

示例12: getTopActivityName

import android.content.ComponentName; //導入方法依賴的package包/類
/**
 * <一句話功能簡述> 獲取最上層的Activity包名
 * 
 * @Description<功能詳細描述>
 * 
 * @param context
 * @return
 * @LastModifiedDate:2015-9-6
 * @author rqj
 * @EditHistory:<修改內容><修改人>
 */
public static String getTopActivityName(Context context) {
	String topActivityClassName = null;
	ActivityManager activityManager = (ActivityManager) (context
			.getSystemService(android.content.Context.ACTIVITY_SERVICE));
	List<RunningTaskInfo> runningTaskInfos = activityManager
			.getRunningTasks(1);
	if (runningTaskInfos != null) {
		ComponentName f = runningTaskInfos.get(0).topActivity;
		topActivityClassName = f.getClassName();
	}
	return topActivityClassName;
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:24,代碼來源:AppPackageUtil.java

示例13: startActivityForResultCompat

import android.content.ComponentName; //導入方法依賴的package包/類
/**
 * 如果 replugin-host-lib 版本小於 2.1.3,使用此 compat 方法。
 */
private static boolean startActivityForResultCompat(Activity activity, Intent intent, int requestCode, Bundle options) {
    String plugin = getPluginName(activity, intent);

    if (LogDebug.LOG) {
        LogDebug.d(TAG, "start activity with startActivityForResult: intent=" + intent);
    }

    if (TextUtils.isEmpty(plugin)) {
        return false;
    }

    ComponentName cn = intent.getComponent();
    if (cn == null) {
        return false;
    }
    String name = cn.getClassName();

    ComponentName cnNew = loadPluginActivity(intent, plugin, name, IPluginManager.PROCESS_AUTO);
    if (cnNew == null) {
        return false;
    }

    intent.setComponent(cnNew);

    if (Build.VERSION.SDK_INT >= 16) {
        activity.startActivityForResult(intent, requestCode, options);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
    return true;
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:35,代碼來源:RePluginInternal.java

示例14: makeCompname

import android.content.ComponentName; //導入方法依賴的package包/類
private String makeCompname(ComponentName componentName) {
    return componentName.getPackageName() + "/" + componentName.getClassName();
}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:4,代碼來源:FeedbackActivity.java

示例15: buildComponentString

import android.content.ComponentName; //導入方法依賴的package包/類
private String buildComponentString(ComponentName component) {
    return component.getPackageName() + " " + component.getClassName();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:4,代碼來源:PredictiveAppsProvider.java


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