Example usage for android.text.method LinkMovementMethod getInstance

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

Introduction

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

Prototype

public static MovementMethod getInstance() 

Source Link

Usage

From source file:org.ciasaboark.tacere.activity.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    ongoingToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);

    // Show the Up button in the action bar.
    setupActionBar();//from  w ww.  j a  va  2 s  . co  m

    TextView sourceText = (TextView) findViewById(id.about_source_text);
    sourceText.setMovementMethod(LinkMovementMethod.getInstance());
    TextView bugsText = (TextView) findViewById(id.about_bugs_text);
    bugsText.setMovementMethod(LinkMovementMethod.getInstance());
    TextView commentsText = (TextView) findViewById(id.about_comments_text);
    commentsText.setMovementMethod(LinkMovementMethod.getInstance());

    TextView versionText = (TextView) findViewById(id.about_version_number);
    String formattedVersion = String.format(getString(R.string.about_version), Versioning.getVersionCode());
    versionText.setText(formattedVersion);

    TextView basicOrPro = (TextView) findViewById(id.about_version_pro);
    String type;
    Authenticator authenticator = new Authenticator(this);
    if (authenticator.isAuthenticated()) {
        type = "Pro version";
    } else {
        type = "Basic version";
    }
    basicOrPro.setText(type);

    final View betaSettingsHeaderContent = findViewById(id.about_header_beta_settings);
    betaSettingsHeaderContent.setOnTouchListener(mOnTouch);
    final View normalHeaderContent = findViewById(id.about_header_normal);
    normalHeaderContent.setOnTouchListener(mOnTouch);
    normalHeaderContent.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });
    betaSettingsHeaderContent.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });

    final View betaSettingsClickArea = findViewById(id.about_header_beta_settings_clickarea);
    betaSettingsClickArea.setOnTouchListener(mOnTouch);
    final SwitchCompat betaSettingsSwitch = (SwitchCompat) findViewById(id.about_header_beta_settings_switch);
    final BetaPrefs betaPrefs = new BetaPrefs(this);
    betaSettingsSwitch.setChecked(betaPrefs.isBetaPrefsUnlocked());
    betaSettingsClickArea.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            betaSettingsSwitch.performClick();
            betaPrefs.setIsBetaPrefsUnlocked(betaSettingsSwitch.isChecked());
        }
    });
    betaSettingsClickArea.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });
}

From source file:org.xbmc.kore.ui.hosts.AddHostFragmentFinish.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (getView() == null)
        return;/*from   w w w . ja va2s . c o m*/

    TextView message = (TextView) getView().findViewById(R.id.done_message);
    message.setText(Html.fromHtml(getString(R.string.wizard_done_message)));
    message.setMovementMethod(LinkMovementMethod.getInstance());

    // Finish button
    Button next = (Button) getView().findViewById(R.id.next);
    next.setText(R.string.finish);
    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            listener.onAddHostFinish();
        }
    });

    // Previous button
    Button previous = (Button) getView().findViewById(R.id.previous);
    previous.setText(null);
    previous.setEnabled(false);

    // Check if PVR is enabled for the current host
    HostManager hostManager = HostManager.getInstance(getActivity());
    if (hostManager.getHostInfo() != null) {
        AddHostFragmentFinish.checkPVREnabledAndSetMenuItems(getActivity(), new Handler());
        String prefKey = Settings.KEY_PREF_CHECKED_PVR_ENABLED
                + String.valueOf(hostManager.getHostInfo().getId());
        PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean(prefKey, true).apply();
    }

    // Start the syncing process
    Intent syncIntent = new Intent(this.getActivity(), LibrarySyncService.class);
    syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MOVIES, true);
    syncIntent.putExtra(LibrarySyncService.SYNC_ALL_TVSHOWS, true);
    syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MUSIC, true);
    syncIntent.putExtra(LibrarySyncService.SYNC_ALL_MUSIC_VIDEOS, true);
    getActivity().startService(syncIntent);

    //        InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    //        imm.hideSoftInputFromWindow(getActivity()
    //                        .getWindow()
    //                        .getDecorView()
    //                        .getRootView()
    //                        .getWindowToken(), 0);
}

