Java 类android.net.Uri.Builder 实例源码

项目:letv    文件:ShareRequestParam.java   
public String buildUrl(String picid) {
    Builder builder = Uri.parse(SHARE_URL).buildUpon();
    builder.appendQueryParameter("title", this.mShareContent);
    builder.appendQueryParameter("version", "0031105000");
    if (!TextUtils.isEmpty(this.mAppKey)) {
        builder.appendQueryParameter("source", this.mAppKey);
    }
    if (!TextUtils.isEmpty(this.mToken)) {
        builder.appendQueryParameter("access_token", this.mToken);
    }
    String aid = Utility.getAid(this.mContext, this.mAppKey);
    if (!TextUtils.isEmpty(aid)) {
        builder.appendQueryParameter("aid", aid);
    }
    if (!TextUtils.isEmpty(this.mAppPackage)) {
        builder.appendQueryParameter(REQ_PARAM_PACKAGENAME, this.mAppPackage);
    }
    if (!TextUtils.isEmpty(this.mHashKey)) {
        builder.appendQueryParameter(REQ_PARAM_KEY_HASH, this.mHashKey);
    }
    if (!TextUtils.isEmpty(picid)) {
        builder.appendQueryParameter(REQ_PARAM_PICINFO, picid);
    }
    return builder.build().toString();
}
项目:CSipSimple    文件:PhoneCapabilityTester.java   
/**
 * Returns true if this device can be used to make sip calls
 */
/*
public static boolean isSipPhone(Context context) {
    if (!sIsInitialized) initialize(context);
    return sIsSipPhone;
}
*/


public static Intent getPriviledgedIntent(String number) {
    Intent i = new Intent("android.intent.action.CALL_PRIVILEGED");
    Builder b = new Builder();
    b.scheme("tel").appendPath(number);
    i.setData(b.build());
    return i;
}
项目:CSipSimple    文件:ConversationsListFragment.java   
private void confirmDeleteThread(final String from) {

      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      builder.setTitle(R.string.confirm_dialog_title)
          .setIcon(android.R.drawable.ic_dialog_alert)
      .setCancelable(true)
      .setPositiveButton(R.string.delete, new OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        if(TextUtils.isEmpty(from)) {
            getActivity().getContentResolver().delete(SipMessage.MESSAGE_URI, null, null);
        }else {
            Builder threadUriBuilder = SipMessage.THREAD_ID_URI_BASE.buildUpon();
            threadUriBuilder.appendEncodedPath(from);
            getActivity().getContentResolver().delete(threadUriBuilder.build(), null, null);
        }
    }
})
      .setNegativeButton(R.string.no, null)
      .setMessage(TextUtils.isEmpty(from)
              ? R.string.confirm_delete_all_conversations
                      : R.string.confirm_delete_conversation)
      .show();
  }
项目:letv    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());
    if (VERSION.SDK_INT >= 11) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, ApkConstant.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:letv    文件:AssistActivity.java   
