android.text.TextUtils Java Examples

The following examples show how to use android.text.TextUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: Anecdote   Author: HugoGresse   File: EventTracker.java    License: Apache License 2.0 7 votes vote down vote up
/**
 * Track fragment view, should be called in onResume
 *
 * @param fragment   the fragment name to track
 * @param screenName the additional name if any
 * @param subName    sub view name
 */
public static void trackFragmentView(Fragment fragment, @Nullable String screenName, @Nullable String subName) {
    if (!isEventEnable()) return;

    String name;

    if (TextUtils.isEmpty(screenName)) {
        name = fragment.getClass().getSimpleName();
    } else {
        name = screenName;
    }

    if (TextUtils.isEmpty(name)) {
        name = "ERROR";
    }

    String detail = subName;
    if (TextUtils.isEmpty(detail)) {
        detail = "Fragment";
    }

    sEvent.sendView(name, detail);
}
 
Example #2
Source Project: GracefulMovies   Author: woxingxiao   File: MovieEntity.java    License: Apache License 2.0 6 votes vote down vote up
public List<String> getTypeList() {
    if (typeList == null && !TextUtils.isEmpty(type)) {
        typeList = new ArrayList<>();
        if (type.contains("/")) {
            String[] split = type.trim().split("/");
            typeList = Arrays.asList(split);
        } else {
            typeList.add(type);
        }
    }
    return typeList;
}
 
Example #3
Source Project: YCAudioPlayer   Author: yangchong211   File: NotificationStatusBarReceiver.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (intent == null || TextUtils.isEmpty(intent.getAction())) {
        return;
    }
    String extra = intent.getStringExtra(EXTRA);
    if (TextUtils.equals(extra, MusicPlayAction.TYPE_NEXT)) {
        PlayService.startCommand(context, MusicPlayAction.TYPE_NEXT);
        AppLogUtils.e("NotifiyStatusBarReceiver"+"下一首");
    } else if (TextUtils.equals(extra, MusicPlayAction.TYPE_START_PAUSE)) {
        if(BaseAppHelper.get().getPlayService()!=null){
            boolean playing = BaseAppHelper.get().getPlayService().isPlaying();
            if(playing){
                AppLogUtils.e("NotifiyStatusBarReceiver"+"暂停");
            }else {
                AppLogUtils.e("NotifiyStatusBarReceiver"+"播放");
            }
            PlayService.startCommand(context, MusicPlayAction.TYPE_START_PAUSE);
        }

    }else if(TextUtils.equals(extra, MusicPlayAction.TYPE_PRE)){
        PlayService.startCommand(context, MusicPlayAction.TYPE_PRE);
        AppLogUtils.e("NotifiyStatusBarReceiver"+"上一首");
    }
}
 
Example #4
Source Project: fingerpoetry-android   Author: klisly   File: OnekeyShareThemeImpl.java    License: Apache License 2.0 6 votes vote down vote up
final ShareParams shareDataToShareParams(Platform plat) {
	if (plat == null || shareParamsMap == null) {
		toast("ssdk_oks_share_failed");
		return null;
	}

	try {
		String imagePath = R.forceCast(shareParamsMap.get("imagePath"));
		Bitmap viewToShare = R.forceCast(shareParamsMap.get("viewToShare"));
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = R.getCachePath(plat.getContext(), "screenshot");
			File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
			FileOutputStream fos = new FileOutputStream(ss);
			viewToShare.compress(CompressFormat.JPEG, 100, fos);
			fos.flush();
			fos.close();
			shareParamsMap.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		toast("ssdk_oks_share_failed");
		return null;
	}

	return new ShareParams(shareParamsMap);
}
 
Example #5
Source Project: AndroidWallet   Author: Cocos-BCX   File: AppApplicationMgr.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * 是否有权限
 *
 * @param context
 * @param permission
 * @return
 */
