use of android.content.ActivityNotFoundException in project qksms by moezbhatti.
the class ComposeView method chooseAttachmentFromGallery.
private void chooseAttachmentFromGallery() {
AnalyticsManager.getInstance().sendEvent(AnalyticsManager.CATEGORY_MESSAGES, AnalyticsManager.ACTION_ATTACH_IMAGE, mLabel);
try {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
mActivityLauncher.startActivityForResult(photoPickerIntent, REQUEST_CODE_IMAGE);
} catch (ActivityNotFoundException e) {
// Send a toast saying no picture apps
if (mContext != null) {
String message = mContext.getResources().getString(R.string.attachment_app_not_found);
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
}
}
}
use of android.content.ActivityNotFoundException in project Klyph by jonathangerbaud.
the class PhoneUtil method sendSMS.
public static void sendSMS(Context context, String phoneNumber) {
try {
Uri uri = Uri.parse("sms:" + phoneNumber);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
} catch (ActivityNotFoundException activityException) {
Log.d("PhoneUtil", "sendSMS: ", activityException);
}
}
use of android.content.ActivityNotFoundException in project Talon-for-Twitter by klinker24.
the class SettingsLinkDrawerClickListener method onItemClick.
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
Intent intent;
final int mPos = position;
if (mPos < 2) {
// one of the settings pages
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mDrawerLayout.closeDrawer(Gravity.START);
}
}, 300);
viewPager.setCurrentItem(mPos + 7, true);
} else if (mPos == 2) {
// changelog
final ListView list = new ListView(context);
list.setDividerHeight(0);
new AsyncTask<Spanned[], Void, Spanned[]>() {
@Override
public Spanned[] doInBackground(Spanned[]... params) {
return XmlChangelogUtils.parse(context);
}
@Override
public void onPostExecute(Spanned[] result) {
list.setAdapter(new ChangelogAdapter(context, result));
}
}.execute();
new AlertDialog.Builder(context).setTitle(R.string.changelog).setView(list).setPositiveButton(R.string.ok, null).show();
} else if (mPos == 3) {
// rate it option
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
context.startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, "Couldn't launch the market", Toast.LENGTH_SHORT).show();
}
}
}, 200);
}
}
use of android.content.ActivityNotFoundException in project Klyph by jonathangerbaud.
the class StreamLink method manageVideoLink.
private void manageVideoLink(StreamHolder holder, Stream stream) {
final Link link = stream.getLink();
final View view = holder.getAuthorProfileImage();
if (!stream.getActor_id().equals(link.getOwner()))
new StreamHeader(specialLayout).mergeData(holder, stream, link);
new StreamButtonBar(getParentAdapter(), specialLayout).mergeData(holder, stream, link);
String url = "";
int width = -1;
int height = -1;
if (link.isYoutubeLink()) {
url = YoutubeUtil.getThumbUrl(link.getUrl());
Log.d("StreamLink", "Youtube Link = " + link.getUrl() + " " + url);
width = YoutubeUtil.THUMB_WIDTH;
height = YoutubeUtil.THUMB_HEIGHT;
} else if (link.isDailymotionLink()) {
url = DailymotionUtil.getThumbUrl(link.getUrl());
width = DailymotionUtil.THUMB_WIDTH;
height = DailymotionUtil.THUMB_HEIGHT;
} else if (link.isVimeoLink()) {
url = VimeoUtil.getThumbUrl(link.getUrl());
width = VimeoUtil.THUMB_WIDTH;
height = VimeoUtil.THUMB_HEIGHT;
}
RatioImageView ratioImageView = (RatioImageView) holder.getPostPhoto();
ratioImageView.setImageSize(width, height);
loadImage(holder.getPostPhoto(), url, stream);
holder.getPostPhoto().setVisibility(View.VISIBLE);
holder.getPostVideoPlay().setVisibility(View.VISIBLE);
((ViewGroup) holder.getPostPhoto().getParent()).setVisibility(View.VISIBLE);
if (link.getTitle().length() > 0) {
holder.getVideoTitle().setText(link.getTitle());
holder.getVideoTitle().setVisibility(View.VISIBLE);
((ViewGroup) holder.getVideoTitle().getParent()).setVisibility(View.VISIBLE);
}
if (link.getSummary().length() > 0) {
holder.getMessage().setText(link.getSummary());
holder.getMessage().setVisibility(View.VISIBLE);
}
holder.getPostPhoto().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String url = link.getUrl();
if (YoutubeUtil.isYoutubeLink(url) && YoutubeUtil.getVideoIdFromUrl(url).length() > 0) {
Log.d("StreamLink", "isYoutubeVideo " + YoutubeUtil.getVideoIdFromUrl(url));
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + YoutubeUtil.getVideoIdFromUrl(url)));
getContext(view).startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.d("StreamLink", "ActivityNotFoundException");
PhoneUtil.openURL(getContext(view), url);
}
} else {
Log.d("StreamLink", "not YoutubeVideo");
PhoneUtil.openURL(getContext(view), url);
}
}
});
}
use of android.content.ActivityNotFoundException in project Klyph by jonathangerbaud.
the class StreamPhoto method mergeData.
public void mergeData(StreamHolder holder, final Stream stream, final Video video) {
if (!stream.getActor_id().equals(video.getOwner())) {
new StreamHeader(specialLayout).mergeData(holder, stream, video);
}
new StreamButtonBar(getParentAdapter(), specialLayout).mergeData(holder, stream, video);
Format selectedFormat = null;
for (Format format : video.getFormat()) {
if (format.getWidth() > KlyphDevice.getDeviceWidth()) {
selectedFormat = format;
break;
}
}
if (selectedFormat == null) {
selectedFormat = video.getFormat().get(video.getFormat().size() - 1);
}
holder.getPostPhoto().setScaleType(ScaleType.FIT_XY);
RatioImageView ratioImageView = (RatioImageView) holder.getPostPhoto();
ratioImageView.setImageSize(selectedFormat.getWidth(), selectedFormat.getHeight());
loadImage(holder.getPostPhoto(), selectedFormat.getPicture());
holder.getPostPhoto().setVisibility(View.VISIBLE);
holder.getPostVideoPlay().setVisibility(View.VISIBLE);
((ViewGroup) holder.getPostPhoto().getParent()).setVisibility(View.VISIBLE);
if (video.getTitle().length() > 0) {
holder.getVideoTitle().setText(video.getTitle());
holder.getVideoTitle().setVisibility(View.VISIBLE);
((ViewGroup) holder.getVideoTitle().getParent()).setVisibility(View.VISIBLE);
}
if (video.getDescription().length() > 0) {
holder.getMessage().setText(video.getDescription());
holder.getMessage().setVisibility(View.VISIBLE);
}
final View view = holder.getAuthorProfileImage();
holder.getPostPhoto().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d("StreamPhoto", "onClickVideo " + video.getSrc_hq());
if (video.getSrc_hq().contains(".mp4") == true) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(video.getSrc_hq()));
intent.setDataAndType(Uri.parse(video.getSrc_hq()), "video/mp4");
try {
getContext(view).startActivity(intent);
} catch (ActivityNotFoundException e) {
PhoneUtil.openURL(getContext(view), video.getSrc_hq());
}
} else {
PhoneUtil.openURL(getContext(view), video.getSrc_hq());
}
}
});
}
Aggregations