public static Intent getIntent(Context context, String titleResId, String url, String appId) {
    if (ValidUtils.isUrlValid(url)) {
        try {
            Intent i = new Intent(context, AssistActivity.class);
            i.addFlags(268435456);
            KVUtils.put(i, KEY_TITLE_RESID, titleResId);
            Builder ub = Uri.parse(url).buildUpon();
            ub.appendQueryParameter("pv", "1");
            ub.appendQueryParameter("titlebar", "0");
            ub.appendQueryParameter("appid", appId);
            ub.appendQueryParameter(a.c, "http://auther.coolyun.com");
            ub.appendQueryParameter("clientype", SystemUtils.getDeviceType());
            ub.appendQueryParameter(HOME_RECOMMEND_PARAMETERS.DEVICEID_KEY, SystemUtils.getDeviceId(context));
            ub.appendQueryParameter("devmodel", SystemUtils.getDeviceModel());
            ub.appendQueryParameter("netype", SystemUtils.getNetworkType(context));
            ub.appendQueryParameter("tm", TimeUtils.nowTime());
            KVUtils.put(i, "url", ub.toString());
            return i;
        } catch (Throwable t) {
            LOG.e(TAG, "[url:" + url + "][appId:" + appId + "] create intent failed(Throwable)", t);
            return null;
        }
    }
    LOG.e(TAG, "[url:" + url + "][appId:" + appId + "] url invalid");
    return null;
}
项目:letv    文件:ProtocolBuilder.java   
protected Builder addCommonParam(Builder ub) {
    append(ub, CLIENT_TYPE, this.clientType);
    append(ub, "devid", getDeviceId());
    append(ub, MAC_ID, getMacId());
    append(ub, SN_ID, getSnId());
    append(ub, PKG_NAME, getpkgName());
    append(ub, JAR_VERSION, "2.2.1");
    append(ub, UACBRAND, Config.getUacBrand());
    append(ub, PKG_VERSION, getAppVersion());
    append(ub, MEID_ID, getMeidId());
    append(ub, DEVICE_MODEL, getDeviceModel());
    append(ub, NETWORK_TYPE, SystemUtils.getNetworkType(ContextUtils.getContext()));
    append(ub, IS_GZIP, this.gzip);
    append(ub, PROTOCOL_VERSION, this.protocolVersion);
    append(ub, REQUEST_TIME, TimeUtils.nowTime());
    return ub;
}
项目:letv    文件:FileProvider.java   
public Uri getUriForFile(File file) {
    try {
        String rootPath;
        String path = file.getCanonicalPath();
        Entry<String, File> mostSpecific = null;
        for (Entry<String, File> root : this.mRoots.entrySet()) {
            rootPath = ((File) root.getValue()).getPath();
            if (path.startsWith(rootPath) && (mostSpecific == null || rootPath.length() > ((File) mostSpecific.getValue()).getPath().length())) {
                mostSpecific = root;
            }
        }
        if (mostSpecific == null) {
            throw new IllegalArgumentException("Failed to find configured root that contains " + path);
        }
        rootPath = ((File) mostSpecific.getValue()).getPath();
        if (rootPath.endsWith("/")) {
            path = path.substring(rootPath.length());
        } else {
            path = path.substring(rootPath.length() + 1);
        }
        return new Builder().scheme(WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT).authority(this.mAuthority).encodedPath(Uri.encode((String) mostSpecific.getKey()) + LetvUtils.CHARACTER_BACKSLASH + Uri.encode(path, "/")).build();
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
    }
}
项目:DroidPlugin    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:boohee_v5.6    文件:SuggestionsAdapter.java   
Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) {
    if (searchable == null) {
        return null;
    }
    String authority = searchable.getSuggestAuthority();
    if (authority == null) {
        return null;
    }
    Builder uriBuilder = new Builder().scheme(Utils.RESPONSE_CONTENT).authority(authority).query("").fragment("");
    String contentPath = searchable.getSuggestPath();
    if (contentPath != null) {
        uriBuilder.appendEncodedPath(contentPath);
    }
    uriBuilder.appendPath("search_suggest_query");
    String selection = searchable.getSuggestSelection();
    String[] selArgs = null;
    if (selection != null) {
        selArgs = new String[]{query};
    } else {
        uriBuilder.appendPath(query);
    }
    if (limit > 0) {
        uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
    }
    return this.mContext.getContentResolver().query(uriBuilder.build(), null, selection, selArgs, null);
}
项目:boohee_v5.6    文件:FileProvider.java   
public Uri getUriForFile(File file) {
    try {
        String rootPath;
        String path = file.getCanonicalPath();
        Entry<String, File> mostSpecific = null;
        for (Entry<String, File> root : this.mRoots.entrySet()) {
            rootPath = ((File) root.getValue()).getPath();
            if (path.startsWith(rootPath) && (mostSpecific == null || rootPath.length() > ((File) mostSpecific.getValue()).getPath().length())) {
                mostSpecific = root;
            }
        }
        if (mostSpecific == null) {
            throw new IllegalArgumentException("Failed to find configured root that contains " + path);
        }
        rootPath = ((File) mostSpecific.getValue()).getPath();
        if (rootPath.endsWith("/")) {
            path = path.substring(rootPath.length());
        } else {
            path = path.substring(rootPath.length() + 1);
        }
        return new Builder().scheme(Utils.RESPONSE_CONTENT).authority(this.mAuthority).encodedPath(Uri.encode((String) mostSpecific.getKey()) + '/' + Uri.encode(path, "/")).build();
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
    }
}
项目:DroidPluginLibrary    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:UdacityAndroidBasicsNanodegree    文件:QueryUtils.java   
public static URL buildUrl() {
    Uri baseUri = Uri.parse(BASE_URL);
    Builder uriBuilder = baseUri.buildUpon();

    Map<String, String> paramMap = getParamMap();
    if (paramMap != null) {
        for (String param : paramMap.keySet()) {
            String value = paramMap.get(param);
            uriBuilder.appendQueryParameter(param, value);
        }
    }

    String uriString = uriBuilder.toString();
    URL url = null;
    try {
        url = new URL(uriString);
    } catch (MalformedURLException e) {
        Timber.e(e, "Problem building the URL");
    }
    return url;
}
项目:pet    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:DynamicAppLoader    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:DroidPluginLibrary    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:FMTech    文件:DfeApiImpl.java   
private static String getReviewsUrl(String paramString, boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3)
{
  Uri.Builder localBuilder = Uri.parse(paramString).buildUpon();
  if (paramBoolean) {
    localBuilder.appendQueryParameter("dfil", "1");
  }
  if (paramInt1 > 0) {
    localBuilder.appendQueryParameter("vc", Integer.toString(paramInt1));
  }
  if (paramInt2 > 0) {
    localBuilder.appendQueryParameter("rating", Integer.toString(paramInt2));
  }
  if (paramInt3 >= 0) {
    localBuilder.appendQueryParameter("sort", Integer.toString(paramInt3));
  }
  return localBuilder.toString();
}
项目:FMTech    文件:SuggestionHandler.java   
private Uri getBackendCanonicalIconUri(int paramInt)
{
  if (paramInt != 3) {
    try
    {
      String str = IntentUtils.getPackageName(paramInt);
      PackageManager localPackageManager = this.mContext.getPackageManager();
      int i = ((ResolveInfo)localPackageManager.queryIntentActivities(localPackageManager.getLaunchIntentForPackage(str), 65536).get(0)).activityInfo.applicationInfo.icon;
      if (i != 0)
      {
        Uri localUri = new Uri.Builder().scheme("android.resource").authority(str).path(Integer.toString(i)).build();
        return localUri;
      }
    }
    catch (Exception localException)
    {
      return null;
    }
  }
  return null;
}
项目:FMTech    文件:DismissRecommendationService.java   
public static PendingIntent getDismissPendingIntent(Context paramContext, int paramInt1, Document paramDocument, int paramInt2, int paramInt3)
{
  if (!paramDocument.hasNeutralDismissal()) {
    return null;
  }
  String str = paramDocument.getNeutralDismissal().url;
  Uri.Builder localBuilder = new Uri.Builder();
  localBuilder.scheme("content");
  localBuilder.authority("dismiss");
  localBuilder.appendPath(String.valueOf(paramInt1));
  localBuilder.appendPath(String.valueOf(paramInt3));
  localBuilder.appendPath(str);
  Intent localIntent = new Intent(paramContext, DismissRecommendationService.class);
  localIntent.setData(localBuilder.build());
  localIntent.putExtra("appWidgetId", paramInt1);
  localIntent.putExtra("documentId", paramDocument.mDocument.docid);
  localIntent.putExtra("dismissalUrl", str);
  localIntent.putExtra("backendId", paramInt2);
  return PendingIntent.getService(paramContext, 0, localIntent, 0);
}
项目:FMTech    文件:ier.java   
private static Uri.Builder a(Context paramContext, Uri.Builder paramBuilder)
{
  String str1;
  try
  {
    paramBuilder.appendQueryParameter("version", String.valueOf(paramContext.getPackageManager().getPackageInfo(paramContext.getApplicationInfo().packageName, 0).versionCode));
    return paramBuilder;
  }
  catch (PackageManager.NameNotFoundException localNameNotFoundException)
  {
    while (!Log.isLoggable("HelpUriGenerator", 6)) {}
    str1 = String.valueOf(paramContext.getApplicationInfo().packageName);
    if (str1.length() == 0) {}
  }
  for (String str2 = "Error finding package ".concat(str1);; str2 = new String("Error finding package "))
  {
    Log.e("HelpUriGenerator", str2);
    return paramBuilder;
  }
}
项目:FMTech    文件:ier.java   
public final Uri a(String paramString)
{
  if (TextUtils.isEmpty(paramString)) {
    throw new IllegalArgumentException("getHelpUri(): fromWhere must be non-empty");
  }
  String str1 = this.b;
  Locale localLocale = Locale.getDefault();
  String str2 = String.valueOf(localLocale.getLanguage());
  String str3 = String.valueOf(localLocale.getCountry().toLowerCase(localLocale));
  String str4 = 1 + String.valueOf(str2).length() + String.valueOf(str3).length() + str2 + "-" + str3;
  if (str1.contains("%locale%")) {}
  Uri.Builder localBuilder1;
  for (String str5 = str1.replace("%locale%", str4);; str5 = localBuilder1.build().toString())
  {
    Uri.Builder localBuilder2 = Uri.parse(str5).buildUpon();
    localBuilder2.appendQueryParameter("p", paramString);
    return a(this.a, localBuilder2).build();
    localBuilder1 = Uri.parse(str1).buildUpon();
    localBuilder1.appendQueryParameter("hl", str4);
  }
}
项目:FMTech    文件:efj.java   
public static Uri.Builder a(Context paramContext, Uri.Builder paramBuilder)
{
  String str1;
  try
  {
    paramBuilder.appendQueryParameter("version", String.valueOf(paramContext.getPackageManager().getPackageInfo(paramContext.getApplicationInfo().packageName, 0).versionCode));
    return paramBuilder;
  }
  catch (PackageManager.NameNotFoundException localNameNotFoundException)
  {
    while (!Log.isLoggable("HelpUrl", 6)) {}
    str1 = String.valueOf(paramContext.getApplicationInfo().packageName);
    if (str1.length() == 0) {}
  }
  for (String str2 = "Error finding package ".concat(str1);; str2 = new String("Error finding package "))
  {
    Log.e("HelpUrl", str2);
    return paramBuilder;
  }
}
项目:FMTech    文件:efj.java   
public static void a(Notification.Builder paramBuilder, ea paramea)
{
  Notification.Action.Builder localBuilder = new Notification.Action.Builder(paramea.a(), paramea.b(), paramea.c());
  if (paramea.e() != null)
  {
    RemoteInput[] arrayOfRemoteInput = a(paramea.e());
    int i1 = arrayOfRemoteInput.length;
    for (int i2 = 0; i2 < i1; i2++) {
      localBuilder.addRemoteInput(arrayOfRemoteInput[i2]);
    }
  }
  if (paramea.d() != null) {
    localBuilder.addExtras(paramea.d());
  }
  paramBuilder.addAction(localBuilder.build());
}
项目:FMTech    文件:jmc.java   
public final Cursor o()
{
  long l = a(this.s, this.t, this.u);
  if ((l == -1L) || (System.currentTimeMillis() - l > 900000L))
  {
    kcg localkcg = new kcg(this.w.a(this.t).b("account_name"), null);
    new jhz(this.s, localkcg, this.t, Integer.valueOf(this.v), this.u).i();
  }
  String str1 = String.valueOf("circle_id = ");
  String str2 = String.valueOf(DatabaseUtils.sqlEscapeString(this.u));
  if (str2.length() != 0) {}
  for (String str3 = str1.concat(str2);; str3 = new String(str1))
  {
    Uri.Builder localBuilder = efj.w(this.s).buildUpon().appendQueryParameter("account", String.valueOf(this.t));
    return this.s.getContentResolver().query(localBuilder.build(), r, str3, null, null);
  }
}
项目:FMTech    文件:dik.java   
public final void x()
{
  gjb localgjb = this.af.f();
  Uri.Builder localBuilder = new Uri.Builder().scheme("https").authority("aboutme.google.com");
  Boolean localBoolean = this.ac.l.b;
  if (localBoolean == null) {}
  for (boolean bool = false;; bool = localBoolean.booleanValue())
  {
    if ((bool) || (this.ac.c()))
    {
      localBuilder.appendQueryParameter("referer", "gplus_android");
      localBuilder.appendQueryParameter("pageId", this.b);
    }
    dhg localdhg = new dhg();
    localdhg.a = localBuilder.build();
    localdhg.b = localgjb.b("account_name");
    Intent localIntent = new Intent("android.intent.action.VIEW", localdhg.a());
    ay.a(f(), localIntent, this.ag);
    return;
  }
}
项目:FMTech    文件:hou.java   
public final fu<Cursor> a(int paramInt, Bundle paramBundle)
{
  int i = this.ag.c();
  switch (paramInt)
  {
  default: 
    return null;
  case 0: 
    return new hmh(this.bn, i, null, this.al, this.am);
  case 1: 
    return new jma(this.bn, i, 5);
  }
  mbf localmbf = this.bn;
  String str = ((gnz)mbb.a(this.bn, gnz.class)).b();
  return new hqj(localmbf, new Uri.Builder().scheme("content").authority(str).appendPath("account_status").appendQueryParameter("account", String.valueOf(i)).build(), gna.a, null, null, null);
}
项目:FanFictionReader    文件:CommunityMenuActivity.java   
/**
 * Removes any path elements that begin with a digit
 * 
 * @param uri
 *            The {@link Uri} that should be formatted
 * @return The formatted Uri.
 */