public static boolean hasPermission(Context context, String permission) {
    if (context != null && !TextUtils.isEmpty(permission)) {
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null) {
                if (PackageManager.PERMISSION_GRANTED == packageManager.checkPermission(permission, context
                        .getPackageName())) {
                    return true;
                }
                Log.d("AppUtils", "Have you  declared permission " + permission + " in AndroidManifest.xml ?");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
    return false;
}
 
Example #6
Source Project: fdroidclient   Author: f-droid   File: RepoProvider.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method decides what repo a URL belongs to by iteratively removing path fragments and
 * checking if it belongs to a repo or not. It will match the most specific repository which
 * could serve the file at the given URL.
 * <p>
 * For any given HTTP resource requested by F-Droid, it should belong to a repository.
 * Whether that resource is an index.jar, an icon, or a .apk file, they all belong to a
 * repository. Therefore, that repository must exist in the database. The way to find out
 * which repository a particular URL came from requires some consideration:
 * <li>Repositories can exist at particular paths on a server (e.g. /fdroid/repo)
 * <li>Individual files can exist at a more specific path on the repo (e.g.
 * /fdroid/repo/icons/org.fdroid.fdroid.png)</li>
 * <p>
 * So for a given URL "/fdroid/repo/icons/org.fdroid.fdroid.png" we don't actually know
 * whether it is for the file "org.fdroid.fdroid.png" at repository "/fdroid/repo/icons" or
 * the file "icons/org.fdroid.fdroid.png" at the repository at "/fdroid/repo".
 */
@Nullable
public static Repo findByUrl(Context context, Uri uri, String[] projection) {
    Uri withoutQuery = uri.buildUpon().query(null).build();
    Repo repo = findByAddress(context, withoutQuery.toString(), projection);

    // Take a copy of this, because the result of getPathSegments() is an AbstractList
    // which doesn't support the remove() operation.
    List<String> pathSegments = new ArrayList<>(withoutQuery.getPathSegments());

    boolean haveTriedWithoutPath = false;
    while (repo == null && !haveTriedWithoutPath) {
        if (pathSegments.isEmpty()) {
            haveTriedWithoutPath = true;
        } else {
            pathSegments.remove(pathSegments.size() - 1);
            withoutQuery = withoutQuery.buildUpon().path(TextUtils.join("/", pathSegments)).build();
        }
        repo = findByAddress(context, withoutQuery.toString(), projection);
    }
    return repo;
}
 
Example #7
Source Project: Navigator   Author: hdigitalspa   File: NavigatorUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param tag             point to return
 * @param container       id container
 * @param fragmentManager variable contain fragment stack
 * @return true if is possible return to tag param
 */
public boolean canGoBackToSpecificPoint(String tag, int container, FragmentManager fragmentManager) {
    if (TextUtils.isEmpty(tag)) {
        return (fragmentManager.getBackStackEntryCount() > 1);
    } else {
        List<FragmentManager.BackStackEntry> fragmentList = fragmentList();
        Fragment fragment = fragmentManager.findFragmentById(container);
        if (fragment != null && tag.equalsIgnoreCase(fragment.getTag())) {
            return false;
        }
        for (int i = 0; i < fragmentList.size(); i++) {
            if (tag.equalsIgnoreCase(fragmentList.get(i).getName())) {
                return true;
            }
        }
        return false;
    }
}
 
Example #8
Source Project: umeng_community_android   Author: umeng   File: LikeMePresenter.java    License: MIT License 6 votes vote down vote up
@Override
public void loadDataFromServer() {

    mCommunitySDK.fetchLikedRecords(CommConfig.getConfig().loginedUser.id,
            new SimpleFetchListener<LikeMeResponse>() {

                @Override
                public void onStart() {
                    mFeedView.onRefreshStart();
                }

                @Override
                public void onComplete(LikeMeResponse response) {
                    if(NetworkUtils.handleResponseAll(response) ){
                        mFeedView.onRefreshEnd();
                        return ;
                    }
                    if ( TextUtils.isEmpty(mNextPageUrl) && mUpdateNextPageUrl.get() ) {
                        mNextPageUrl = response.nextPageUrl;
                        mUpdateNextPageUrl.set(false);
                    }
                    addFeedItemsToHeader(response.result);
                    mFeedView.onRefreshEnd();
                }
            });
}
 
Example #9
Source Project: fdroidclient   Author: f-droid   File: InstallerFactory.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns an instance of an appropriate installer.
 * Either DefaultInstaller, PrivilegedInstaller, or in the special
 * case to install the "F-Droid Privileged Extension" ExtensionInstaller.
 *
 * @param context current {@link Context}
 * @param apk     to be installed, always required.
 * @return instance of an Installer
 */
public static Installer create(Context context, @NonNull Apk apk) {
    if (TextUtils.isEmpty(apk.packageName)) {
        throw new IllegalArgumentException("Apk.packageName must not be empty: " + apk);
    }

    Installer installer;
    if (!apk.isApk()) {
        Utils.debugLog(TAG, "Using FileInstaller for non-apk file");
        installer = new FileInstaller(context, apk);
    } else if (PrivilegedInstaller.isDefault(context)) {
        Utils.debugLog(TAG, "privileged extension correctly installed -> PrivilegedInstaller");
        installer = new PrivilegedInstaller(context, apk);
    } else {
        installer = new DefaultInstaller(context, apk);
    }

    return installer;
}
 
Example #10
Source Project: starcor.xul   Author: starcor-company   File: XulSelect.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
public void setPriorityLevel(int priorityLevel, int baseLevel) {
	int complexLevel = 0;
	complexLevel += TextUtils.isEmpty(_id) ? 0 : 1;
	complexLevel += TextUtils.isEmpty(_class) ? 0 : 1;
	complexLevel += TextUtils.isEmpty(_type) ? 0 : 1;
	complexLevel += (_state <= 0) ? 0 : 1;
	complexLevel *= 0x10000;
	if (_state == XulView.STATE_DISABLED) {
		complexLevel += 0x8000;
	}
	priorityLevel = complexLevel + priorityLevel;

	for (int i = 0; i < _prop.size(); i++) {
		XulProp prop = _prop.get(i);
		prop.setPriority(priorityLevel + baseLevel);
	}
}
 
Example #11
Source Project: openboard   Author: dslul   File: ResourceUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static int getDefaultKeyboardHeight(final Resources res) {
    final DisplayMetrics dm = res.getDisplayMetrics();
    final String keyboardHeightInDp = getDeviceOverrideValue(
            res, R.array.keyboard_heights, null /* defaultValue */);
    final float keyboardHeight;
    if (TextUtils.isEmpty(keyboardHeightInDp)) {
        keyboardHeight = res.getDimension(R.dimen.config_default_keyboard_height);
    } else {
        keyboardHeight = Float.parseFloat(keyboardHeightInDp) * dm.density;
    }
    final float maxKeyboardHeight = res.getFraction(
            R.fraction.config_max_keyboard_height, dm.heightPixels, dm.heightPixels);
    float minKeyboardHeight = res.getFraction(
            R.fraction.config_min_keyboard_height, dm.heightPixels, dm.heightPixels);
    if (minKeyboardHeight < 0.0f) {
        // Specified fraction was negative, so it should be calculated against display
        // width.
        minKeyboardHeight = -res.getFraction(
                R.fraction.config_min_keyboard_height, dm.widthPixels, dm.widthPixels);
    }
    // Keyboard height will not exceed maxKeyboardHeight and will not be less than
    // minKeyboardHeight.
    return (int)Math.max(Math.min(keyboardHeight, maxKeyboardHeight), minKeyboardHeight);
}
 
Example #12
Source Project: a   Author: 804463258   File: MainPresenter.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void addBookUrl(String bookUrls) {
    bookUrls=bookUrls.trim();
    if (TextUtils.isEmpty(bookUrls)) return;

    String[] urls=bookUrls.split("\\n");

    Observable.fromArray(urls)
            .flatMap(this::addBookUrlO)
            .compose(RxUtils::toSimpleSingle)
            .subscribe(new MyObserver<BookShelfBean>() {
                @Override
                public void onNext(BookShelfBean bookShelfBean) {
                    getBook(bookShelfBean);
                }

                @Override
                public void onError(Throwable e) {
                    mView.toast(e.getMessage());
                }
            });
}
 
Example #13
Source Project: screenAdaptation   Author: hjhrq1991   File: MainAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder getView(RecyclerView.ViewHolder holder, final int position) {
    BaseHolder mHolder = (BaseHolder) holder;
    String title = getItem(position).getTitle();
    mHolder.mTitleView.setText(!TextUtils.isEmpty(title) ? title : "");
    mHolder.mTitleView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int type = getItem(position).getType();
            switch (type) {
                case Type.MAIN_TRI:
                    TriActivity.launch(mContext);
                    break;
                case Type.MAIN_FIVE:
                    FiveActivity.launch(mContext);
                    break;
            }
        }
    });
    return holder;
}
 