From source file:org.angellist.angellistmobile.UserRolesJSONAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null)
        convertView = activity.getLayoutInflater().inflate(R.layout.row_userrole, null);

    TextView textView = (TextView) convertView.findViewById(R.id.label);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    ImageView imageView = (ImageView) convertView.findViewById(R.id.logo);
    JSONObject jsonObject = getItem(position);

    try {/*from ww w  .  j  ava2 s.  co  m*/

        textView.setText("-");
        imageView.setImageResource(R.drawable.ic_launcher);
        String image = jsonObject.getJSONObject("startup").getString("logo_url");
        String startupId = jsonObject.getJSONObject("startup").getString("id");
        imageLoader.DisplayImage(image, imageView);

        String role = jsonObject.getString("role");
        String name = jsonObject.getJSONObject("startup").getString("name");

        if ("referrer".equals(role)) {
            role = "Referrer";
        } else if ("board_member".equals(role)) {
            role = "Board Member";
        } else if ("employee".equals(role)) {
            role = "Employee";
        } else if ("past_investor".equals(role)) {
            role = "Past Investor";
        } else if ("founder".equals(role)) {
            role = "Founder";
        } else if ("customer".equals(role)) {
            role = "Customer";
        } else if ("mentor".equals(role)) {
            role = "Mentor";
        } else if ("advisor".equals(role)) {
            role = "Advisor";
        }
        String allText = "";
        allText = "<a href=\"org.angellist.angellistmobile.startup://" + startupId + "\">" + name + "</a>"
                + " - " + role;
        textView.setText(Html.fromHtml(allText));

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

    return convertView;
}

