use of com.klinker.android.twitter.utils.WebIntentBuilder in project Talon-for-Twitter by klinker24.
the class TouchableSpan method onClick.
@Override
public void onClick(View widget) {
if (Patterns.WEB_URL.matcher(mValue).find()) {
String url = "http://" + full.replace("http://", "").replace("https://", "").replace("\"", "");
new WebIntentBuilder(mContext).setUrl(url).setShouldForceExternal(extBrowser).build().start();
} else if (Regex.HASHTAG_PATTERN.matcher(mValue).find()) {
// found a hashtag, so open the hashtag search
Intent search;
if (!fromLauncher) {
search = new Intent(mContext, SearchedTrendsActivity.class);
} else {
search = new Intent("android.intent.action.MAIN");
search.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.drawer_activities.discover.trends.LauncherSearchedTrends"));
search.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
search.putExtra("current_account", settings.currentAccount);
}
search.setAction(Intent.ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, full);
mContext.startActivity(search);
} else if (Regex.MENTION_PATTERN.matcher(mValue).find()) {
Intent user;
if (!fromLauncher) {
user = new Intent(mContext, ProfilePager.class);
} else {
user = new Intent("android.intent.action.MAIN");
user.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.profile_viewer.LauncherProfilePager"));
user.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
user.putExtra("current_account", settings.currentAccount);
}
user.putExtra("screenname", full.replace("@", "").replaceAll(" ", ""));
user.putExtra("proPic", "");
mContext.startActivity(user);
} else if (Regex.CASHTAG_PATTERN.matcher(mValue).find()) {
// found a cashtag, so open the search
Intent search;
if (!fromLauncher) {
search = new Intent(mContext, SearchedTrendsActivity.class);
} else {
search = new Intent("android.intent.action.MAIN");
search.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.drawer_activities.discover.trends.LauncherSearchedTrends"));
search.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
search.putExtra("current_account", settings.currentAccount);
}
search.setAction(Intent.ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, full);
mContext.startActivity(search);
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
TouchableMovementMethod.touched = false;
}
}, 500);
}
Aggregations