Example #14
Source Project: weex   Author: Laisly   File: WeexUiTestCaseTcInputType.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * get tc list by text
 * @param byText
 * @return
 * @throws InterruptedException
 */
public ArrayList<View> getTestCaseListViewByText(String byText) throws InterruptedException {
    Log.e("TestScript_Guide", "byText ==" + byText);

    if(TextUtils.isEmpty(byText)){
        return null;
    }
    ArrayList<View> outViews = new ArrayList<View>();

    mViewGroup.findViewsWithText(outViews, byText, View.FIND_VIEWS_WITH_TEXT);

    for (View view :  outViews){
        String viewText = ((WXTextView)view).getText().toString();
        Log.e(TAG, "viewText ==" + viewText);


    }
    return outViews;
}
 
Example #15
Source Project: DeviceConnect-Android   Author: DeviceConnect   File: UVCCamera.java    License: MIT License 6 votes vote down vote up
public static List<Size> getSupportedSize(final int type, final String supportedSize) {
	final List<Size> result = new ArrayList<Size>();
	if (!TextUtils.isEmpty(supportedSize))
	try {
		final JSONObject json = new JSONObject(supportedSize);
		final JSONArray formats = json.getJSONArray("formats");
		final int format_nums = formats.length();
		for (int i = 0; i < format_nums; i++) {
			final JSONObject format = formats.getJSONObject(i);
			final int format_type = format.getInt("type");
			if ((format_type == type) || (type == -1)) {
				addSize(format, format_type, 0, result);
			}
		}
	} catch (final JSONException e) {
	}
	return result;
}
 