From source file:open.currency.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setToolbarEnabled(true);//  w w  w.ja  va2 s.  c o m

    String desGithub = "Visit the  <a href='http://openappsproject.github.io/OpenCurrency/'>project page</a> to get more information about OpenCurrency.<br/><br/> 2015 - 2016 OpenAppsProject";
    TextView desTV = (TextView) findViewById(R.id.link_github);
    desTV.setLinksClickable(true);
    desTV.setMovementMethod(LinkMovementMethod.getInstance());
    desTV.setText(Html.fromHtml(desGithub));

    currencyArray = getResources().getStringArray(R.array.currencies);

    currency1 = (EditText) findViewById(R.id.currency1);
    currency2 = (EditText) findViewById(R.id.currency2);

    tilCur1 = (TextInputLayout) findViewById(R.id.tilCur1);
    tilCur2 = (TextInputLayout) findViewById(R.id.tilCur2);

    Spinner spinner1 = (Spinner) findViewById(R.id.spinner1);
    Spinner spinner2 = (Spinner) findViewById(R.id.spinner2);

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.currencies,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    lastEdited = 1;
    currency1.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            lastEdited = 1;
        }
    });
    currency2.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            lastEdited = 2;
        }
    });

    spinner1.setAdapter(adapter);
    spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            cur1 = position;
            tilCur1.setHint(currencyArray[position]);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    spinner2.setAdapter(adapter);
    spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            cur2 = position;
            tilCur2.setHint(currencyArray[position]);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    setFabEnabled(true);
    setFabDrawable(ContextCompat.getDrawable(this, R.drawable.ic_check_white_48dp));
    setFabListener(new View.OnClickListener() {

        Double inputValue = Double.valueOf("0");

        @Override
        public void onClick(View v) {
            currency1.setEnabled(false);
            currency2.setEnabled(false);
            try {
                if (lastEdited == 1) {
                    inputValue = Double.valueOf(currency1.getText().toString());
                } else {
                    inputValue = Double.valueOf(currency2.getText().toString());
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (inputValue.equals(Double.valueOf("0"))) {
                Snackbar.make(v, R.string.empty_value, Snackbar.LENGTH_LONG).show();
                currency1.setEnabled(true);
                currency2.setEnabled(true);
            } else if (cur1 == cur2) {
                Snackbar.make(v, R.string.sam_cur, Snackbar.LENGTH_LONG).show();
                currency1.setEnabled(true);
                currency2.setEnabled(true);
            } else {
                Action<Double> doCalculate = new Action<Double>() {
                    @NonNull
                    @Override
                    public String id() {
                        return "calculate";
                    }

                    @Nullable
                    @Override
                    protected Double run() throws InterruptedException {
                        if (lastEdited == 1) {
                            return calculate(currencyArray[cur1], currencyArray[cur2], inputValue);
                        } else {
                            return calculate(currencyArray[cur2], currencyArray[cur1], inputValue);
                        }
                    }

                    @Override
                    protected void done(@Nullable Double result) {
                        if (result != null) {
                            if (lastEdited == 1) {
                                currency2.setText(String.valueOf(result));
                            } else {
                                currency1.setText(String.valueOf(result));
                            }
                        }
                        currency1.setEnabled(true);
                        currency2.setEnabled(true);
                    }
                };
                doCalculate.execute();
            }
        }
    });
}

From source file:org.ciasaboark.tacere.activity.fragment.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_about, container, false);
    context = getActivity();/*from  w  w w . j av  a 2  s  .c  o  m*/

    ongoingToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);

    TextView sourceText = (TextView) rootView.findViewById(id.about_source_text);
    sourceText.setMovementMethod(LinkMovementMethod.getInstance());
    TextView bugsText = (TextView) rootView.findViewById(id.about_bugs_text);
    bugsText.setMovementMethod(LinkMovementMethod.getInstance());
    TextView commentsText = (TextView) rootView.findViewById(id.about_comments_text);
    commentsText.setMovementMethod(LinkMovementMethod.getInstance());

    TextView versionText = (TextView) rootView.findViewById(id.about_version_number);
    String formattedVersion = String.format(getString(R.string.about_version), Versioning.getVersionCode());
    versionText.setText(formattedVersion);
    //textview using marquee scrolling, but this only works if the textview is selected
    versionText.setSelected(true);

    TextView versionType = (TextView) rootView.findViewById(id.about_version_type);
    String type;
    Authenticator authenticator = new Authenticator(context);
    type = authenticator.getAuthenticatedTypeString() + " version";
    versionType.setText(type);

    final View betaSettingsHeaderContent = rootView.findViewById(id.about_header_beta_settings);
    betaSettingsHeaderContent.setOnTouchListener(mOnTouch);
    final View normalHeaderContent = rootView.findViewById(id.about_header_normal);
    normalHeaderContent.setOnTouchListener(mOnTouch);
    normalHeaderContent.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });
    betaSettingsHeaderContent.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });

    final View betaSettingsClickArea = rootView.findViewById(id.about_header_beta_settings_clickarea);
    betaSettingsClickArea.setOnTouchListener(mOnTouch);
    final SwitchCompat betaSettingsSwitch = (SwitchCompat) rootView
            .findViewById(id.about_header_beta_settings_switch);
    final BetaPrefs betaPrefs = new BetaPrefs(context);
    betaSettingsSwitch.setChecked(betaPrefs.isBetaPrefsUnlocked());
    betaSettingsClickArea.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            betaSettingsSwitch.performClick();
            betaPrefs.setIsBetaPrefsUnlocked(betaSettingsSwitch.isChecked());
        }
    });
    betaSettingsClickArea.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            toggleVisibility(normalHeaderContent);
            return true;
        }
    });

    return rootView;
}

From source file:com.heneryh.aquanotes.ui.controllers.NotesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mRootView = (ViewGroup) inflater.inflate(R.layout.tab_controller_notes, null);

    // Make powered-by clickable
    ((TextView) mRootView.findViewById(R.id.notes_powered_by))
            .setMovementMethod(LinkMovementMethod.getInstance());

    return mRootView;
}