private Uri removeFilters(Uri uri) {
    // Remove any prior filters by only copying the segment of the path
    // that does not start with a number.
    Builder builder = uri.buildUpon();
    builder.path(null);
    List<String> pathSegments = uri.getPathSegments();
    for (String pathSegment : pathSegments) {
        if (!Character.isDigit(pathSegment.charAt(0))) {
            builder.appendPath(pathSegment);
        } else {
            break;
        }
    }
    builder.appendPath("");
    return builder.build();
}
项目:wheels    文件:AbstractContentProviderStub.java   
private Uri buildNewUri(Uri uri, String targetAuthority) {
    Uri.Builder b = new Builder();
    b.scheme(uri.getScheme());
    b.authority(targetAuthority);
    b.path(uri.getPath());

    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        Set<String> names = uri.getQueryParameterNames();
        if (names != null && names.size() > 0) {
            for (String name : names) {
                if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
                    b.appendQueryParameter(name, uri.getQueryParameter(name));
                }
            }
        }
    } else {
        b.query(uri.getQuery());
    }
    b.fragment(uri.getFragment());
    return b.build();
}
项目:Zom-Android    文件:ContactListManagerAdapter.java   
private void removeObsoleteContactsAndLists() {
    // remove all contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    Exclusion exclusion = new Exclusion(Imps.Contacts.USERNAME, mValidatedContacts);
    mResolver.delete(mContactUrl, exclusion.getSelection(), exclusion.getSelectionArgs());

    // remove all blocked contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.BlockedList.USERNAME, mValidatedBlockedContacts);
    Uri.Builder builder = Imps.BlockedList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    Uri uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());

    // remove all contact lists for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.ContactList.NAME, mValidatedContactLists);
    builder = Imps.ContactList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());

}
项目:Zom-Android    文件:ContactListManagerAdapter.java   
void insertBlockedContactToDataBase(Contact contact) {
    // Remove the blocked contact if it already exists, to avoid duplicates and
    // handle the odd case where a blocked contact's nickname has changed
    removeBlockedContactFromDataBase(contact);

    Uri.Builder builder = Imps.BlockedList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder,  mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    Uri uri = builder.build();

    String username = mAdaptee.normalizeAddress(contact.getAddress().getAddress());
    ContentValues values = new ContentValues(2);
    values.put(Imps.BlockedList.USERNAME, username);
    values.put(Imps.BlockedList.NICKNAME, contact.getName());

    mResolver.insert(uri, values);

    mValidatedBlockedContacts.add(username);
}
项目:Zom-Android    文件:Imps.java   
public static boolean setEmptyPassphrase(Context ctx, boolean noCreate) {
    String pkey = "";

    Uri uri = Provider.CONTENT_URI_WITH_ACCOUNT;

    Builder builder = uri.buildUpon().appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, pkey);
    if (noCreate) {
        builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
    }
    uri = builder.build();

    Cursor cursor = ctx.getContentResolver().query(uri, null, null, null, null);
    if (cursor != null) {
        cursor.close();
        return true;
    }
    return false;
}
项目:Zom-Android    文件:Imps.java   
public static int updateMessageInDb(ContentResolver resolver, String id, int type, long time, long contactId) {

        Uri.Builder builder = Imps.Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
        builder.appendPath(id);

        ContentValues values = new ContentValues(2);
        values.put(Imps.Messages.TYPE, type);
        values.put(Imps.Messages.THREAD_ID, contactId);
        if (time != -1)
            values.put(Imps.Messages.DATE, time);

        int result = resolver.update(builder.build(), values, null, null);

        if (result == 0)
        {
            builder = Imps.Messages.CONTENT_URI_MESSAGES_BY_PACKET_ID.buildUpon();
            builder.appendPath(id);
            result = resolver.update(builder.build(), values, null, null);
        }

        return result;
    }