Example #16
Source Project: Android-nRF-Toolbox   Author: NordicSemiconductor   File: DeviceAdapter.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void bind(@NonNull final BluetoothDevice device) {
	final boolean ready = service.isReady(device);

	String name = device.getName();
	if (TextUtils.isEmpty(name))
		name = nameView.getResources().getString(R.string.proximity_default_device_name);
	nameView.setText(name);
	addressView.setText(device.getAddress());

	final boolean on = service.isImmediateAlertOn(device);
	actionButton.setImageResource(on ? R.drawable.ic_stat_notify_proximity_silent : R.drawable.ic_stat_notify_proximity_find);
	actionButton.setVisibility(ready ? View.VISIBLE : View.GONE);
	progress.setVisibility(ready ? View.GONE : View.VISIBLE);

	final Integer batteryValue = service.getBatteryLevel(device);
	if (batteryValue != null) {
		batteryView.getCompoundDrawables()[0 /*left*/].setLevel(batteryValue);
		batteryView.setVisibility(View.VISIBLE);
		batteryView.setText(batteryView.getResources().getString(R.string.battery, batteryValue));
		batteryView.setAlpha(ready ? 1.0f : 0.5f);
	} else {
		batteryView.setVisibility(View.GONE);
	}
}
 
Example #17
Source Project: NanoIconPack   Author: by-syk   File: ExtraUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static void shareText(Context context, String content, String hint) {
    if (context == null || TextUtils.isEmpty(content)) {
        return;
    }

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, content);
    try {
        if (TextUtils.isEmpty(hint)) {
            context.startActivity(intent);
        } else {
            context.startActivity(Intent.createChooser(intent, hint));
        }
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}
 
Example #18
Source Project: apkextractor   Author: ghmxr   File: FileItem.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * 如果为documentFile实例,则会返回以“external/”开头的片段;如果为File实例,则返回正常的完整路径
 */
public String getPath(){
    if(documentFile!=null){
        String uriPath= documentFile.getUri().getPath();
        if(uriPath==null)return "";
        int index=uriPath.lastIndexOf(":")+1;
        if(index<=uriPath.length())return "external/"+uriPath.substring(index);
    }
    if(file!=null)return file.getAbsolutePath();
    if(context!=null&&contentUri!=null){
        if(ContentResolver.SCHEME_FILE.equalsIgnoreCase(contentUri.getScheme())){
            return contentUri.getPath();
        }
        String path=EnvironmentUtil.getFilePathFromContentUri(context,contentUri);
        if(!TextUtils.isEmpty(path))return path;
        return contentUri.toString();
    }
    return "";
}
 
