Пример #1
0
  public static String appendFeatureManagerURLParams(String url) {
    long remainingUses = FeatureManagerUI.getRemaining();
    long plusExpiryTimeStamp = FeatureManagerUI.getPlusExpiryDisplayTimeStamp();
    String plusRenewalCode = FeatureManagerUI.getPlusRenewalCode();

    String newURL = url + (url.contains("?") ? "&" : "?");
    newURL += "mode=" + FeatureManagerUI.getMode();
    if (plusExpiryTimeStamp != 0) {
      newURL += "&remaining_plus=" + (plusExpiryTimeStamp - SystemTime.getCurrentTime());
    }
    newURL += "&remaining=" + remainingUses;
    if (plusRenewalCode != null) {
      newURL += "&renewal_code=" + plusRenewalCode;
    }

    return newURL;
  }
Пример #2
0
  public static void openStreamPlusWindow(final String referal) {
    String msgidPrefix;
    String buttonID;
    long plusExpiryTimeStamp = FeatureManagerUI.getPlusExpiryTimeStamp();
    if (plusExpiryTimeStamp < 0 || plusExpiryTimeStamp >= SystemTime.getCurrentTime()) {
      msgidPrefix = "dlg.stream.plus.";
      buttonID = "Button.upgrade";
    } else {
      buttonID = "Button.renew";
      msgidPrefix = "dlg.stream.plus.renew.";
      if (!MessageText.keyExistsForDefaultLocale(msgidPrefix + "text")) {
        msgidPrefix = "dlg.stream.plus.";
      }
    }
    final String f_msgidPrefix = msgidPrefix;
    final VuzeMessageBox box =
        new VuzeMessageBox(
            MessageText.getString(msgidPrefix + "title"),
            MessageText.getString(msgidPrefix + "text"),
            new String[] {
              MessageText.getString(buttonID), MessageText.getString("Button.cancel"),
            },
            0);
    box.setButtonVals(new Integer[] {BUTTON_UPGRADE, SWT.CANCEL});

    box.setSubTitle(MessageText.getString(msgidPrefix + "subtitle"));
    box.addResourceBundle(
        FeatureManagerUI.class, SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_streamplus");
    box.setIconResource("image.header.streamplus");

    box.setListener(
        new VuzeMessageBoxListener() {
          public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
            SWTSkin skin = soExtra.getSkin();
            skin.createSkinObject("dlg.stream.plus", "dlg.stream.plus", soExtra);
            SWTSkinObject soSubText = skin.getSkinObject("trial-info", soExtra);
            if (soSubText instanceof SWTSkinObjectText) {
              ((SWTSkinObjectText) soSubText).setTextID(f_msgidPrefix + "subtext");
            }
          }
        });

    box.open(
        new UserPrompterResultListener() {
          public void prompterClosed(int result) {
            if (result == BUTTON_UPGRADE) {
              SBC_PlusFTUX.setSourceRef("dlg-stream" + (referal == null ? "" : "-" + referal));

              MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
              mdi.showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_PLUS);
            }
          }
        });
  }