Example usage for android.text.method LinkMovementMethod LinkMovementMethod

List of usage examples for android.text.method LinkMovementMethod LinkMovementMethod

Introduction

In this page you can find the example usage for android.text.method LinkMovementMethod LinkMovementMethod.

Prototype

LinkMovementMethod

Source Link

Usage

From source file:eu.se_bastiaan.popcorntimeremote.iab.DonationFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Activity activity = getActivity();/* w  w w .  j av  a2 s .  com*/
    assert activity != null;

    View view = getActivity().getLayoutInflater().inflate(R.layout.donation_dialog, null, false);

    AlertDialog.Builder builder = new AlertDialog.Builder(activity).setTitle(R.string.donation_title)
            .setView(view).setNegativeButton(android.R.string.cancel, null);

    TextView info = (TextView) view.findViewById(R.id.info);
    info.setText(Html.fromHtml(getString(R.string.donation_info)));
    info.setMovementMethod(new LinkMovementMethod());

    mError = (TextView) view.findViewById(R.id.error);
    mProgressBar = (ProgressBar) view.findViewById(android.R.id.progress);
    mGridView = (GridView) view.findViewById(R.id.grid);
    mGridView.setAdapter(new DonationAdapter(getActivity(), mDonationList, mInventorySet));
    mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            DonationAdapter adapter = (DonationAdapter) parent.getAdapter();
            Donation donation = adapter.getItem(position);

            if (!mInventorySet.contains(donation.sku)) {
                /**
                 * See {@link sharedcode.turboeditor.iab.DonationFragment#verifyDeveloperPayload(Purchase)}.
                 */
                String payload = "";
                try {
                    mHelper.launchPurchaseFlow(getActivity(), donation.sku, RC_REQUEST,
                            mPurchaseFinishedListener, payload);
                } catch (Exception e) {
                    Toast.makeText(getActivity(), "Failed to launch a purchase flow.", Toast.LENGTH_SHORT)
                            .show();
                }
            } else {
                Toast.makeText(getActivity(), getString(R.string.donation_item_bought), Toast.LENGTH_LONG);
            }
        }
    });

    final AlertDialog alertDialog;

    alertDialog = builder.create();

    initBilling();

    return alertDialog;
}

From source file:com.google.samples.apps.abelana.LoginActivity.java

private void displayDialog() {
    // Build the about body view and append the link to see OSS licenses
    SpannableStringBuilder aboutBody = new SpannableStringBuilder();
    aboutBody.append(Html.fromHtml(getString(R.string.splash_dialog_body)));

    LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.dialog_about, null);
    aboutBodyView.setText(aboutBody);/*from  w w w.  j a  va 2 s  . com*/
    aboutBodyView.setMovementMethod(new LinkMovementMethod());
    new AlertDialog.Builder(this).setTitle(getString(R.string.splash_dialog_title)).setView(aboutBodyView)
            .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.dismiss();
                }
            }).show();
}

From source file:com.metrekare.devfest.ArticleDetailFragment.java

public void fill() {
    // Show the dummy content as text in a TextView.
    try {// www .j  a  va 2 s  .  c  o m
        if (mItem != null) {
            ((TextView) rootView.findViewById(R.id.article_title)).setText(mItem.getString("title"));
            ((TextView) rootView.findViewById(R.id.article_byline))
                    .setText(Html.fromHtml(mItem.getString("article_date").toUpperCase(Locale.getDefault())
                            + " BY <font color='" + getResources().getString(R.string.author_font_color) + "'>"
                            + mItem.getString("author").toUpperCase(Locale.getDefault()) + "</a>"));
            ((TextView) rootView.findViewById(R.id.article_byline)).setMovementMethod(new LinkMovementMethod());
            //            ((TextView) rootView.findViewById(R.id.article_date))
            //                    .setText(mItem.time);
            ((TextView) rootView.findViewById(R.id.article_body)).setText(Html.fromHtml(CONTENT));

            Picasso.with(getActivity()).load(mItem.getString("imageUrl"))
                    .into((ImageView) rootView.findViewById(R.id.photo));

        }
    } catch (NetmeraException e) {
    }
}

From source file:com.achep.base.ui.DialogBuilder.java

