Example usage for android.content Intent CATEGORY_BROWSABLE

List of usage examples for android.content Intent CATEGORY_BROWSABLE

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_BROWSABLE.

Prototype

String CATEGORY_BROWSABLE

To view the source code for android.content Intent CATEGORY_BROWSABLE.

Click Source Link

Document

Activities that can be safely invoked from a browser must support this category.

Usage

From source file:com.airbop.client.GCMIntentService.java

private static void generateImageNotification(Context context, String title, String message, String url,
        String image_url, String large_icon) {

    // The bitmap to download
    Bitmap message_bitmap = null;// www  . j a  va2s .  c om
    // Should we download the image?
    if ((image_url != null) && (!image_url.equals(""))) {
        message_bitmap = AirBopImageDownloader.downloadBitmap(image_url);
    }
    // If we didn't get the image, we're out of here
    if (message_bitmap == null) {
        generateNotification(context, title, message, url, large_icon);
        return;
    }

    int icon = R.drawable.ic_stat_gcm;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    if ((title == null) || (title.equals(""))) {
        title = context.getString(R.string.app_name);
    }

    Intent notificationIntent = null;
    if ((url == null) || (url.equals(""))) {
        //just bring up the app
        notificationIntent = new Intent(context, DemoActivity.class);
    } else {
        //Launch the URL
        notificationIntent = new Intent(Intent.ACTION_VIEW);
        notificationIntent.setData(Uri.parse(url));
        notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE);
    }

    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

    Notification notification = new NotificationCompat.Builder(context).setContentTitle(title)
            .setContentText(message).setContentIntent(intent).setSmallIcon(icon)
            .setLargeIcon(decodeImage(large_icon)).setWhen(when)
            .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(message_bitmap)).build();

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(0, notification);
}

