List of usage examples for android.util Pair Pair
public Pair(F first, S second)
From source file:com.taobao.weex.ui.component.WXVContainer.java
protected Pair<WXComponent, Integer> rearrangeIndexAndGetChild(int index) { int indexToCreate = index; if (indexToCreate < 0) { indexToCreate = childCount() - 1; }/*from w ww .ja v a2 s .c o m*/ if (indexToCreate < 0) { return new Pair<>(null, indexToCreate); } else { return new Pair<>(getChild(indexToCreate), indexToCreate); } }
From source file:pl.xsolve.verfluchter.rest.RestClient.java
public void setupBasicAuth(String basicLogin, String basicPass) { basicAuthCredentials = new Pair<String, String>(basicLogin, basicPass); }
From source file:com.hackvg.android.views.activities.MoviesActivity.java
@SuppressWarnings("unchecked") @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void startDetailActivityBySharedElements(View touchedView, int moviePosition, Intent movieDetailActivityIntent) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this, new Pair<>(touchedView, SHARED_ELEMENT_COVER + moviePosition)); startActivity(movieDetailActivityIntent, options.toBundle()); }
From source file:com.google.android.apps.gutenberg.provider.SyncAdapter.java
private static Pair<String[], ContentValues[]> parseEvents(JSONArray events) throws JSONException { int length = events.length(); ContentValues[] array = new ContentValues[length]; String[] ids = new String[length]; for (int i = 0; i < length; ++i) { JSONObject event = events.getJSONObject(i); array[i] = new ContentValues(); String id = event.getString("id"); ids[i] = id;/*from w ww. j a va2 s . c om*/ array[i].put(Table.Event.ID, id); array[i].put(Table.Event.NAME, event.getString("name")); array[i].put(Table.Event.PLACE, event.getString("place")); array[i].put(Table.Event.ORGANIZER_NAME, event.getString("organizerName")); array[i].put(Table.Event.START_TIME, event.getString("startTime")); array[i].put(Table.Event.END_TIME, event.getString("endTime")); } return new Pair<>(ids, array); }
From source file:org.runnerup.workout.WorkoutSerializer.java
private static Pair<Dimension, Range> getTarget(JSONObject obj) { String targetTypeKey = getString(obj, "targetTypeKey"); if (targetTypeKey == null) return NullTargetPair; if (targetTypeKey.equalsIgnoreCase("no.target")) return NullTargetPair; Dimension dim = null;/* w w w .j a v a 2 s .c o m*/ Range range = null; if (targetTypeKey.equalsIgnoreCase("pace.zone")) { dim = Dimension.PACE; range = new Range(SafeParse.parseDouble(getString(obj, "targetValueOne"), 0), SafeParse.parseDouble(getString(obj, "targetValueTwo"), 0)); scale(range, dim, obj, "targetValueUnitKey"); } else if (targetTypeKey.equalsIgnoreCase("speed.zone")) { dim = Dimension.SPEED; range = new Range(SafeParse.parseDouble(getString(obj, "targetValueOne"), 0), SafeParse.parseDouble(getString(obj, "targetValueTwo"), 0)); scale(range, dim, obj, "targetValueUnitKey"); } else if (targetTypeKey.equalsIgnoreCase("heart.rate.zone")) { dim = Dimension.HR; range = new Range(SafeParse.parseDouble(getString(obj, "targetValueOne"), 0), SafeParse.parseDouble(getString(obj, "targetValueTwo"), 0)); scale(range, dim, obj, "targetValueUnitKey"); } else if (targetTypeKey.equalsIgnoreCase("cadence")) { // Not implemented return NullTargetPair; } return new Pair<Dimension, Range>(dim, range); }
From source file:mobisocial.musubi.identity.AphidIdentityProvider.java
public void setTokenForUser(Authority authority, String principal, String token) { mKnownTokens.put(new Pair<Authority, String>(authority, principal), token); }
From source file:com.jbirdvegas.mgerrit.PatchSetViewerActivity.java
@DebugLog public Pair<String, Integer> getChangeAtPosition(int position) { mCursor.moveToPosition(position);/*from www . j a v a 2 s. com*/ return new Pair<>(mCursor.getString(sChangeIdIndex), mCursor.getInt(sChangeNumberIndex)); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.VoiceObj.java
@Override public Pair<JSONObject, byte[]> handleOutgoing(JSONObject json) { byte[] bytes = Base64.decode(json.optString(DATA), Base64.DEFAULT); json.remove(DATA);/*from ww w . j a va 2 s . com*/ return new Pair<JSONObject, byte[]>(json, bytes); }
From source file:com.microsoft.windowsazure.mobileservices.sdk.testapp.test.MobileServiceFeaturesTests.java
public void testTypedTableDeleteWithParametersFeatureHeader() { testTableFeatureHeader(new TableTestOperation() { @Override/*from ww w. j a v a 2 s .c o m*/ public void executeOperation(MobileServiceTable<PersonTestObjectWithStringId> typedTable, MobileServiceJsonTable jsonTable) throws Exception { PersonTestObjectWithStringId pto = new PersonTestObjectWithStringId("John", "Doe", 33); pto.setId("the-id"); List<Pair<String, String>> queryParams = new ArrayList<Pair<String, String>>(); queryParams.add(new Pair<String, String>("a", "b")); typedTable.delete(pto, queryParams).get(); } }, false, "QS,TT"); }
From source file:com.ichi2.libanki.Finder.java
public Pair<String, String[]> _where(String[] tokens) { // state and query SearchState s = new SearchState(); List<String> args = new ArrayList<String>(); for (String token : tokens) { if (s.bad) { return new Pair<String, String[]>(null, null); }/*from ww w .j a va 2 s.com*/ // special tokens if (token.equals("-")) { s.isnot = true; } else if (token.equalsIgnoreCase("or")) { s.isor = true; } else if (token.equals("(")) { s.add(token, false); s.join = false; } else if (token.equals(")")) { s.q += ")"; // commands } else if (token.contains(":")) { String[] spl = token.split(":", 2); String cmd = spl[0].toLowerCase(Locale.US); String val = spl[1]; if (cmd.equals("added")) { s.add(_findAdded(val)); } else if (cmd.equals("card")) { s.add(_findTemplate(val)); } else if (cmd.equals("deck")) { s.add(_findDeck(val)); } else if (cmd.equals("mid")) { s.add(_findMid(val)); } else if (cmd.equals("nid")) { s.add(_findNids(val)); } else if (cmd.equals("cid")) { s.add(_findCids(val)); } else if (cmd.equals("note")) { s.add(_findModel(val)); } else if (cmd.equals("prop")) { s.add(_findProp(val)); } else if (cmd.equals("rated")) { s.add(_findRated(val)); } else if (cmd.equals("tag")) { s.add(_findTag(val, args)); } else if (cmd.equals("dupe")) { s.add(_findDupes(val)); } else if (cmd.equals("is")) { s.add(_findCardState(val)); } else { s.add(_findField(cmd, val)); } // normal text search } else { s.add(_findText(token, args)); } } if (s.bad) { return new Pair<String, String[]>(null, null); } return new Pair<String, String[]>(s.q, args.toArray(new String[args.size()])); }