/**
 * Builds dialog's view/*from  www. j  av a  2  s .  c om*/
 *
 * @throws IllegalArgumentException when type is not one of defined.
 * @see #LAYOUT_COMMON
 * @see #LAYOUT_SKELETON
 */
public View createView(int type) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    ViewGroup rootLayout = (ViewGroup) createSkeleton();
    ViewGroup contentLayout = rootLayout;

    switch (type) {
    case LAYOUT_COMMON:
        final boolean hasMessageOnly = mView == null && mViewRes == 0;
        final int layoutResource = mContentViewRes != 0 ? mContentViewRes
                : hasMessageOnly ? R.layout.dialog_message : R.layout.dialog_content;

        ViewStub viewStub = (ViewStub) inflater.inflate(R.layout.dialog_main_body, rootLayout, true)
                .findViewById(R.id.placeholder);
        viewStub.setLayoutResource(layoutResource);

        contentLayout = (ViewGroup) viewStub.inflate().findViewById(R.id.content);
        if (contentLayout == null)
            contentLayout = rootLayout;
        TextView messageView = (TextView) contentLayout.findViewById(R.id.message);

        if (messageView != null) {
            if (!TextUtils.isEmpty(mMessageText)) {
                messageView.setMovementMethod(new LinkMovementMethod());
                messageView.setText(mMessageText);
            } else {
                ViewGroup vg = (ViewGroup) messageView.getParent();
                vg.removeView(messageView);
            }
        }

        // Fall down.
    case LAYOUT_SKELETON:

        if (mViewRes != 0) {
            inflater.inflate(mViewRes, contentLayout, true);
        } else if (mView != null) {
            contentLayout.addView(mView);
        }

        return rootLayout;
    default:
        throw new IllegalArgumentException();
    }
}

From source file:com.jpventura.xyzreader.ui.ArticleDetailFragment.java

private void bindViews() {
    if (mRootView == null) {
        return;//  ww  w .j a v  a  2s  .  c  o m
    }

    mTitleView = (TextView) mRootView.findViewById(R.id.article_title);
    mSubitleView = (TextView) mRootView.findViewById(R.id.article_byline);
    mSubitleView.setMovementMethod(new LinkMovementMethod());
    mBodyView = (TextView) mRootView.findViewById(R.id.article_body);

    if (null == mCursor) {
        mRootView.setVisibility(View.GONE);
        mTitleView.setText("N/A");
        mSubitleView.setText("N/A");
        mBodyView.setText("N/A");
        return;
    }

    mRootView.setAlpha(0);
    mRootView.setVisibility(View.VISIBLE);
    mRootView.animate().alpha(1);
    mTitleView.setText(mCursor.getString(ArticleLoader.Query.TITLE));
    mSubitleView.setText(Html.fromHtml(DateUtils
            .getRelativeTimeSpanString(mCursor.getLong(ArticleLoader.Query.PUBLISHED_DATE),
                    System.currentTimeMillis(), DateUtils.HOUR_IN_MILLIS, DateUtils.FORMAT_ABBREV_ALL)
            .toString() + " by <font color='#ffffff'>" + mCursor.getString(ArticleLoader.Query.AUTHOR)
            + "</font>"));
    mBodyView.setText(Html.fromHtml(mCursor.getString(ArticleLoader.Query.BODY)));

    Picasso.with(getActivity()).load(mCursor.getString(ArticleLoader.Query.PHOTO_URL)).into(mPhotoView, this);
}

From source file:org.sirimangalo.meditationplus.AdapterCommit.java