From source file:org.liberty.android.fantastischmemo.ui.PreviewEditActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menuspeakquestion: {
        if (getCurrentCard() != null) {
            return speakQuestion();
        }//from   www  . ja va 2  s .com
        return true;
    }

    case R.id.menuspeakanswer: {
        if (getCurrentCard() != null) {
            return speakAnswer();
        }
        return true;
    }

    case R.id.editmenu_settings_id: {
        Intent myIntent = new Intent(this, SettingsScreen.class);
        myIntent.putExtra(SettingsScreen.EXTRA_DBPATH, dbPath);
        startActivityForResult(myIntent, ACTIVITY_SETTINGS);
    }
        return true;

    case R.id.editmenu_delete_id: {
        deleteCard(getCurrentCard());
        return true;
    }

    case R.id.editmenu_detail_id: {
        if (getCurrentCard() != null) {
            Intent myIntent = new Intent(this, DetailScreen.class);
            myIntent.putExtra(DetailScreen.EXTRA_DBPATH, this.dbPath);
            myIntent.putExtra(DetailScreen.EXTRA_CARD_ID, getCurrentCard().getId());
            startActivityForResult(myIntent, ACTIVITY_DETAIL);
        }
        return true;
    }
    case R.id.editmenu_list_id: {
        // List edit mode
        Intent myIntent = new Intent(this, SettingsScreen.class);
        myIntent.setClass(this, CardListActivity.class);
        myIntent.putExtra(CardListActivity.EXTRA_DBPATH, dbPath);
        if (getCurrentCard() != null) {
            myIntent.putExtra("openid", getCurrentCard().getId());
        }
        startActivityForResult(myIntent, ACTIVITY_LIST);
        return true;
    }

    case R.id.menu_edit_categories: {
        if (getCurrentCard() != null) {
            showCategoriesDialog();
        }
        return true;
    }

    case R.id.editmenu_help: {
        Intent myIntent = new Intent();
        myIntent.setAction(Intent.ACTION_VIEW);
        myIntent.addCategory(Intent.CATEGORY_BROWSABLE);
        myIntent.setData(Uri.parse(WEBSITE_HELP_EDIT));
        startActivity(myIntent);
        return true;
    }

    case R.id.menu_card_player: {
        if (getCurrentCard() != null) {
            Intent intent = new Intent(this, CardPlayerActivity.class);
            intent.putExtra(CardPlayerActivity.EXTRA_DBPATH, dbPath);
            if (getCurrentCard() != null) {
                intent.putExtra(CardPlayerActivity.EXTRA_START_CARD_ID, getCurrentCard().getId());
            }
            startActivityForResult(intent, ACTIVITY_CARD_PLAYER);
        }
        return true;
    }

    case R.id.menu_context_copy: {

        if (getCurrentCard() != null) {
            Toast.makeText(this, R.string.copy_text, Toast.LENGTH_LONG).show();
            savedCardId = getCurrentCard().getId();
        }
        return true;
    }
    case R.id.menu_context_paste: {
        if (savedCardId != null && getCurrentCard() != null) {
            Card savedCard = getDbOpenHelper().getCardDao().queryForId(savedCardId);
            LearningData ld = new LearningData();
            getDbOpenHelper().getLearningDataDao().create(ld);
            savedCard.setLearningData(ld);
            savedCard.setOrdinal(getCurrentCard().getOrdinal());
            getDbOpenHelper().getCardDao().create(savedCard);
            restartActivity();
        }

        return true;
    }
    case R.id.menu_context_swap_current: {
        getDbOpenHelper().getCardDao().swapQA(getCurrentCard());
        restartActivity();
        return true;
    }

    case R.id.menu_context_reset_current: {
        getDbOpenHelper().getLearningDataDao().resetLearningData(getCurrentCard().getLearningData());
        return true;
    }

    case R.id.menu_context_wipe: {
        AMGUIUtility.doConfirmProgressTask(this, R.string.settings_wipe, R.string.settings_wipe_warning,
                R.string.loading_please_wait, R.string.loading_save, new AMGUIUtility.ProgressTask() {
                    @Override
                    public void doHeavyTask() {
                        getDbOpenHelper().getLearningDataDao().resetAllLearningData();
                    }

                    @Override
                    public void doUITask() {
                        /* Do nothing */}
                });
        return true;
    }

    case R.id.menu_context_swap: {
        new AlertDialog.Builder(this).setTitle(R.string.warning_text).setIcon(R.drawable.alert_dialog_icon)
                .setMessage(R.string.settings_inverse_warning)
                .setPositiveButton(R.string.swap_text, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface arg0, int arg1) {
                        AMGUIUtility.doProgressTask(PreviewEditActivity.this, R.string.loading_please_wait,
                                R.string.loading_save, new AMGUIUtility.ProgressTask() {
                                    public void doHeavyTask() {
                                        getDbOpenHelper().getCardDao().swapAllQA();
                                    }

                                    public void doUITask() {
                                        restartActivity();
                                    }
                                });
                    }
                }).setNeutralButton(R.string.swapdup_text, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface arg0, int arg1) {
                        AMGUIUtility.doProgressTask(PreviewEditActivity.this, R.string.loading_please_wait,
                                R.string.loading_save, new AMGUIUtility.ProgressTask() {
                                    public void doHeavyTask() {
                                        getDbOpenHelper().getCardDao().swapAllQADup();
                                    }

                                    public void doUITask() {
                                        restartActivity();
                                    }
                                });
                    }
                }).setNegativeButton(R.string.cancel_text, null).create().show();

        return true;
    }

    case R.id.menu_gestures: {
        showGesturesDialog();
        return true;
    }

    case R.id.menu_context_remove_dup: {
        AMGUIUtility.doConfirmProgressTask(this, R.string.remove_dup_text, R.string.remove_dup_message,
                R.string.removing_dup_title, R.string.removing_dup_warning, new AMGUIUtility.ProgressTask() {
                    @Override
                    public void doHeavyTask() {
                        getDbOpenHelper().getCardDao().removeDuplicates();
                    }

                    @Override
                    public void doUITask() {
                        restartActivity();
                    }
                });
        return true;
    }

    case R.id.menu_context_merge_db: {
        Intent myIntent = new Intent(this, DatabaseMerger.class);
        myIntent.putExtra(DatabaseMerger.EXTRA_SRC_PATH, dbPath);
        startActivityForResult(myIntent, ACTIVITY_MERGE);
        return true;
    }

    case R.id.menu_context_shuffle: {
        AMGUIUtility.doConfirmProgressTask(this, R.string.settings_shuffle, R.string.settings_shuffle_warning,
                R.string.loading_please_wait, R.string.loading_save, new AMGUIUtility.ProgressTask() {
                    @Override
                    public void doHeavyTask() {
                        getDbOpenHelper().getCardDao().shuffleOrdinals();
                    }

                    @Override
                    public void doUITask() {
                        restartActivity();
                    }
                });
        return true;
    }

    case R.id.menu_share: {
        shareUtil.shareCard(getCurrentCard());
        return true;
    }
    }

    return false;
}

