Example #1
0
  private void showcaseDrawerPress() {
    // only show on first boot
    if (alreadyShowcasedDrawer) {
      return;
    }

    final int vertDp = ViewsHelper.convertDip2Pixels(this, 110);
    final int horDp = ViewsHelper.convertDip2Pixels(this, 60);

    if (sv != null) {
      sv.setText(R.string.showcase_drawer_title, R.string.showcase_drawer_msg);
      sv.setShowcasePosition(horDp, vertDp);
      sv.show();
    } else {
      final ConfigOptions options = new ConfigOptions();
      options.shotType = ShowcaseView.TYPE_NO_LIMIT;
      options.block = true;
      // Used in saving state
      options.showcaseId = 2;
      sv =
          ShowcaseView.insertShowcaseView(
              horDp,
              vertDp,
              this,
              R.string.showcase_drawer_title,
              R.string.showcase_drawer_msg,
              options);
      sv.show();
    }
    PreferenceManager.getDefaultSharedPreferences(this)
        .edit()
        .putBoolean(SHOWCASED_DRAWER, true)
        .commit();
    alreadyShowcasedDrawer = true;
  }
Example #2
0
 /**
  * Quickly insert a ShowcaseView into an Activity, highlighting an item.
  *
  * @param type the type of item to showcase (can be ITEM_ACTION_HOME, ITEM_TITLE_OR_SPINNER,
  *     ITEM_ACTION_ITEM or ITEM_ACTION_OVERFLOW)
  * @param itemId the ID of an Action item to showcase (only required for ITEM_ACTION_ITEM
  * @param activity Activity to insert the ShowcaseView into
  * @param title Text to show as a title. Can be null.
  * @param detailText More detailed text. Can be null.
  * @param options A set of options to customise the ShowcaseView
  * @return the created ShowcaseView instance
  */
 public static ShowcaseView insertShowcaseViewWithType(
     int type, int itemId, Activity activity, int title, int detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcaseItem(type, itemId, activity);
   sv.setText(title, detailText);
   return sv;
 }
Example #3
0
 public static ShowcaseView insertShowcaseView(
     float x, float y, Activity activity, String title, String detailText, ConfigOptions options) {
   ShowcaseView sv = new ShowcaseView(activity);
   if (options != null) sv.setConfigOptions(options);
   if (sv.getConfigOptions().insert == INSERT_TO_DECOR) {
     ((ViewGroup) activity.getWindow().getDecorView()).addView(sv);
   } else {
     ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv);
   }
   sv.setShowcasePosition(x, y);
   sv.setText(title, detailText);
   return sv;
 }
Example #4
0
 public void setText(int titleTextResId, int subTextResId) {
   String titleText = getContext().getResources().getString(titleTextResId);
   String subText = getContext().getResources().getString(subTextResId);
   setText(titleText, subText);
 }