@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = inflater.inflate(R.layout.list_item_commit, parent, false);

    final View shell = rowView.findViewById(R.id.detail_shell);

    rowView.setOnClickListener(new View.OnClickListener() {
        @Override/*  ww w.  j  ava  2s  .  c o  m*/
        public void onClick(View view) {
            boolean visible = shell.getVisibility() == View.VISIBLE;

            shell.setVisibility(visible ? View.GONE : View.VISIBLE);

            context.setCommitVisible(position, !visible);

        }
    });

    final JSONObject p = values.get(position);

    TextView title = (TextView) rowView.findViewById(R.id.title);
    TextView descV = (TextView) rowView.findViewById(R.id.desc);
    TextView defV = (TextView) rowView.findViewById(R.id.def);
    TextView usersV = (TextView) rowView.findViewById(R.id.users);
    TextView youV = (TextView) rowView.findViewById(R.id.you);

    try {

        if (p.getBoolean("open"))
            shell.setVisibility(View.VISIBLE);

        title.setText(p.getString("title"));
        descV.setText(p.getString("description"));

        String length = p.getString("length");
        String time = p.getString("time");
        final String cid = p.getString("cid");

        String def = "";

        boolean repeat = false;

        if (length.indexOf(":") > 0) {
            repeat = true;
            String[] lengtha = length.split(":");
            def += lengtha[0] + " minutes walking and " + lengtha[1] + " minutes sitting";
        } else
            def += length + " minutes total meditation";

        String period = p.getString("period");

        String day = p.getString("day");

        if (period.equals("daily")) {
            if (repeat)
                def += " every day";
            else
                def += " per day";
        } else if (period.equals("weekly")) {
            if (repeat)
                def += " every " + dow[Integer.parseInt(day)];
            else
                def += " per week";
        } else if (period.equals("monthly")) {
            if (repeat)
                def += " on the " + day
                        + (day.substring(day.length() - 1).equals("1") ? "st"
                                : (day.substring(day.length() - 1).equals("2") ? "nd"
                                        : (day.substring(day.length() - 1).equals("3") ? "rd" : "th")))
                        + " day of the month";
            else
                def += " per month";
        } else if (period.equals("yearly")) {
            if (repeat)
                def += " on the " + day
                        + (day.substring(day.length() - 1).equals("1") ? "st"
                                : (day.substring(day.length() - 1).equals("2") ? "nd"
                                        : (day.substring(day.length() - 1).equals("3") ? "rd" : "th")))
                        + " day of the year";
            else
                def += " per year";
        }

        if (!time.equals("any")) {
            Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
            utc.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time.split(":")[0]));
            utc.set(Calendar.MINUTE, Integer.parseInt(time.split(":")[1]));

            Calendar here = Calendar.getInstance();
            here.setTimeInMillis(utc.getTimeInMillis());

            int hours = here.get(Calendar.HOUR_OF_DAY);
            int minutes = here.get(Calendar.MINUTE);

            def += " at " + (time.length() == 4 ? "0" : "") + time.replace(":", "") + "h UTC <i>("
                    + (hours > 12 ? hours - 12 : hours) + ":" + ((minutes < 10 ? "0" : "") + minutes) + " "
                    + (hours > 11 && hours < 24 ? "PM" : "AM") + " your time)</i>";
        }

        defV.setText(Html.fromHtml(def));

        JSONObject usersJ = p.getJSONObject("users");

        ArrayList<String> committedArray = new ArrayList<String>();

        // collect into array

        for (int i = 0; i < usersJ.names().length(); i++) {
            try {
                String j = usersJ.names().getString(i);
                String k = j;
                //                    if(j.equals(p.getString("creator")))
                //                        k = "["+j+"]";
                committedArray.add(k);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        String text = context.getString(R.string.committed) + " ";

        // add spans

        int committed = -1;

        int pos = text.length(); // start after "Committed: "

        text += TextUtils.join(", ", committedArray);
        Spannable span = new SpannableString(text);

        span.setSpan(new StyleSpan(Typeface.BOLD), 0, pos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // bold the "Online: "

        for (int i = 0; i < committedArray.size(); i++) {
            try {

                final String oneCom = committedArray.get(i);
                String userCom = usersJ.getString(oneCom);
                //String userCom = usersJ.getString(oneCom.replace("[", "").replace("]", ""));

                //if(oneCom.replace("[","").replace("]","").equals(loggedUser))
                if (oneCom.equals(loggedUser))
                    committed = Integer.parseInt(userCom);

                int end = pos + oneCom.length();

                ClickableSpan clickable = new ClickableSpan() {

                    @Override
                    public void onClick(View widget) {
                        context.showProfile(oneCom);
                    }

                };
                span.setSpan(clickable, pos, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

                span.setSpan(new UnderlineSpan() {
                    public void updateDrawState(TextPaint tp) {
                        tp.setUnderlineText(false);
                    }
                }, pos, end, 0);

                String color = Utils.makeRedGreen(Integer.parseInt(userCom), true);

                span.setSpan(new ForegroundColorSpan(Color.parseColor("#FF" + color)), pos, end,
                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

                pos += oneCom.length() + 2;

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        usersV.setText(span);
        usersV.setMovementMethod(new LinkMovementMethod());

        if (loggedUser != null && loggedUser.length() > 0) {
            LinearLayout bl = (LinearLayout) rowView.findViewById(R.id.commit_buttons);
            if (!usersJ.has(loggedUser)) {
                Button commitB = new Button(context);
                commitB.setId(R.id.commit_button);
                commitB.setText(R.string.commit);
                commitB.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("commitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB);
            } else {
                Button commitB = new Button(context);
                commitB.setId(R.id.uncommit_button);
                commitB.setText(R.string.uncommit);
                commitB.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("uncommitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB);
            }

            if (loggedUser.equals(p.getString("creator")) || context.isAdmin) {
                Button commitB2 = new Button(context);
                commitB2.setId(R.id.edit_commit_button);
                commitB2.setText(R.string.edit);
                commitB2.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent i = new Intent(context, ActivityCommit.class);
                        i.putExtra("commitment", p.toString());
                        context.startActivity(i);
                    }
                });
                bl.addView(commitB2);

                Button commitB3 = new Button(context);
                commitB3.setId(R.id.uncommit_button);
                commitB3.setText(R.string.delete);
                commitB3.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>();
                        nvp.add(new BasicNameValuePair("full_update", "true"));

                        context.doSubmit("delcommitform_" + cid, nvp, true);
                    }
                });
                bl.addView(commitB3);
            }

        }

        if (committed > -1) {
            int color = Color.parseColor("#FF" + Utils.makeRedGreen(committed, false));
            rowView.setBackgroundColor(color);
        }

        if (committed != -1) {
            youV.setText(String.format(context.getString(R.string.you_commit_x), committed));
            youV.setVisibility(View.VISIBLE);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return rowView;
}

From source file:com.google.android.apps.iosched.ui.gtv.GoogleTVSessionLivestreamActivity.java

public void handleNoLiveSessionsAvailable() {
    getSupportLoaderManager().initLoader(UPCOMING_SESSIONS_QUERY_ID, null, this);
    updateSessionViews(PROMO_VIDEO_URL, getString(R.string.missed_io_title),
            getString(R.string.missed_io_subtitle), UIUtils.CONFERENCE_HASHTAG);

    //Make link in abstract view clickable
    TextView abstractLinkTextView = (TextView) findViewById(R.id.session_abstract);
    abstractLinkTextView.setMovementMethod(new LinkMovementMethod());
}

From source file:com.irccloud.android.activity.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, 0xff0b2e60));/*w  w  w .  ja  v a  2 s  .  c  o  m*/
        cloud.recycle();
    }

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    setContentView(R.layout.activity_login);

    loading = findViewById(R.id.loading);

    connecting = findViewById(R.id.connecting);
    connectingMsg = (TextView) findViewById(R.id.connectingMsg);
    progressBar = (ProgressBar) findViewById(R.id.connectingProgress);

    loginHint = (LinearLayout) findViewById(R.id.loginHint);
    signupHint = (LinearLayout) findViewById(R.id.signupHint);
    hostHint = (TextView) findViewById(R.id.hostHint);

    login = findViewById(R.id.login);
    name = (EditText) findViewById(R.id.name);
    if (savedInstanceState != null && savedInstanceState.containsKey("name"))
        name.setText(savedInstanceState.getString("name"));
    email = (AutoCompleteTextView) findViewById(R.id.email);
    if (BuildConfig.ENTERPRISE)
        email.setHint(R.string.email_enterprise);
    ArrayList<String> accounts = new ArrayList<String>();
    AccountManager am = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
    for (Account a : am.getAccounts()) {
        if (a.name.contains("@") && !accounts.contains(a.name))
            accounts.add(a.name);
    }
    if (accounts.size() > 0)
        email.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
                accounts.toArray(new String[accounts.size()])));

    if (savedInstanceState != null && savedInstanceState.containsKey("email"))
        email.setText(savedInstanceState.getString("email"));

    password = (EditText) findViewById(R.id.password);
    password.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                new LoginTask().execute((Void) null);
                return true;
            }
            return false;
        }
    });
    if (savedInstanceState != null && savedInstanceState.containsKey("password"))
        password.setText(savedInstanceState.getString("password"));

    host = (EditText) findViewById(R.id.host);
    if (BuildConfig.ENTERPRISE)
        host.setText(NetworkConnection.IRCCLOUD_HOST);
    else
        host.setVisibility(View.GONE);
    host.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                new LoginTask().execute((Void) null);
                return true;
            }
            return false;
        }
    });
    if (savedInstanceState != null && savedInstanceState.containsKey("host"))
        host.setText(savedInstanceState.getString("host"));
    else
        host.setText(getSharedPreferences("prefs", 0).getString("host", BuildConfig.HOST));

    if (host.getText().toString().equals("api.irccloud.com")
            || host.getText().toString().equals("www.irccloud.com"))
        host.setText("");

    loginBtn = (Button) findViewById(R.id.loginBtn);
    loginBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            new LoginTask().execute((Void) null);
        }
    });
    loginBtn.setFocusable(true);
    loginBtn.requestFocus();

    sendAccessLinkBtn = (Button) findViewById(R.id.sendAccessLink);
    sendAccessLinkBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            new ResetPasswordTask().execute((Void) null);
        }
    });

    nextBtn = (Button) findViewById(R.id.nextBtn);
    nextBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (host.getText().length() > 0) {
                NetworkConnection.IRCCLOUD_HOST = host.getText().toString();
                trimHost();

                new EnterpriseConfigTask().execute((Void) null);
            }
        }
    });

    TOS = (TextView) findViewById(R.id.TOS);
    TOS.setMovementMethod(new LinkMovementMethod());

    forgotPassword = (TextView) findViewById(R.id.forgotPassword);
    forgotPassword.setOnClickListener(forgotPasswordClickListener);

    enterpriseLearnMore = (TextView) findViewById(R.id.enterpriseLearnMore);
    enterpriseLearnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (isPackageInstalled("com.irccloud.android", LoginActivity.this)) {
                startActivity(getPackageManager().getLaunchIntentForPackage("com.irccloud.android"));
            } else {
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("market://details?id=com.irccloud.android")));
                } catch (Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("http://play.google.com/store/apps/details?id=com.irccloud.android")));
                }
            }
        }

        private boolean isPackageInstalled(String packagename, Context context) {
            PackageManager pm = context.getPackageManager();
            try {
                pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
                return true;
            } catch (NameNotFoundException e) {
                return false;
            }
        }
    });
    enterpriseHint = (LinearLayout) findViewById(R.id.enterpriseHint);

    EnterYourEmail = (TextView) findViewById(R.id.enterYourEmail);

    signupHint.setOnClickListener(signupHintClickListener);
    loginHint.setOnClickListener(loginHintClickListener);

    signupBtn = (Button) findViewById(R.id.signupBtn);
    signupBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            new LoginTask().execute((Void) null);
        }
    });

    TextView version = (TextView) findViewById(R.id.version);
    try {
        version.setText("Version " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
    } catch (NameNotFoundException e) {
        version.setVisibility(View.GONE);
    }

    Typeface LatoRegular = Typeface.createFromAsset(getAssets(), "Lato-Regular.ttf");
    Typeface LatoLightItalic = Typeface.createFromAsset(getAssets(), "Lato-LightItalic.ttf");

    for (int i = 0; i < signupHint.getChildCount(); i++) {
        View v = signupHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    for (int i = 0; i < loginHint.getChildCount(); i++) {
        View v = loginHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    LinearLayout IRCCloud = (LinearLayout) findViewById(R.id.IRCCloud);
    for (int i = 0; i < IRCCloud.getChildCount(); i++) {
        View v = IRCCloud.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    notAProblem = (LinearLayout) findViewById(R.id.notAProblem);
    for (int i = 0; i < notAProblem.getChildCount(); i++) {
        View v = notAProblem.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface((i == 0) ? LatoRegular : LatoLightItalic);
        }
    }

    loginSignupHint = (LinearLayout) findViewById(R.id.loginSignupHint);
    for (int i = 0; i < loginSignupHint.getChildCount(); i++) {
        View v = loginSignupHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
            ((TextView) v).setOnClickListener((i == 0) ? loginHintClickListener : signupHintClickListener);
        }
    }

    name.setTypeface(LatoRegular);
    email.setTypeface(LatoRegular);
    password.setTypeface(LatoRegular);
    host.setTypeface(LatoRegular);
    loginBtn.setTypeface(LatoRegular);
    signupBtn.setTypeface(LatoRegular);
    TOS.setTypeface(LatoRegular);
    EnterYourEmail.setTypeface(LatoRegular);
    hostHint.setTypeface(LatoLightItalic);

    if (BuildConfig.ENTERPRISE) {
        name.setVisibility(View.GONE);
        email.setVisibility(View.GONE);
        password.setVisibility(View.GONE);
        loginBtn.setVisibility(View.GONE);
        signupBtn.setVisibility(View.GONE);
        TOS.setVisibility(View.GONE);
        signupHint.setVisibility(View.GONE);
        loginHint.setVisibility(View.GONE);
        forgotPassword.setVisibility(View.GONE);
        loginSignupHint.setVisibility(View.GONE);
        EnterYourEmail.setVisibility(View.GONE);
        sendAccessLinkBtn.setVisibility(View.GONE);
        notAProblem.setVisibility(View.GONE);
        enterpriseLearnMore.setVisibility(View.VISIBLE);
        enterpriseHint.setVisibility(View.VISIBLE);
        host.setVisibility(View.VISIBLE);
        nextBtn.setVisibility(View.VISIBLE);
        hostHint.setVisibility(View.VISIBLE);
        host.requestFocus();
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("signup")
            && savedInstanceState.getBoolean("signup")) {
        signupHintClickListener.onClick(null);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("login")
            && savedInstanceState.getBoolean("login")) {
        loginHintClickListener.onClick(null);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("forgotPassword")
            && savedInstanceState.getBoolean("forgotPassword")) {
        forgotPasswordClickListener.onClick(null);
    }

    mResolvingError = savedInstanceState != null && savedInstanceState.getBoolean("resolving_error", false);

    mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Auth.CREDENTIALS_API)
            .addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
}