Example #19
Source Project: Telegram-FOSS   Author: Telegram-FOSS-Team   File: HlsMediaPeriod.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static Map<String, DrmInitData> deriveOverridingDrmInitData(
    List<DrmInitData> sessionKeyDrmInitData) {
  ArrayList<DrmInitData> mutableSessionKeyDrmInitData = new ArrayList<>(sessionKeyDrmInitData);
  HashMap<String, DrmInitData> drmInitDataBySchemeType = new HashMap<>();
  for (int i = 0; i < mutableSessionKeyDrmInitData.size(); i++) {
    DrmInitData drmInitData = sessionKeyDrmInitData.get(i);
    String scheme = drmInitData.schemeType;
    // Merge any subsequent drmInitData instances that have the same scheme type. This is valid
    // due to the assumptions documented on HlsMediaSource.Builder.setUseSessionKeys, and is
    // necessary to get data for different CDNs (e.g. Widevine and PlayReady) into a single
    // drmInitData.
    int j = i + 1;
    while (j < mutableSessionKeyDrmInitData.size()) {
      DrmInitData nextDrmInitData = mutableSessionKeyDrmInitData.get(j);
      if (TextUtils.equals(nextDrmInitData.schemeType, scheme)) {
        drmInitData = drmInitData.merge(nextDrmInitData);
        mutableSessionKeyDrmInitData.remove(j);
      } else {
        j++;
      }
    }
    drmInitDataBySchemeType.put(scheme, drmInitData);
  }
  return drmInitDataBySchemeType;
}
 
Example #20
Source Project: android-unispeech   Author: jromero   File: BaseLanguageSelectActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mLayoutInflater.inflate(R.layout.item_language, null);
        convertView.setTag(new ViewHolder(convertView));
    }

    SupportedSttLanguage language = getItem(position);

    ViewHolder viewHolder = (ViewHolder) convertView.getTag();
    viewHolder.language.setText(language.getLabel());
    if (!TextUtils.isEmpty(language.getSpecifier())) {
        viewHolder.specifier.setText("(" +language.getSpecifier() + ")");
        viewHolder.specifier.setVisibility(View.VISIBLE);
    } else {
        viewHolder.specifier.setVisibility(View.GONE);
    }

    return convertView;
}
 
Example #21
Source Project: letv   Author: JackChan1999   File: JarLoader.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint({"NewApi"})
public static Class loadClass(Context context, String jarName, String packageName, String className) {
    String dexInternalPath = JarUtil.getJarInFolderName(context, jarName);
    String optimizedDexOutputPath = JarUtil.getJarOutFolderName(context);
    if (!TextUtils.isEmpty(dexInternalPath)) {
        try {
            JarClassLoader cl;
            if (dexLoaders.containsKey(packageName)) {
                cl = (JarClassLoader) dexLoaders.get(packageName);
            } else {
                cl = new JarClassLoader(packageName, dexInternalPath, optimizedDexOutputPath, context.getApplicationInfo().nativeLibraryDir, context.getClassLoader());
                dexLoaders.put(packageName, cl);
            }
            return cl.loadClass(packageName + "." + className);
        } catch (Exception e) {
            JLog.i("clf", "!!!!!!! loadClass--" + packageName + " e is " + e.getMessage());
            return null;
        }
    } else if (mReloadNum >= 1) {
        return null;
    } else {
        mReloadNum++;
        JLog.i("plugin", "JarUtil.updatePlugin 333333333333333333");
        JarUtil.updatePlugin(context, 0, false);
        return loadClass(context, jarName, packageName, className);
    }
}
 
Example #22
Source Project: tindroid   Author: tinode   File: ContactOperations.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Updates contact's phone
 *
 * @param existingNumber phone number stored in contacts provider
 * @param phone          new phone number for the contact
 * @param uri            Uri for the existing raw contact to be updated
 * @return instance of ContactOperations
 */
ContactOperations updatePhone(String existingNumber, String phone, Uri uri) {
    mValues.clear();
    if (!TextUtils.equals(phone, existingNumber)) {
        mValues.put(Phone.NUMBER, phone);
        addUpdateOp(uri);
    }
    return this;
}
 
