Example usage for android.widget TextView setMovementMethod

List of usage examples for android.widget TextView setMovementMethod

Introduction

In this page you can find the example usage for android.widget TextView setMovementMethod.

Prototype

public final void setMovementMethod(MovementMethod movement) 

Source Link

Document

Sets the android.text.method.MovementMethod for handling arrow key movement for this TextView.

Usage

From source file:org.catnut.ui.HelloActivity.java

private void init() {
    setContentView(R.layout.about);/*from   ww  w  . j  a v a 2 s  . com*/

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setOnPageChangeListener(new PagerListener());

    mImages = new ArrayList<Image>();

    mPagerAdapter = new Gallery();
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setPageTransformer(true, new PageTransformer.DepthPageTransformer());
    if (mTargetFromGrid != null) {
        mImages.add(mTargetFromGrid);
        mPagerAdapter.notifyDataSetChanged();
    }

    mAbout = findViewById(R.id.about);
    mFantasyDesc = (TextView) findViewById(R.id.description);
    mFantasyDesc.setMovementMethod(LinkMovementMethod.getInstance());
    ActionBar bar = getActionBar();
    TextView about = (TextView) findViewById(R.id.about_body);
    TextView version = (TextView) findViewById(R.id.app_version);
    TextView appName = (TextView) findViewById(R.id.app_name);
    TextView weiboApp = (TextView) findViewById(R.id.weibo_app);
    weiboApp.setText(R.string.weibo_app);
    appName.setText(R.string.app_name);
    TextView appDesc = (TextView) findViewById(R.id.app_desc);
    appDesc.setText(R.string.app_desc);
    if (CatnutApp.getBoolean(R.string.pref_fantasy_say_salutation, R.bool.default_fantasy_say_salutation)) {
        version.setText(getString(R.string.about_version_template, getString(R.string.version_name)));
        int n = (int) (Math.random() * 101);
        if (0 < n && n < 35) {
            bar.setTitle(R.string.fantasy);
            about.setText(Html.fromHtml(getString(R.string.about_body)));
            about.setMovementMethod(LinkMovementMethod.getInstance());
        } else {
            bar.setTitle(R.string.fantasy);
            about.setText(Html.fromHtml(getString(R.string.salutation)));
            about.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
        }
    } else {
        mAbout.setVisibility(View.GONE);
    }

    loadImage();
    mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    if (mApp.getPreferences().getBoolean(getString(R.string.enable_analytics), true)) {
        mTracker = EasyTracker.getInstance(this);
    }
}

From source file:com.gelakinetic.mtgfam.activities.MainActivity.java

