Search in sources :

Example 51 with ActivityNotFoundException

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();
        }
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent)

Example 52 with ActivityNotFoundException

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);
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) Uri(android.net.Uri)

Example 53 with ActivityNotFoundException

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);
    }
}
Also used : AlertDialog(android.app.AlertDialog) AsyncTask(android.os.AsyncTask) Handler(android.os.Handler) Intent(android.content.Intent) Spanned(android.text.Spanned) Uri(android.net.Uri) ListView(android.widget.ListView) ActivityNotFoundException(android.content.ActivityNotFoundException) ChangelogAdapter(com.klinker.android.twitter.adapters.ChangelogAdapter)

Example 54 with ActivityNotFoundException

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);
            }
        }
    });
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) ViewGroup(android.view.ViewGroup) OnClickListener(android.view.View.OnClickListener) RatioImageView(com.abewy.android.extended.widget.RatioImageView) Intent(android.content.Intent) View(android.view.View) RatioImageView(com.abewy.android.extended.widget.RatioImageView) Link(com.abewy.android.apps.klyph.core.fql.Link)

Example 55 with ActivityNotFoundException

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());
            }
        }
    });
}
Also used : Format(com.abewy.android.apps.klyph.core.fql.Video.Format) ActivityNotFoundException(android.content.ActivityNotFoundException) ViewGroup(android.view.ViewGroup) OnClickListener(android.view.View.OnClickListener) RatioImageView(com.abewy.android.extended.widget.RatioImageView) Intent(android.content.Intent) View(android.view.View) RatioImageView(com.abewy.android.extended.widget.RatioImageView)

Aggregations

ActivityNotFoundException (android.content.ActivityNotFoundException)406 Intent (android.content.Intent)365 Uri (android.net.Uri)49 PendingIntent (android.app.PendingIntent)39 View (android.view.View)39 ResolveInfo (android.content.pm.ResolveInfo)38 RecognizerIntent (android.speech.RecognizerIntent)35 PackageManager (android.content.pm.PackageManager)30 UserHandle (android.os.UserHandle)28 ComponentName (android.content.ComponentName)26 ImageView (android.widget.ImageView)24 Bundle (android.os.Bundle)23 TextView (android.widget.TextView)23 Test (org.junit.Test)23 RemoteException (android.os.RemoteException)22 Activity (android.app.Activity)21 SearchManager (android.app.SearchManager)20 DialogInterface (android.content.DialogInterface)17 SearchableInfo (android.app.SearchableInfo)15 File (java.io.File)15