From source file:com.frostwire.android.gui.fragments.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_about, container, false);

    TextView title = (TextView) view.findViewById(R.id.fragment_about_title);
    title.setText("FrostWire v" + Constants.FROSTWIRE_VERSION_STRING + " build " + Constants.FROSTWIRE_BUILD);

    TextView content = (TextView) view.findViewById(R.id.fragment_about_content);
    content.setText(Html.fromHtml(getAboutText()));
    content.setMovementMethod(LinkMovementMethod.getInstance());

    if (biller == null) {
        biller = BillerFactory.getInstance(getActivity());
    }// w  w w  .j a  v  a  2 s  .  c om

    DonationSkus skus = BillerFactory.getDonationSkus();

    setupDonateButton(view, R.id.fragment_about_button_donate1, skus.getSku(DonationSkuType.SKU_01_DOLLARS),
            "https://gumroad.com/l/pH", biller);
    setupDonateButton(view, R.id.fragment_about_button_donate2, skus.getSku(DonationSkuType.SKU_05_DOLLARS),
            "https://gumroad.com/l/oox", biller);
    setupDonateButton(view, R.id.fragment_about_button_donate3, skus.getSku(DonationSkuType.SKU_10_DOLLARS),
            "https://gumroad.com/l/rPl", biller);
    setupDonateButton(view, R.id.fragment_about_button_donate4, skus.getSku(DonationSkuType.SKU_25_DOLLARS),
            "https://gumroad.com/l/XQW", biller);

    return view;
}

From source file:com.jaspersoft.android.jaspermobile.dialog.AboutDialogFragment.java

@Override
public void onShow(DialogInterface dialog) {
    View decorView = getDialog().getWindow().getDecorView();
    if (decorView != null) {
        TextView messageText = (TextView) decorView.findViewById(android.R.id.message);
        if (messageText != null) {
            messageText.setMovementMethod(LinkMovementMethod.getInstance());
        }//from w  w  w  .j a v  a 2  s  .  c om
    }
}

From source file:com.battlelancer.seriesguide.ui.dialogs.ChangesDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View layout = inflater.inflate(R.layout.changes_dialog, null);

    // title/*from w ww  . j  av  a  2s.c o  m*/
    ((TextView) layout.findViewById(R.id.title)).setText(getString(R.string.app_name));

    // message
    TextView message = (TextView) layout.findViewById(R.id.message);
    message.setMovementMethod(LinkMovementMethod.getInstance());

    // buttons
    Button buttonNegative = (Button) layout.findViewById(R.id.buttonNegative);
    buttonNegative.setText(R.string.download_stable);
    buttonNegative.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKETLINK_APP));
                startActivity(myIntent);
            } catch (ActivityNotFoundException e) {
                Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKETLINK_HTTP));
                startActivity(myIntent);
            }
        }
    });
    Button buttonPositive = (Button) layout.findViewById(R.id.buttonPositive);
    buttonPositive.setText(R.string.gobreak);
    buttonPositive.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });

    return layout;
}

From source file:com.freshdigitable.udonroad.UserInfoView.java

public UserInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final View v = View.inflate(context, R.layout.view_user_info, this);
    name = (TextView) v.findViewById(R.id.user_name);
    screenName = (TextView) v.findViewById(R.id.user_screen_name);
    description = (TextView) v.findViewById(R.id.user_description);
    description.setMovementMethod(LinkMovementMethod.getInstance());
    banner = (ImageView) v.findViewById(R.id.user_banner);
    icon = (ImageView) v.findViewById(R.id.user_icon);
    url = (TextView) v.findViewById(R.id.user_url);
    urlIcon = v.findViewById(R.id.user_url_icon);
    location = (TextView) v.findViewById(R.id.user_location);
    locationIcon = v.findViewById(R.id.user_location_icon);
    verifiedIcon = v.findViewById(R.id.user_verified_icon);
    protectedIcon = v.findViewById(R.id.user_protected_icon);
    followingStatus = (TextView) v.findViewById(R.id.user_following);
    mutedStatus = v.findViewById(R.id.user_muted);
    ViewCompat.setTransitionName(icon, "user_icon");
}