From source file:com.doomy.padlock.MainActivity.java

private void openAboutDialog() {
    LayoutInflater mLayoutInflater = LayoutInflater.from(this);
    View mView = mLayoutInflater.inflate(R.layout.view_about, null);

    ImageView mImageViewMrDoomy = (ImageView) mView.findViewById(R.id.imageViewMrDoomy);
    ImageView mImageViewStudio = (ImageView) mView.findViewById(R.id.imageViewStudio);
    ImageView mImageViewGitHub = (ImageView) mView.findViewById(R.id.imageViewGitHub);
    Drawable mMrDoomy = mImageViewMrDoomy.getDrawable();
    Drawable mStudio = mImageViewStudio.getDrawable();
    Drawable mGitHub = mImageViewGitHub.getDrawable();
    mMrDoomy.setColorFilter(getResources().getColor(R.color.orangeDark), PorterDuff.Mode.SRC_ATOP);
    mStudio.setColorFilter(getResources().getColor(R.color.orange), PorterDuff.Mode.SRC_ATOP);
    mGitHub.setColorFilter(getResources().getColor(R.color.greyMaterialDark), PorterDuff.Mode.SRC_ATOP);

    mImageViewGitHub.setOnClickListener(new View.OnClickListener() {
        @Override//from w w  w  .  j a v a 2s . c o m
        public void onClick(View v) {
            Intent mIntent = new Intent();
            mIntent.setAction(Intent.ACTION_VIEW);
            mIntent.addCategory(Intent.CATEGORY_BROWSABLE);
            mIntent.setData(Uri.parse(getString(R.string.url)));
            startActivity(mIntent);
        }
    });

    AlertDialog.Builder mAlertDialog = new AlertDialog.Builder(MainActivity.this, R.style.DialogTheme);

    mAlertDialog.setTitle(getString(R.string.about));
    mAlertDialog.setView(mView);
    mAlertDialog.setPositiveButton(getString(R.string.okay), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    mAlertDialog.show();
}

From source file:org.liberty.android.fantastischmemo.ui.AnyMemo.java

private void prepareFirstTimeRun() {
    File sdPath = new File(AMEnv.DEFAULT_ROOT_PATH);
    //Check the version, if it is updated from an older version it will show a dialog
    int savedVersionCode = settings.getInt(AMPrefKeys.SAVED_VERSION_CODE_KEY, 1);

    int thisVersionCode;
    try {//from www. j ava  2 s.  c o m
        thisVersionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        thisVersionCode = 0;
        assert false : "The version code can not be retrieved. Is it defined in build.gradle?";
    }

    boolean firstTime = settings.getBoolean(AMPrefKeys.FIRST_TIME_KEY, true);

    // Force clean preference for non-compstible versions.
    if (savedVersionCode < 154) { // Version 9.0.4
        firstTime = true;
        SharedPreferences.Editor editor = settings.edit();
        editor.clear();
        editor.commit();
    }

    /* First time installation! It will install the sample db
     * to /sdcard/AnyMemo
     */
    if (firstTime == true) {
        SharedPreferences.Editor editor = settings.edit();
        editor.putBoolean(AMPrefKeys.FIRST_TIME_KEY, false);
        editor.putString(AMPrefKeys.getRecentPathKey(0), AMEnv.DEFAULT_ROOT_PATH + AMEnv.DEFAULT_DB_NAME);
        editor.commit();
        try {
            amFileUtil.copyFileFromAsset(AMEnv.DEFAULT_DB_NAME, new File(sdPath + "/" + AMEnv.DEFAULT_DB_NAME));

            InputStream in2 = getResources().getAssets().open(AMEnv.EMPTY_DB_NAME);
            String emptyDbPath = getApplicationContext().getFilesDir().getAbsolutePath() + "/"
                    + AMEnv.EMPTY_DB_NAME;
            FileUtils.copyInputStreamToFile(in2, new File(emptyDbPath));
            in2.close();
        } catch (IOException e) {
            Log.e(TAG, "Copy file error", e);

        }
    }
    /* Detect an update */
    if (savedVersionCode != thisVersionCode) {
        SharedPreferences.Editor editor = settings.edit();
        /* save new version number */
        editor.putInt(AMPrefKeys.SAVED_VERSION_CODE_KEY, thisVersionCode);
        editor.commit();

        View alertView = View.inflate(this, R.layout.link_alert, null);
        TextView textView = (TextView) alertView.findViewById(R.id.link_alert_message);
        textView.setText(Html.fromHtml(getString(R.string.what_is_new_message)));
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        new AlertDialog.Builder(this).setView(alertView).setTitle(getString(R.string.what_is_new))
                .setPositiveButton(getString(R.string.ok_text), null)
                .setNegativeButton(getString(R.string.about_version), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        Intent myIntent = new Intent();
                        myIntent.setAction(Intent.ACTION_VIEW);
                        myIntent.addCategory(Intent.CATEGORY_BROWSABLE);
                        myIntent.setData(Uri.parse(WEBSITE_VERSION));
                        startActivity(myIntent);
                    }
                }).show();
    }
}