From source file:org.wikipedia.page.bottomcontent.BottomContentView.java

private void setupAttribution() {
    pageLicenseText.setText(StringUtil/*from  w w w  . jav a  2 s.  c om*/
            .fromHtml(String.format(parentFragment.getContext().getString(R.string.content_license_html),
                    parentFragment.getContext().getString(R.string.cc_by_sa_3_url))));
    pageLicenseText.setMovementMethod(new LinkMovementMethod());
}

From source file:com.todoroo.astrid.adapter.UpdateAdapter.java

private void setupUserActivityRow(View view, UserActivity activity, User user) {
    final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture);
    {//from  w w  w. j  a v  a 2 s  .c o  m
        if (user.containsNonNullValue(USER_PICTURE)) {
            String pictureUrl = user.getPictureUrl(USER_PICTURE, RemoteModel.PICTURE_THUMB);
            pictureView.setUrl(pictureUrl);
        } else {
            pictureView.setUrl(null);
        }
        pictureView.setVisibility(View.VISIBLE);
    }

    final AsyncImageView commentPictureView = (AsyncImageView) view.findViewById(R.id.comment_picture);
    {
        String pictureThumb = activity.getPictureUrl(UserActivity.PICTURE, RemoteModel.PICTURE_MEDIUM);
        String pictureFull = activity.getPictureUrl(UserActivity.PICTURE, RemoteModel.PICTURE_LARGE);
        Bitmap updateBitmap = null;
        if (TextUtils.isEmpty(pictureThumb))
            updateBitmap = activity.getPictureBitmap(UserActivity.PICTURE);
        setupImagePopupForCommentView(view, commentPictureView, pictureThumb, pictureFull, updateBitmap,
                activity.getValue(UserActivity.MESSAGE), fragment, imageCache);
    }

    // name
    final TextView nameView = (TextView) view.findViewById(R.id.title);
    {
        nameView.setText(
                getUpdateComment((AstridActivity) fragment.getActivity(), activity, user, linkColor, fromView));
        nameView.setMovementMethod(new LinkMovementMethod());
        nameView.setTextColor(color);
    }

    // date
    final TextView date = (TextView) view.findViewById(R.id.date);
    {
        CharSequence dateString = DateUtils.getRelativeTimeSpanString(
                activity.getValue(UserActivity.CREATED_AT), DateUtilities.now(), DateUtils.MINUTE_IN_MILLIS,
                DateUtils.FORMAT_ABBREV_RELATIVE);
        date.setText(dateString);
    }
}