Android Open Source - android-whogoesfirst Ui






From Project

Back to project page android-whogoesfirst.

License

The source code is released under:

MIT License

If you think the Android project android-whogoesfirst listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.idunnolol.whogoesfirst;
// ww w .j a  v a 2  s. co  m
import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
import android.view.View;

/**
 * Ui utils.  Inspired by some Code 42 love.
 */
public class Ui {

  @SuppressWarnings("unchecked")
  public static <T extends View> T findView(Activity activity, int id) {
    return (T) activity.findViewById(id);
  }

  @SuppressWarnings("unchecked")
  public static <T extends View> T findView(View view, int id) {
    return (T) view.findViewById(id);
  }

  @SuppressWarnings("unchecked")
  public static <T extends Fragment> T findFragment(FragmentActivity activity, String tag) {
    return (T) activity.getSupportFragmentManager().findFragmentByTag(tag);
  }

  public static CharSequence createHighlightedText(String text, String highlight, int highlightColor) {
    Spannable spannable = Spannable.Factory.getInstance().newSpannable(text);
    int start = text.indexOf(highlight);
    spannable.setSpan(new ForegroundColorSpan(highlightColor), start, start + highlight.length(),
        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannable;
  }
}




Java Source Code List

com.idunnolol.whogoesfirst.ArrowRow.java
com.idunnolol.whogoesfirst.ArrowView.java
com.idunnolol.whogoesfirst.MainActivity.java
com.idunnolol.whogoesfirst.MorePlayersDialogFragment.java
com.idunnolol.whogoesfirst.PlayerCountFragment.java
com.idunnolol.whogoesfirst.PlayerCountListener.java
com.idunnolol.whogoesfirst.Ui.java
com.idunnolol.whogoesfirst.WhoGoesFragment.java