From source file:com.airbop.library.simple.AirBopGCMIntentService.java

private static void generateNotification(Context context, String title, String message, String url,
        String large_icon) {/* www  .j a  v a  2 s.  c om*/

    //int icon = R.drawable.ic_stat_gcm;
    AirBopManifestSettings airBop_settings = CommonUtilities.loadDataFromManifest(context);

    int icon = airBop_settings.mNotificationIcon;

    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    //if ((title == null) || (title.equals(""))) {
    if (title == null) {
        title = airBop_settings.mDefaultNotificationTitle;
    }

    Intent notificationIntent = null;
    if ((url == null) || (url.equals(""))) {
        //just bring up the app
        if (context != null) {
            ClassLoader class_loader = context.getClassLoader();
            if (class_loader != null) {
                try {
                    if (airBop_settings.mDefaultNotificationClass != null) {
                        notificationIntent = new Intent(context,
                                Class.forName(airBop_settings.mDefaultNotificationClass));
                    }
                } catch (ClassNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    //notificationIntent = new Intent(Intent.ACTION_VIEW);
                }
            }
        }

    } else {
        //Launch the URL
        notificationIntent = new Intent(Intent.ACTION_VIEW);
        notificationIntent.setData(Uri.parse(url));
        notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE);
    }
    PendingIntent intent = null;
    // set intent so it does not start a new activity
    if (notificationIntent != null) {
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    }

    Builder notificationBuilder = new NotificationCompat.Builder(context).setContentTitle(title)
            .setContentText(message).setLargeIcon(decodeImage(large_icon)).setWhen(when)
            .setStyle(new NotificationCompat.BigTextStyle().bigText(message));
    if (intent != null) {
        notificationBuilder.setContentIntent(intent);
    }
    if (icon != 0) {
        notificationBuilder.setSmallIcon(icon);
    }
    Notification notification = notificationBuilder.build();

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(0, notification);

}

From source file:com.egloos.hyunyi.musicinfo.LinkPopUp.java