public void showDialogFragment(final int id) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction. We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    this.showContent();
    FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction();
    Fragment prev = getSupportFragmentManager().findFragmentByTag(FamiliarFragment.DIALOG_TAG);
    if (prev != null) {
        ft.remove(prev);//  ww  w.  ja  v  a2s  .  c  o  m
    }

    // Create and show the dialog.
    FamiliarDialogFragment newFragment = new FamiliarDialogFragment() {

        @Override
        public void onDismiss(DialogInterface mDialog) {
            super.onDismiss(mDialog);
            if (bounceMenu) {
                getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
                bounceMenu = false;
                Runnable r = new Runnable() {

                    @Override
                    public void run() {
                        long timeStarted = System.currentTimeMillis();
                        Message msg = Message.obtain();
                        msg.arg1 = OPEN;
                        bounceHandler.sendMessage(msg);
                        while (System.currentTimeMillis() < (timeStarted + 1500)) {
                            ;
                        }
                        msg = Message.obtain();
                        msg.arg1 = CLOSE;
                        bounceHandler.sendMessage(msg);
                        runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
                            }
                        });
                    }
                };

                Thread t = new Thread(r);
                t.start();
            }
        }

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            switch (id) {
            case DONATEDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
                builder.setTitle(R.string.main_donate_dialog_title);
                builder.setNeutralButton(R.string.dialog_thanks_anyway, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                LayoutInflater inflater = this.getActivity().getLayoutInflater();
                View dialoglayout = inflater.inflate(R.layout.about_dialog,
                        (ViewGroup) findViewById(R.id.dialog_layout_root));

                TextView text = (TextView) dialoglayout.findViewById(R.id.aboutfield);
                text.setText(ImageGetterHelper.jellyBeanHack(getString(R.string.main_donate_text)));
                text.setMovementMethod(LinkMovementMethod.getInstance());

                text.setTextSize(15);

                ImageView paypal = (ImageView) dialoglayout.findViewById(R.id.imageview1);
                paypal.setImageResource(R.drawable.paypal);
                paypal.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {
                        Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                                "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=SZK4TAH2XBZNC&lc=US&item_name=MTG%20Familiar&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"));

                        startActivity(myIntent);
                    }
                });
                ((ImageView) dialoglayout.findViewById(R.id.imageview2)).setVisibility(View.GONE);

                builder.setView(dialoglayout);
                return builder.create();
            }
            case ABOUTDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());

                // You have to catch the exception because the package stuff is all
                // run-time
                if (pInfo != null) {
                    builder.setTitle(getString(R.string.main_about) + " " + getString(R.string.app_name) + " "
                            + pInfo.versionName);
                } else {
                    builder.setTitle(getString(R.string.main_about) + " " + getString(R.string.app_name));
                }

                builder.setNeutralButton(R.string.dialog_thanks, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                LayoutInflater inflater = this.getActivity().getLayoutInflater();
                View dialoglayout = inflater.inflate(R.layout.about_dialog,
                        (ViewGroup) findViewById(R.id.dialog_layout_root));

                TextView text = (TextView) dialoglayout.findViewById(R.id.aboutfield);
                text.setText(ImageGetterHelper.jellyBeanHack(getString(R.string.main_about_text)));
                text.setMovementMethod(LinkMovementMethod.getInstance());

                builder.setView(dialoglayout);
                return builder.create();
            }
            case CHANGELOGDIALOG: {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());

                if (pInfo != null) {
                    builder.setTitle(getString(R.string.main_whats_new_in_title) + " " + pInfo.versionName);
                } else {
                    builder.setTitle(R.string.main_whats_new_title);
                }

                builder.setNeutralButton(R.string.dialog_enjoy, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });

                builder.setMessage(ImageGetterHelper.jellyBeanHack(getString(R.string.main_whats_new_text)));
                return builder.create();
            }
            default: {
                savedInstanceState.putInt("id", id);
                return super.onCreateDialog(savedInstanceState);
            }
            }
        }
    };
    newFragment.show(ft, FamiliarFragment.DIALOG_TAG);
}

From source file:cw.kop.autobackground.tutorial.FinishFragment.java

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

    View view = inflater.inflate(R.layout.tutorial_finish_fragment, container, false);
    int colorFilterInt = AppSettings.getColorFilterInt(appContext);

    TextView titleText = (TextView) view.findViewById(R.id.title_text);
    titleText.setTextColor(colorFilterInt);
    titleText.setText("That's it.");

    TextView tutorialText = (TextView) view.findViewById(R.id.tutorial_text);
    tutorialText.setTextColor(colorFilterInt);
    tutorialText.setText("Now you're ready to use AutoBackground. I'd suggest adding a new source first "
            + "and then hitting download." + "\n" + "\n"
            + "If you have any questions, concerns, suggestions, or whatever else, feel free to "
            + "email me at ");
    SpannableString emailString = new SpannableString("chiuwinson@gmail.com");
    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override//from w  ww .ja v  a2  s. com
        public void onClick(View widget) {
            Log.i(TAG, "Clicked");
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "chiuwinson@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "AutoBackground Feedback");
            startActivity(Intent.createChooser(emailIntent, "Send email"));
        }
    };
    emailString.setSpan(clickableSpan, 0, emailString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    tutorialText.append(emailString);
    tutorialText.append(".");
    tutorialText.setMovementMethod(LinkMovementMethod.getInstance());

    return view;
}