项目:Zom-Android    文件:Imps.java   
public static int updateConfirmInDb(ContentResolver resolver, long threadId, String msgId, boolean isDelivered) {
    Uri.Builder builder = Imps.Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(msgId);

    ContentValues values = new ContentValues(1);
    values.put(Imps.Messages.IS_DELIVERED, isDelivered);
    values.put(Messages.THREAD_ID,threadId);
    int result = resolver.update(builder.build(), values, null, null);

    if (result == 0)
    {
        builder = Messages.CONTENT_URI_MESSAGES_BY_PACKET_ID.buildUpon();
        builder.appendPath(msgId);
        result = resolver.update(builder.build(), values, null, null);
    }

    return result;
}
项目:Zom-Android    文件:Imps.java   
public static boolean messageExists (ContentResolver resolver, String id)
{
    boolean result = false;

    Uri.Builder builder = Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(id);

    Cursor c = resolver.query(builder.build(),null, null, null, null);
    if (c != null)
    {
        if (c.getCount() > 0)
            result = true;

        c.close();
    }

    return result;
}
项目:StreamHub-Android-Comments-App    文件:AdminClient.java   
/**
 * Generates an auth endpoint with the specified parameters.
 *
 * @param userToken    The lftoken representing a user.
 * @param collectionId The Id of the collection to auth against.
 * @param articleId    The Id of the collection's article.
 * @param siteId       The Id of the article's site.
 * @return The auth endpoint with the specified parameters.
 * @throws UnsupportedEncodingException
 * @throws MalformedURLException
 */