@Override
public void onCreate(Bundle saveInstanceState) {
    super.onCreate(saveInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    Bundle b = getIntent().getExtras();//  www .  j  ava  2  s . com

    SharedPreferences prefs = getSharedPreferences("settings", MODE_PRIVATE);

    imageOptions = new DisplayImageOptions.Builder().cacheInMemory(false).cacheOnDisk(true)
            .bitmapConfig(Bitmap.Config.RGB_565).imageScaleType(ImageScaleType.EXACTLY)
            .showImageOnLoading(R.drawable.connecting_anim).build();
    config = new ImageLoaderConfiguration.Builder(getApplicationContext()).diskCacheExtraOptions(480, 320, null)
            .defaultDisplayImageOptions(imageOptions).build();

    if (imageLoader == null)
        imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited())
        imageLoader.init(config);

    setContentView(R.layout.link_dialog);

    imageFrame = (FrameLayout) findViewById(R.id.image_frame);
    iBottomPanel = (ImageView) findViewById(R.id.bottom_panel);

    lArtistLink = (RelativeLayout) findViewById(R.id.l_artist_link);

    bPopUpClose = (ImageView) findViewById(R.id.b_popup_close);
    bPopUpClose.setOnClickListener(this);

    tEchoNest = (TextView) findViewById(R.id.t_echo_nest);
    tAttribution = (TextView) findViewById(R.id.t_attribution);

    tArtistName = (TextView) findViewById(R.id.t_artist_name);
    tArtistName.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                //isMove = false;
                mTouchX = event.getRawX();
                mTouchY = event.getRawY();
                break;

            case MotionEvent.ACTION_UP:
                //Log.i("musicInfo", "ACTION_UP! TouchY:" + mTouchY + " UpY: " + event.getRawY() + " Move: " + (mTouchY - event.getRawY()));
                int RawY = (int) event.getRawY();
                int dY = (int) (mTouchY - event.getRawY());
                if (dY > 200) {
                    imageLoader.resume();
                    //Log.i("musicInfo", "mGridView TOP = " + mGridView.getTop() + " mGridView TransitionY =" + mGridView.getTranslationY());
                    while (mGridView.getTranslationY() > tArtistName.getHeight()) {
                        //Log.i("musicInfo", "Moving UP! mGridView: " + mGridView.getTranslationY() + " tArtistName: " + tArtistName.getTranslationY());
                        mGridView.setTranslationY(mGridView.getTranslationY() - 1);
                        tArtistName.setTranslationY(tArtistName.getTranslationY() - 1);

                    }
                } else if (dY > 5 && dY <= 200 || (dY <= 5 && tArtistName.getTranslationY() < 0)) {
                    while (tArtistName.getTranslationY() < 0) {
                        //Log.i("musicInfo", "Moving DOWN! mGridView: " + mGridView.getTranslationY() + " tArtistName: " + tArtistName.getTranslationY());
                        mGridView.setTranslationY(mGridView.getTranslationY() + 1);
                        tArtistName.setTranslationY(tArtistName.getTranslationY() + 1);
                    }
                    imageLoader.pause();
                }
                break;

            case MotionEvent.ACTION_MOVE:
                //isMove = true;

                //int top = tArtistName.getTop();
                //int bottom = tArtistName.getBottom();
                //int left = tArtistName.getLeft();
                //int right = tArtistName.getRight();

                int x = (int) (event.getRawX() - mTouchX);
                int y = (int) (event.getRawY() - mTouchY);

                final int num = 5;
                if (y > -num && y < num) {
                    //isMove = false;
                    break;
                } else if (y > 0) {

                } else {
                    imageFrame.bringChildToFront(mGridView);
                    tArtistName.setTranslationY((float) y);
                    mGridView.setTranslationY((float) (SGVtransition + y));

                    //Log.i("musicInfo", String.format("T: %d, B: %d", mGridView.getTop(), mGridView.getBottom()));

                }

                break;
            }
            return true;
        }
    });

    ArtistImage = (ImageView) findViewById(R.id.artist_image);

    lLinkList = (LinearLayout) findViewById(R.id.l_link_list);

    mGridView = (StaggeredGridView) findViewById(R.id.SG_view);

    SGVtransition = 900;

    mGridView.setTranslationY(SGVtransition);

    JSONObject artist_info = null;
    try {
        artist_info = new JSONObject(b.getString("artist_info"));
        Log.i("musicInfo", "LinkPopUp. OnCreate" + artist_info.toString());
        displayArtistInfo(artist_info);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    if (artist_info != null)
        jArtists.put(artist_info);
    if (prefs.getBoolean("SimilarOn", false)) {
        getSimilarArtistsInfo((String) tArtistName.getText());
        ArtistImage.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    //isMove = false;
                    mTouchX = event.getRawX();
                    mTouchY = event.getRawY();
                    break;

                case MotionEvent.ACTION_UP:
                    //Log.i("musicInfo", "ACTION_UP! TouchY:" + mTouchY + " UpY: " + event.getRawY() + " Move: " + (mTouchY - event.getRawY()));
                    int dX = (int) (mTouchX - event.getRawX());
                    if (dX > 5) {
                        if (jArtists.length() > 1) {
                            imageLoader.stop();
                            try {
                                if (artistNum == 0) {
                                    artistNum = jArtists.length() - 1;
                                } else {
                                    artistNum--;
                                }

                                displayArtistInfo(jArtists.getJSONObject(artistNum));
                                imageLoader.resume();

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

                        }

                    } else if (dX < -5) {
                        if (jArtists.length() > 1) {
                            imageLoader.stop();
                            try {
                                if (artistNum == jArtists.length() - 1) {
                                    artistNum = 0;
                                } else {
                                    artistNum++;
                                }
                                displayArtistInfo(jArtists.getJSONObject(artistNum));
                                imageLoader.resume();
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }

                        }

                    }

                    break;

                case MotionEvent.ACTION_MOVE:

                    break;
                }

                return true;
            }
        });
    }

    mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            //Log.d("musicInfo", "SGV onScrollStateChanged:" + scrollState);
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            //Log.d("musicInfo", "SGV onScroll firstVisibleItem:" + firstVisibleItem + " visibleItemCount:" + visibleItemCount + " totalItemCount:" + totalItemCount);
            // our handling
            if (!mHasRequestedMore) {
                int lastInScreen = firstVisibleItem + visibleItemCount;
                if (lastInScreen >= totalItemCount) {
                    //Log.d("musicInfo", "SGV onScroll lastInScreen - so load more");
                    mHasRequestedMore = true;
                    onLoadMoreItems();
                }
            }
        }

        private void onLoadMoreItems() {
            if (jVideoArray == null)
                return;
            final ArrayList<JSONObject> sampleData = generateImageData(jVideoArray);
            for (JSONObject data : sampleData) {
                mAdapter.add(data);
            }
            // stash all the data in our backing store
            mData.addAll(sampleData);
            // notify the adapter that we can update now
            mAdapter.notifyDataSetChanged();
            mHasRequestedMore = false;
        }
    });

    mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(getApplicationContext(), "Open the Video...", Toast.LENGTH_SHORT).show();
            StaggeredViewAdapter.ViewHolder vh = (StaggeredViewAdapter.ViewHolder) view.getTag();

            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setData(Uri.parse((String) vh.url));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            //finish();

        }

    });

    //int[] lArtistLinkPosition = new int[2];
    //int[] tArtistNamePosition = new int[2];

    //lArtistLink.getLocationOnScreen(lArtistLinkPosition);
    //tArtistName.getLocationOnScreen(tArtistNamePosition);

    //Log.d("musicInfo", "SGV transition = " + SGVtransition);
}