From source file:com.master.metehan.filtereagle.ActivityMain.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "Create version=" + Util.getSelfVersionName(this) + "/" + Util.getSelfVersionCode(this));
    Util.logExtras(getIntent());/*from w w  w. jav a2 s. c om*/

    if (Build.VERSION.SDK_INT < MIN_SDK) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.android);
        return;
    }

    Util.setTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    running = true;

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean enabled = prefs.getBoolean("enabled", false);
    boolean initialized = prefs.getBoolean("initialized", false);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean("registered", true).commit();
    editor.putBoolean("logged", false).commit();
    prefs.edit().remove("hint_system").apply();

    // Register app
    String key = this.getString(R.string.app_key);
    String server_url = this.getString(R.string.serverurl);
    Register register = new Register(server_url, key, getApplicationContext());
    register.registerApp();

    // Upgrade
    Receiver.upgrade(initialized, this);

    if (!getIntent().hasExtra(EXTRA_APPROVE)) {
        if (enabled)
            ServiceSinkhole.start("UI", this);
        else
            ServiceSinkhole.stop("UI", this);
    }

    // Action bar
    final View actionView = getLayoutInflater().inflate(R.layout.actionmain, null, false);
    ivIcon = (ImageView) actionView.findViewById(R.id.ivIcon);
    ivQueue = (ImageView) actionView.findViewById(R.id.ivQueue);
    swEnabled = (SwitchCompat) actionView.findViewById(R.id.swEnabled);
    ivMetered = (ImageView) actionView.findViewById(R.id.ivMetered);

    // Icon
    ivIcon.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            menu_about();
            return true;
        }
    });

    // Title
    getSupportActionBar().setTitle(null);

    // Netguard is busy
    ivQueue.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            int location[] = new int[2];
            actionView.getLocationOnScreen(location);
            Toast toast = Toast.makeText(ActivityMain.this, R.string.msg_queue, Toast.LENGTH_LONG);
            toast.setGravity(Gravity.TOP | Gravity.LEFT, location[0] + ivQueue.getLeft(),
                    Math.round(location[1] + ivQueue.getBottom() - toast.getView().getPaddingTop()));
            toast.show();
            return true;
        }
    });

    // On/off switch
    swEnabled.setChecked(enabled);
    swEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Log.i(TAG, "Switch=" + isChecked);
            prefs.edit().putBoolean("enabled", isChecked).apply();

            if (isChecked) {
                try {
                    final Intent prepare = VpnService.prepare(ActivityMain.this);
                    if (prepare == null) {
                        Log.i(TAG, "Prepare done");
                        onActivityResult(REQUEST_VPN, RESULT_OK, null);
                    } else {
                        // Show dialog
                        LayoutInflater inflater = LayoutInflater.from(ActivityMain.this);
                        View view = inflater.inflate(R.layout.vpn, null, false);
                        dialogVpn = new AlertDialog.Builder(ActivityMain.this).setView(view)
                                .setCancelable(false)
                                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        if (running) {
                                            Log.i(TAG, "Start intent=" + prepare);
                                            try {
                                                // com.android.vpndialogs.ConfirmDialog required
                                                startActivityForResult(prepare, REQUEST_VPN);
                                            } catch (Throwable ex) {
                                                Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                                                Util.sendCrashReport(ex, ActivityMain.this);
                                                onActivityResult(REQUEST_VPN, RESULT_CANCELED, null);
                                                prefs.edit().putBoolean("enabled", false).apply();
                                            }
                                        }
                                    }
                                }).setOnDismissListener(new DialogInterface.OnDismissListener() {
                                    @Override
                                    public void onDismiss(DialogInterface dialogInterface) {
                                        dialogVpn = null;
                                    }
                                }).create();
                        dialogVpn.show();
                    }
                } catch (Throwable ex) {
                    // Prepare failed
                    Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                    Util.sendCrashReport(ex, ActivityMain.this);
                    prefs.edit().putBoolean("enabled", false).apply();
                }

            } else
                ServiceSinkhole.stop("switch off", ActivityMain.this);
        }
    });
    if (enabled)
        checkDoze();

    // Network is metered
    ivMetered.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View view) {
            int location[] = new int[2];
            actionView.getLocationOnScreen(location);
            Toast toast = Toast.makeText(ActivityMain.this, R.string.msg_metered, Toast.LENGTH_LONG);
            toast.setGravity(Gravity.TOP | Gravity.LEFT, location[0] + ivMetered.getLeft(),
                    Math.round(location[1] + ivMetered.getBottom() - toast.getView().getPaddingTop()));
            toast.show();
            return true;
        }
    });

    getSupportActionBar().setDisplayShowCustomEnabled(true);
    getSupportActionBar().setCustomView(actionView);

    // Disabled warning
    TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
    tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);

    // Application list
    RecyclerView rvApplication = (RecyclerView) findViewById(R.id.rvApplication);
    rvApplication.setHasFixedSize(true);
    rvApplication.setLayoutManager(new LinearLayoutManager(this));
    adapter = new AdapterRule(this);
    rvApplication.setAdapter(adapter);

    // Swipe to refresh
    TypedValue tv = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
    swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipeRefresh);
    swipeRefresh.setColorSchemeColors(Color.WHITE, Color.WHITE, Color.WHITE);
    swipeRefresh.setProgressBackgroundColorSchemeColor(tv.data);
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Rule.clearCache(ActivityMain.this);
            ServiceSinkhole.reload("pull", ActivityMain.this);
            updateApplicationList(null);
        }
    });

    final LinearLayout llSystem = (LinearLayout) findViewById(R.id.llSystem);
    Button btnSystem = (Button) findViewById(R.id.btnSystem);
    boolean system = prefs.getBoolean("manage_system", false);
    boolean hint = prefs.getBoolean("hint_system", true);
    llSystem.setVisibility(!system && hint ? View.VISIBLE : View.GONE);
    btnSystem.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            prefs.edit().putBoolean("hint_system", false).apply();
            llSystem.setVisibility(View.GONE);
        }
    });

    // Listen for preference changes
    prefs.registerOnSharedPreferenceChangeListener(this);

    // Listen for rule set changes
    IntentFilter ifr = new IntentFilter(ACTION_RULES_CHANGED);
    LocalBroadcastManager.getInstance(this).registerReceiver(onRulesChanged, ifr);

    // Listen for queue changes
    IntentFilter ifq = new IntentFilter(ACTION_QUEUE_CHANGED);
    LocalBroadcastManager.getInstance(this).registerReceiver(onQueueChanged, ifq);

    // Listen for added/removed applications
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
    intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
    intentFilter.addDataScheme("package");
    registerReceiver(packageChangedReceiver, intentFilter);

    // First use
    if (!initialized) {
        // Create view
        LayoutInflater inflater = LayoutInflater.from(this);
        View view = inflater.inflate(R.layout.first, null, false);
        TextView tvFirst = (TextView) view.findViewById(R.id.tvFirst);
        tvFirst.setMovementMethod(LinkMovementMethod.getInstance());

        // Show dialog
        dialogFirst = new AlertDialog.Builder(this).setView(view).setCancelable(false)
                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (running)
                            prefs.edit().putBoolean("initialized", true).apply();
                    }
                }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (running)
                            finish();
                    }
                }).setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialogInterface) {
                        dialogFirst = null;
                    }
                }).create();
        dialogFirst.show();
    }

    // Fill application list
    updateApplicationList(getIntent().getStringExtra(EXTRA_SEARCH));

    // Update IAB SKUs
    try {
        iab = new IAB(new IAB.Delegate() {
            @Override
            public void onReady(IAB iab) {
                try {
                    iab.updatePurchases();

                    if (!IAB.isPurchased(ActivityPro.SKU_LOG, ActivityMain.this))
                        prefs.edit().putBoolean("log", false).apply();
                    if (!IAB.isPurchased(ActivityPro.SKU_THEME, ActivityMain.this)) {
                        if (!"teal".equals(prefs.getString("theme", "teal")))
                            prefs.edit().putString("theme", "teal").apply();
                    }
                    if (!IAB.isPurchased(ActivityPro.SKU_SPEED, ActivityMain.this))
                        prefs.edit().putBoolean("show_stats", false).apply();
                } catch (Throwable ex) {
                    Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                } finally {
                    iab.unbind();
                }
            }
        }, this);
        iab.bind();
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
    }

    checkExtras(getIntent());
}