public static String generateAuthEndpoint(String userToken,
                                          String collectionId,
                                          String articleId,
                                          String siteId) throws UnsupportedEncodingException {
    Builder uriBuilder = new Uri.Builder()
            .scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.adminDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("api")
            .appendPath("v3.0")
            .appendPath("auth")
            .appendPath("");

    if (collectionId != null) {
        uriBuilder.appendQueryParameter("collectionId", collectionId)
                .appendQueryParameter("lftoken", userToken);
    } else {
        final String article64 = Helpers.generateBase64String(articleId);
        uriBuilder.appendQueryParameter("siteId", siteId)
                .appendQueryParameter("articleId", article64)
                .appendQueryParameter("lftoken", userToken);
    }
    Log.d("Admin URL", "" + uriBuilder.toString());
    return uriBuilder.toString();
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param collectionId The Id of the collection.
 * @param contentId
 * @param token        The token of the logged in user.
 * @param action
 * @param parameters
 * @param handler      Response handler
 */

public static void flagContent(String collectionId, String contentId,
                               String token, LFSFlag action, RequestParams parameters,
                               JsonHttpResponseHandler handler) {

    String url = (new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("api").appendPath("v3.0").appendPath("message").appendPath("")) +
            contentId + (new Uri.Builder().appendPath("").appendPath("flag")
            .appendPath(flags[action.value()])
            .appendQueryParameter("lftoken", token)
            .appendQueryParameter("collection_id", collectionId));

    Log.d("Action SDK call", "" + url);
    Log.d("Action SDK call", "" + parameters);
    HttpClient.client.post(url, parameters, handler);
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param collectionId The Id of the collection.
 * @param contentId
 * @param token        The token of the logged in user.
 * @param action
 * @param parameters
 * @param networkID    Livefyre provided network name.
 * @param handler      Response handler
 */
public static void flagContent(String collectionId, String contentId,
                               String token, LFSFlag action, RequestParams parameters,
                               String networkID, JsonHttpResponseHandler handler) {

    String url = (new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + networkID)
            .appendPath("api").appendPath("v3.0").appendPath("message").appendPath("")) +
            contentId + (new Uri.Builder().appendPath("").appendPath("flag")
            .appendPath(flags[action.value()])
            .appendQueryParameter("lftoken", token)
            .appendQueryParameter("collection_id", collectionId));

    Log.d("Action SDK call", "" + url);
    Log.d("Action SDK call", "" + parameters);
    HttpClient.client.post(url, parameters, handler);
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param action
 * @param contentId
 * @param collectionId The Id of the collection.
 * @param userToken    The token of the logged in user.
 * @param parameters
 * @param handler      Response handler
 * @throws MalformedURLException
 */

public static void featureMessage(String action, String contentId,
                                  String collectionId, String userToken,
                                  HashMap<String, Object> parameters, JsonHttpResponseHandler handler)
        throws MalformedURLException {
    RequestParams bodyParams = new RequestParams();
    bodyParams.put("lftoken", userToken);

    final Builder uriBuilder = new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("api").appendPath("v3.0").appendPath("collection")
            .appendPath(collectionId).appendPath(action)
            .appendPath(contentId).appendPath("")
            .appendQueryParameter("lftoken", userToken)
            .appendQueryParameter("collection_id", collectionId);

    Log.d("SDK", "" + uriBuilder);
    HttpClient.client.post(uriBuilder.toString(), bodyParams, handler);
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param action
 * @param contentId
 * @param collectionId The Id of the collection.
 * @param userToken    The token of the logged in user.
 * @param parameters
 * @param networkID    Livefyre provided network name
 * @param handler      Response handler
 * @throws MalformedURLException
 */
public static void featureMessage(String action, String contentId,
                                  String collectionId, String userToken,
                                  HashMap<String, Object> parameters, String networkID, JsonHttpResponseHandler handler)
        throws MalformedURLException {
    RequestParams bodyParams = new RequestParams();
    bodyParams.put("lftoken", userToken);

    final Builder uriBuilder = new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + networkID)
            .appendPath("api").appendPath("v3.0").appendPath("collection")
            .appendPath(collectionId).appendPath(action)
            .appendPath(contentId).appendPath("")
            .appendQueryParameter("lftoken", userToken)
            .appendQueryParameter("collection_id", collectionId);

    Log.d("SDK", "" + uriBuilder);
    HttpClient.client.post(uriBuilder.toString(), bodyParams, handler);
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param collectionId The Id of the collection.
 * @param contentId
 * @param token        The token of the logged in user.
 * @param action
 * @param parameters
 * @param handler      Response handler
 */

public static void postAction(String collectionId, String contentId,
                              String token, LFSActions action, RequestParams parameters,
                              JsonHttpResponseHandler handler) {
    // Build the URL
    String url = new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + LivefyreConfig.getConfiguredNetworkID())
            .appendPath("api").appendPath("v3.0").appendPath("message").appendPath("") + contentId +
            (new Uri.Builder().appendPath(actions[action.value()]).appendPath("")
                    .appendQueryParameter("lftoken", token)
                    .appendQueryParameter("collection_id", collectionId));


    Log.d("Action SDK call", "" + url);
    Log.d("Action SDK call", "" + parameters);
    HttpClient.client.post(url, parameters, handler);
}
项目:StreamHub-Android-Comments-App    文件:WriteClient.java   
/**
 * @param collectionId The Id of the collection.
 * @param contentId
 * @param token        Livefyre Token
 * @param action
 * @param parameters
 * @param networkID    Livefyre provided network name
 * @param handler      Response handler
 */

public static void postAction(String collectionId, String contentId,
                              String token, LFSActions action, RequestParams parameters,
                              String networkID, JsonHttpResponseHandler handler) {
    // Build the URL
    String url = new Uri.Builder().scheme(LivefyreConfig.scheme)
            .authority(LivefyreConfig.quillDomain + "." + networkID)
            .appendPath("api").appendPath("v3.0").appendPath("message").appendPath("") + contentId +
            (new Uri.Builder().appendPath(actions[action.value()]).appendPath("")
                    .appendQueryParameter("lftoken", token)
                    .appendQueryParameter("collection_id", collectionId));


    Log.d("Action SDK call", "" + url);
    Log.d("Action SDK call", "" + parameters);
    HttpClient.client.post(url, parameters, handler);
}