Example #23
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: UndoRedoSupportEditText.java    License: Apache License 2.0 5 votes vote down vote up
private ActionType getActionType() {
    if (!TextUtils.isEmpty(mBeforeChange) && TextUtils.isEmpty(mAfterChange)) {
        return ActionType.DELETE;
    } else if (TextUtils.isEmpty(mBeforeChange) && !TextUtils.isEmpty(mAfterChange)) {
        return ActionType.INSERT;
    } else {
        return ActionType.PASTE;
    }
}
 
Example #24
Source Project: weex   Author: Laisly   File: WXResourceUtils.java    License: Apache License 2.0 5 votes vote down vote up
@Override
String handle(String rawColor) {
  String rrggbb = colorMap.get(rawColor);
  if (!TextUtils.isEmpty(rrggbb)) {
    return rrggbb;
  } else {
    return null;
  }
}
 
Example #25
Source Project: cordova-hot-code-push   Author: nordnet   File: HotCodePushPlugin.java    License: MIT License 5 votes vote down vote up
private void cleanupFileSystemFromOldReleases() {
    if (TextUtils.isEmpty(pluginInternalPrefs.getCurrentReleaseVersionName())) {
        return;
    }

    CleanUpHelper.removeReleaseFolders(cordova.getActivity(),
            new String[]{pluginInternalPrefs.getCurrentReleaseVersionName(),
                    pluginInternalPrefs.getPreviousReleaseVersionName(),
                    pluginInternalPrefs.getReadyForInstallationReleaseVersionName()
            }
    );
}
 
Example #26
Source Project: AndroidChromium   Author: JackyAndroid   File: PreferenceCategoryWithButton.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindView(final View view) {
    super.onBindView(view);
    // On pre-L devices, PreferenceCategoryWithButtonStyle is reused for PreferenceCategory,
    // which needs a top padding of 16dp; we don't want this top padding for
    // PreferenceCategoryWithButton views.
    view.setPadding(view.getPaddingLeft(), 0, view.getPaddingRight(), view.getPaddingBottom());
    View button = view.findViewById(android.R.id.icon);
    button.setOnClickListener(this);

    if (!TextUtils.isEmpty(mContentDescription)) {
        button.setContentDescription(mContentDescription);
    }
}
 
Example #27
Source Project: android   Author: 5calls   File: MainActivity.java    License: MIT License 5 votes vote down vote up
private void refreshIssues() {
    FiveCallsApi api = AppSingleton.getInstance(getApplicationContext()).getJsonController();

    if (mIssuesAdapter.mContacts.size() == 0) {
        String location = getLocationString();
        if (!TextUtils.isEmpty(location)) {
            api.getContacts(location);
        }
    }
    api.getIssues();
}
 
Example #28
Source Project: WebSocket-for-Android   Author: knowledgecode   File: PerMessageDeflateExtension.java    License: Apache License 2.0 5 votes vote down vote up
public PerMessageDeflateExtension() {
    if (Build.VERSION.SDK_INT < 19) {
        _parameters = TextUtils.join("; ", new String[]{ EXTENSION, CLIENT_NO_CONTEXT_TAKEOVER });
    } else {
        _parameters = EXTENSION;
    }
    _compressed = false;
}
 
Example #29
Source Project: FastAccess   Author: k0shk0sh   File: IconPackHelper.java    License: GNU General Public License v3.0 5 votes vote down vote up
private Drawable getDrawableForName(String name) {
    if (isIconPackLoaded()) {
        String item = mIconPackResources.get(name);
        if (!TextUtils.isEmpty(item)) {
            int id = getResourceIdForDrawable(item);
            if (id != 0) {
                return mLoadedIconPackResource.getDrawable(id);
            }
        }
    }
    return null;
}
 
Example #30
Source Project: LottieBottomNav   Author: wwdablu   File: MenuItemBuilder.java    License: MIT License 5 votes vote down vote up
public static MenuItemBuilder create(@NonNull  String lottieName,
                                     @NonNull  Source lottieSource,
                                     @NonNull  FontItem fontItem,
                                     @Nullable Object tag) throws IllegalArgumentException {

    if (TextUtils.isEmpty(lottieName)) {
        throw new IllegalArgumentException("Lottie file must be provided.");
    }

    return new MenuItemBuilder(lottieName, lottieSource, fontItem, tag);
}