From source file:com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever.java

final void append(String itemID, String source, String[] newTexts, String linkURL) throws InterruptedException {

    final TextView textView = textViewRef.get();
    if (textView == null) {
        throw new InterruptedException();
    }// ww w  .  ja va  2 s .  c  om

    StringBuilder newTextCombined = new StringBuilder();

    if (source != null) {
        newTextCombined.append(source).append(" : ");
    }

    int linkStart = newTextCombined.length();

    boolean first = true;
    for (String newText : newTexts) {
        if (first) {
            newTextCombined.append(newText);
            first = false;
        } else {
            newTextCombined.append(" [");
            newTextCombined.append(newText);
            newTextCombined.append(']');
        }
    }

    int linkEnd = newTextCombined.length();

    String newText = newTextCombined.toString();
    final Spannable content = new SpannableString(newText + "\n\n");
    if (linkURL != null) {
        content.setSpan(new URLSpan(linkURL), linkStart, linkEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    handler.post(new Runnable() {
        public void run() {
            textView.append(content);
            textView.setMovementMethod(LinkMovementMethod.getInstance());
        }
    });

    // Add the text to the history.
    historyManager.addHistoryItemDetails(itemID, newText);
}

From source file:com.joyepay.qrcode.result.supplement.SupplementalInfoRetriever.java

final void append(String itemID, String source, String[] newTexts, String linkURL) throws InterruptedException {

    final TextView textView = textViewRef.get();
    if (textView == null) {
        throw new InterruptedException();
    }//from  w w w  .  j  ava 2  s .c o m

    StringBuilder newTextCombined = new StringBuilder();

    if (source != null) {
        newTextCombined.append(source).append(" : ");
    }

    int linkStart = newTextCombined.length();

    boolean first = true;
    for (String newText : newTexts) {
        if (first) {
            newTextCombined.append(newText);
            first = false;
        } else {
            newTextCombined.append(" [");
            newTextCombined.append(newText);
            newTextCombined.append(']');
        }
    }

    int linkEnd = newTextCombined.length();

    String newText = newTextCombined.toString();
    final Spannable content = new SpannableString(newText + "\n\n");
    if (linkURL != null) {
        content.setSpan(new URLSpan(linkURL), linkStart, linkEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    handler.post(new Runnable() {
        public void run() {
            textView.append(content);
            textView.setMovementMethod(LinkMovementMethod.getInstance());
        }
    });

    // Add the text to the history.
    //    historyManager.addHistoryItemDetails(itemID, newText);
}

From source file:co.dilaver.quoter.fragments.CreditsFragment.java

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

    TextView androidLink = (TextView) view.findViewById(R.id.tvAndroidLink);
    TextView androidSupportLibraryLink = (TextView) view.findViewById(R.id.tvAndroidSupportLibraryLink);
    TextView asyncHTTPLink = (TextView) view.findViewById(R.id.tvAsyncHTTPLink);
    TextView gsonLink = (TextView) view.findViewById(R.id.tvGsonLink);
    TextView autoTextViewLink = (TextView) view.findViewById(R.id.tvAutoTextViewLink);
    TextView lobsterpickerLink = (TextView) view.findViewById(R.id.tvLobsterpickerLink);
    TextView fButtonLink = (TextView) view.findViewById(R.id.tvFButtonLink);
    TextView jSoupLink = (TextView) view.findViewById(R.id.tvJSoupLink);
    TextView circleImageViewLink = (TextView) view.findViewById(R.id.tvCircleImageViewLink);

    TextView googleCredit = (TextView) view.findViewById(R.id.tvGoogleCredit);
    TextView freepikCredit = (TextView) view.findViewById(R.id.tvFreepikCredit);
    TextView qodCredit = (TextView) view.findViewById(R.id.tvQodCredit);
    TextView popularCredit = (TextView) view.findViewById(R.id.tvPopularCredit);
    TextView fontsCredit = (TextView) view.findViewById(R.id.tvFontsCredit);
    TextView backgroundCredit = (TextView) view.findViewById(R.id.tvBackgroundCredit);

    androidLink.setMovementMethod(LinkMovementMethod.getInstance());
    androidSupportLibraryLink.setMovementMethod(LinkMovementMethod.getInstance());
    asyncHTTPLink.setMovementMethod(LinkMovementMethod.getInstance());
    gsonLink.setMovementMethod(LinkMovementMethod.getInstance());
    autoTextViewLink.setMovementMethod(LinkMovementMethod.getInstance());
    lobsterpickerLink.setMovementMethod(LinkMovementMethod.getInstance());
    fButtonLink.setMovementMethod(LinkMovementMethod.getInstance());
    jSoupLink.setMovementMethod(LinkMovementMethod.getInstance());
    circleImageViewLink.setMovementMethod(LinkMovementMethod.getInstance());

    googleCredit.setText(Html.fromHtml(getString(R.string.str_googleCredit)));
    googleCredit.setMovementMethod(LinkMovementMethod.getInstance());

    freepikCredit.setText(Html.fromHtml(getString(R.string.str_freepikCredit)));
    freepikCredit.setMovementMethod(LinkMovementMethod.getInstance());

    qodCredit.setMovementMethod(LinkMovementMethod.getInstance());
    popularCredit.setMovementMethod(LinkMovementMethod.getInstance());
    fontsCredit.setMovementMethod(LinkMovementMethod.getInstance());
    backgroundCredit.setMovementMethod(LinkMovementMethod.getInstance());

    return view;// ww w  .  j  a  v  a  2  s . c  o m
}

From source file:com.master.metehan.filtereagle.ActivityMain.java

private void menu_about() {
    // Create view
    LayoutInflater inflater = LayoutInflater.from(this);
    View view = inflater.inflate(R.layout.about, null, false);
    TextView tvVersionName = (TextView) view.findViewById(R.id.tvVersionName);
    TextView tvVersionCode = (TextView) view.findViewById(R.id.tvVersionCode);
    Button btnRate = (Button) view.findViewById(R.id.btnRate);
    TextView tvLicense = (TextView) view.findViewById(R.id.tvLicense);

    // Show version
    tvVersionName.setText(Util.getSelfVersionName(this));
    if (!Util.hasValidFingerprint(this))
        tvVersionName.setTextColor(Color.GRAY);
    tvVersionCode.setText(Integer.toString(Util.getSelfVersionCode(this)));

    // Handle license
    tvLicense.setMovementMethod(LinkMovementMethod.getInstance());

    // Handle logcat
    view.setOnClickListener(new View.OnClickListener() {
        private short tap = 0;
        private Toast toast = Toast.makeText(ActivityMain.this, "", Toast.LENGTH_SHORT);

        @Override//from  w  w  w .j  a v a 2s  .c o m
        public void onClick(View view) {
            tap++;
            if (tap == 7) {
                tap = 0;
                toast.cancel();

                Intent intent = getIntentLogcat();
                if (intent.resolveActivity(getPackageManager()) != null)
                    startActivityForResult(intent, REQUEST_LOGCAT);

            } else if (tap > 3) {
                toast.setText(Integer.toString(7 - tap));
                toast.show();
            }
        }
    });

    // Handle rate
    btnRate.setVisibility(
            getIntentRate(this).resolveActivity(getPackageManager()) == null ? View.GONE : View.VISIBLE);
    btnRate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(getIntentRate(ActivityMain.this));
        }
    });

    // Show dialog
    dialogAbout = new AlertDialog.Builder(this).setView(view).setCancelable(true)
            .setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    dialogAbout = null;
                }
            }).create();
    dialogAbout.show();
}