From source file:org.chromium.chrome.browser.physicalweb.ListUrlsActivity.java

private static Intent createNavigateToUrlIntent(PwsResult pwsResult) {
    String url = pwsResult.siteUrl;
    if (url == null) {
        url = pwsResult.requestUrl;//from   w w  w .  j  a  va 2  s .  c o m
    }

    return new Intent(Intent.ACTION_VIEW).addCategory(Intent.CATEGORY_BROWSABLE).setData(Uri.parse(url))
            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:com.doomy.decode.ScanActivity.java

private void openAboutDialog() {
    LayoutInflater mLayoutInflater = LayoutInflater.from(ScanActivity.this);
    View mView = mLayoutInflater.inflate(R.layout.view_about, null);

    ImageView mImageViewMrDoomy = (ImageView) mView.findViewById(R.id.imageViewMrDoomy);
    ImageView mImageViewStudio = (ImageView) mView.findViewById(R.id.imageViewStudio);
    ImageView mImageViewGitHub = (ImageView) mView.findViewById(R.id.imageViewGitHub);
    Drawable mMrDoomy = mImageViewMrDoomy.getDrawable();
    Drawable mStudio = mImageViewStudio.getDrawable();
    Drawable mGitHub = mImageViewGitHub.getDrawable();
    mMrDoomy.setColorFilter(getResources().getColor(R.color.greenDark), PorterDuff.Mode.SRC_ATOP);
    mStudio.setColorFilter(getResources().getColor(R.color.green), PorterDuff.Mode.SRC_ATOP);
    mGitHub.setColorFilter(getResources().getColor(R.color.greyMaterialDark), PorterDuff.Mode.SRC_ATOP);

    mImageViewGitHub.setOnClickListener(new View.OnClickListener() {
        @Override//  w  w  w .j av  a 2  s  .  c om
        public void onClick(View v) {
            Intent mIntent = new Intent();
            mIntent.setAction(Intent.ACTION_VIEW);
            mIntent.addCategory(Intent.CATEGORY_BROWSABLE);
            mIntent.setData(Uri.parse(getString(R.string.url)));
            startActivity(mIntent);
        }
    });

    AlertDialog.Builder mAlertDialog = new AlertDialog.Builder(ScanActivity.this, Utils.setThemeDialog());

    mAlertDialog.setTitle(getString(R.string.about));
    mAlertDialog.setView(mView);
    mAlertDialog.setPositiveButton(getString(R.string.okay), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    mAlertDialog.show();
}

From source file:com.airbop.library.simple.AirBopGCMIntentService.java

private static void generateImageNotification(Context context, String title, String message, String url,
        String image_url, String large_icon) {

    // The bitmap to download
    Bitmap message_bitmap = null;/*w  ww . j  a  va 2s.c  om*/
    // Should we download the image?
    if ((image_url != null) && (!image_url.equals(""))) {
        message_bitmap = AirBopImageDownloader.downloadBitmap(image_url, context);
    }
    // If we didn't get the image, we're out of here
    if (message_bitmap == null) {
        generateNotification(context, title, message, url, large_icon);
        return;
    }
    AirBopManifestSettings airBop_settings = CommonUtilities.loadDataFromManifest(context);

    int icon = airBop_settings.mNotificationIcon;

    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);

    //if ((title == null) || (title.equals(""))) {
    if (title == null) {
        title = airBop_settings.mDefaultNotificationTitle;
    }

    Intent notificationIntent = null;
    if ((url == null) || (url.equals(""))) {
        //just bring up the app
        if (context != null) {
            ClassLoader class_loader = context.getClassLoader();
            if (class_loader != null) {
                try {
                    if (airBop_settings.mDefaultNotificationClass != null) {
                        notificationIntent = new Intent(context,
                                Class.forName(airBop_settings.mDefaultNotificationClass));
                    }
                } catch (ClassNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    } else {
        //Launch the URL
        notificationIntent = new Intent(Intent.ACTION_VIEW);
        notificationIntent.setData(Uri.parse(url));
        notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE);
    }
    PendingIntent intent = null;
    // set intent so it does not start a new activity
    if (notificationIntent != null) {
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    }

    Builder notificationBuilder = new NotificationCompat.Builder(context).setContentTitle(title)
            .setContentText(message).setLargeIcon(decodeImage(large_icon)).setWhen(when)
            .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(message_bitmap));
    if (intent != null) {
        notificationBuilder.setContentIntent(intent);
    }
    if (icon != 0) {
        notificationBuilder.setSmallIcon(icon);
    }
    Notification notification = notificationBuilder.build();

    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    notificationManager.notify(0, notification);
}

From source file:net.bytten.comicviewer.ComicViewerActivity.java

public void loadAuthorLink() {
    Intent browser = new Intent();
    browser.setAction(Intent.ACTION_VIEW);
    browser.addCategory(Intent.CATEGORY_BROWSABLE);
    browser.setData(comicDef.getAuthorLinkUrl());
    startActivity(browser);/*  w  ww . java  2  s .  c o  m*/
}