public void Jump() { Intent intent = new Intent(activity, DeviceActivity.class); intent.putExtra("Device", mDataset.get(getAdapterPosition())); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( activity, Pair.create(itemView.findViewById(R.id.device_icon), "device_icon"), Pair.create(itemView.findViewById(R.id.device_name), "device_name")); ActivityCompat.startActivity(activity, intent, options.toBundle()); }
public void addLoggingPath(String tag, String loggingPath) { if (tag == null || tag.length() == 0 || loggingPath == null || loggingPath.length() == 0) return; if (!loggingOutStreams.contains(tag)) loggingOutStreams.put(tag, Pair.<String, BufferedOutputStream>create(loggingPath, null)); }
public Pair<String, List<SpanItem>> buildWithIndices() { List<SpanItem> items = new ArrayList<>(); if (links.isEmpty()) return Pair.create(escapeSource(source), items); Collections.sort(links); final StringBuilder sb = new StringBuilder(); final int linksSize = links.size(); for (int i = 0; i < linksSize; i++) { final LinkSpec spec = links.get(i); if (spec == null) { continue; } final int start = spec.start, end = spec.end; if (i == 0) { if (start >= 0 && start <= codePointsLength) { appendSource(sb, 0, start, false, sourceIsEscaped); } } else if (i > 0) { final int lastEnd = links.get(i - 1).end; if (lastEnd >= 0 && lastEnd <= start && start <= codePointsLength) { appendSource(sb, lastEnd, start, false, sourceIsEscaped); } } int spanStart = sb.length(); if (start >= 0 && start <= end && end <= codePointsLength) { if (isEmpty(spec.display)) { append(sb, spec.link, false, false); } else { append(sb, spec.display, false, spec.displayIsHtml); } } final SpanItem item = new SpanItem(); item.start = spanStart; item.end = sb.length(); item.link = spec.link; items.add(item); if (i == linksSize - 1 && end >= 0 && end <= codePointsLength) { appendSource(sb, end, codePointsLength, false, sourceIsEscaped); } } return Pair.create(sb.toString(), items); }
public static void startThis( Context context, View imageView, @DrawableRes int imageResId, View textView, CharSequence text) { Intent intent = new Intent(context, SharedElementsActivity.class); intent.putExtra(IMAGE_RES_ID, imageResId); intent.putExtra(TEXT, text); // core ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation( (Activity) context, Pair.create(imageView, TRANSIT_IMAGE), Pair.create(textView, TRANSIT_TEXT)); try { ActivityCompat.startActivity((Activity) context, intent, optionsCompat.toBundle()); } catch (IllegalArgumentException e) { e.printStackTrace(); context.startActivity(intent); } }
public void addPattern(String pattern, int code) { patternsList.add(Pair.create(Pattern.compile(pattern), code)); }