From source file:com.heath_bar.tvdb.EpisodeDetails.java

/** Update the GUI with the specified rating */
private void setUserRatingTextView(int rating) {

    TextView ratingTextView = (TextView) findViewById(R.id.rating);
    String communityRatingText = myEpisode.getRating() + " / 10";

    String ratingTextA = communityRatingText + "  (";
    String ratingTextB = (rating == 0) ? "rate" : String.valueOf(rating);
    String ratingTextC = ")";

    int start = ratingTextA.length();
    int end = ratingTextA.length() + ratingTextB.length();

    SpannableStringBuilder ssb = new SpannableStringBuilder(ratingTextA + ratingTextB + ratingTextC);

    ssb.setSpan(new NonUnderlinedClickableSpan() {
        @Override//from w ww. jav a2  s  .  c  om
        public void onClick(View v) {
            showRatingDialog();
        }
    }, start, end, 0);

    ssb.setSpan(new TextAppearanceSpan(getApplicationContext(), R.style.episode_link), start, end, 0); // Set the style of the text
    ratingTextView.setText(ssb, BufferType.SPANNABLE);
    ratingTextView.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.hippo.nimingban.ui.ListActivity.java

private void checkForAppStart() {
    // Check crash
    if (Crash.hasCrashFile()) {
        new AlertDialog.Builder(this).setTitle(R.string.it_is_important).setMessage(R.string.crash_tip)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override/*  ww  w  .  j  av a 2  s .c o m*/
                    public void onClick(DialogInterface dialog, int which) {
                        String content = Crash.getCrashContent();
                        ActivityHelper.sendEmail(ListActivity.this,
                                "hipposeven332$gmail.com".replaceAll("\\$", "@"), "I found a bug in nimingban",
                                content);
                    }
                }).setNegativeButton(android.R.string.cancel, null)
                .setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        Crash.resetCrashFile();
                    }
                }).show();
    }

    // Check image save location
    UniFile uniFile = Settings.getImageSaveLocation();
    if (uniFile == null || !uniFile.ensureDir()) {
        Toast.makeText(this, R.string.cant_make_sure_image_save_location, Toast.LENGTH_SHORT).show();
    }

    // Check update
    NMBRequest request = new NMBRequest();
    mUpdateRequest = request;
    request.setMethod(NMBClient.METHOD_UPDATE);
    request.setCallback(new NMBClient.Callback<UpdateStatus>() {
        @Override
        public void onSuccess(UpdateStatus result) {
            Log.d("UpdateStatus", ObjectUtils.toString(result));

            mUpdateRequest = null;
            UpdateHelper.showUpdateDialog(ListActivity.this, result);
        }

        @Override
        public void onFailure(Exception e) {
            mUpdateRequest = null;
            e.printStackTrace();
        }

        @Override
        public void onCancel() {
            mUpdateRequest = null;
        }
    });
    mNMBClient.execute(request);

    // Check analysis
    if (!Settings.getSetAnalysis()) {
        DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Settings.putSetAnalysis(true);
                Settings.putAnalysis(which == DialogInterface.BUTTON_POSITIVE);
            }
        };

        try {
            CharSequence message = Html.fromHtml(
                    IOUtils.readString(getResources().openRawResource(R.raw.analysis_plain), "UTF-8"));
            Dialog dialog = new AlertDialog.Builder(this).setTitle(R.string.data_analysis).setMessage(message)
                    .setCancelable(false).setPositiveButton(R.string.agree, listener)
                    .setNegativeButton(R.string.disagree, listener).show();
            TextView messageView = (TextView) dialog.findViewById(android.R.id.message);
            if (messageView != null) {
                messageView.setMovementMethod(new LinkMovementMethod2(ListActivity.this));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // Get common post
    request = new NMBRequest();
    mCommonPostsRequest = request;
    request.setSite(ACSite.getInstance());
    request.setMethod(NMBClient.METHOD_COMMON_POSTS);
    request.setCallback(new NMBClient.Callback<List<CommonPost>>() {
        @Override
        public void onSuccess(List<CommonPost> result) {
            mCommonPostsRequest = null;
            DB.setACCommonPost(result);
        }

        @Override
        public void onFailure(Exception e) {
            mCommonPostsRequest = null;
            e.printStackTrace();
        }

        @Override
        public void onCancel() {
            mCommonPostsRequest = null;
        }
    });
    mNMBClient.execute(request);
}