Exemplo n.º 1
0
  /**
   * 获取生日
   *
   * @param date
   * @param needYear
   * @return
   */
  public static String getBirthday(long date, boolean needYear) {
    int[] details = TimeUtil.getWholeDetail(date);

    if (needYear) {
      return details[0] + "年" + details[1] + "月" + details[2] + "日";
    }
    return details[1] + "月" + details[2] + "日";
  }
Exemplo n.º 2
0
  /**
   * @param birthday
   * @return
   */
  public static String getSmartBirthday(Date birthday) {
    if (birthday == null) {
      return "";
    }
    if (birthday.getYear() > getDateDetail(System.currentTimeMillis())[0]) {
      birthday.setYear(birthday.getYear() - TimeUtil.SYSTEM_START_DATE[0]);
    }

    return getSmartBirthday(birthday.getTime(), false)
        + " "
        + (TimeUtil.getDateDetail(System.currentTimeMillis())[0] - birthday.getYear())
        + "岁";
  }
Exemplo n.º 3
0
  /**
   * 获取完整时间 yyyy年mm月dd日hh时mm分
   *
   * @param date
   * @return
   */
  public static String getWholeTime(long date) {
    int[] details = TimeUtil.getWholeDetail(date);

    return details[0]
        + "年"
        + details[1]
        + "月"
        + details[2]
        + "日  "
        + details[3]
        + "时"
        + details[4]
        + "分";
  }
Exemplo n.º 4
0
  //		    @Override
  //			public void onClick(View v) {//直接调用不会显示v被点击效果
  //				switch (v.getId()) {
  //				case R.id.ivDemoMainReturn:
  //					enterAnim = R.anim.fade;
  //					exitAnim = R.anim.bottom_push_out;
  //					finish();
  //					break;
  //				case R.id.ivDemoMainMenu:
  //					showTopMenu();
  //					break;
  //
  //				case R.id.ivDemoMainHead:
  //					selectPicture();
  //					break;
  //				case R.id.tvDemoMainHeadName:
  //					editName(true);
  //					break;
  //
  //				case R.id.llDemoMainItemOnlyDialog:
  //					showItemOnlyDialog();
  //					break;
  //				case R.id.llDemoMainMyAlertDialog:
  //					showMyAlertDialog();
  //					break;
  //
  //				case R.id.llDemoMainSelectPictureActivity:
  //					selectPicture();
  //					break;
  //				case R.id.llDemoMainCutPictureActivity:
  //					cutPicture(picturePath);
  //					break;
  //				case R.id.llDemoMainWebViewActivity:
  //					toActivity(WebViewActivity.createIntent(context, "百度首页", "www.baidu.com"));
  //					break;
  //				case R.id.llDemoMainEditTextInfoActivity:
  //					editName(false);
  //					break;
  //				case R.id.llDemoMainDemoActivity:
  //					toActivity(DemoActivity.createIntent(context, null));
  //					break;
  //				case R.id.llDemoMainDemoFragmentActivity:
  //					toActivity(DemoFragmentActivity.createIntent(context, null));
  //					break;
  //				case R.id.llDemoMainDemoTimeRefresherActivity:
  //					toActivity(DemoTimeRefresherActivity.createIntent(context));
  //					break;
  //				case R.id.llDemoMainTopMenuWindow:
  //					showTopMenu();
  //					break;
  //				case R.id.llDemoMainBottomMenuWindow:
  //					toActivity(BottomMenuWindow.createIntent(context, "选择颜色", topbarColorNames),
  // REQUEST_TO_BOTTOM_MENU, false);
  //					break;
  //				case R.id.llDemoMainEditTextInfoWindow:
  //					editName(true);
  //					break;
  //				case R.id.llDemoMainDatePickerWindow:
  //					toActivity(DatePickerWindow.createIntent(context, new int[]{1971, 0, 1}
  //					, TimeUtil.getDateDetail(System.currentTimeMillis())), REQUEST_TO_DATE_PICKER, false);
  //					break;
  //				case R.id.llDemoMainPlacePickerWindow:
  //					toActivity(PlacePickerWindow.createIntent(context, 2), REQUEST_TO_PLACE_PICKER, false);
  //					break;
  //				default:
  //					break;
  //				}
  //			}
  // Library内switch方法中case R.id.idx:报错
  @Override
  public void onClick(View v) { // 直接调用不会显示v被点击效果
    if (v.getId() == R.id.ivDemoMainReturn) {
      enterAnim = R.anim.fade;
      exitAnim = R.anim.bottom_push_out;
      finish();
    } else if (v.getId() == R.id.ivDemoMainMenu) {
      showTopMenu();
    } else if (v.getId() == R.id.ivDemoMainHead) {
      selectPicture();
    } else if (v.getId() == R.id.tvDemoMainHeadName) {
      editName(true);
    } else if (v.getId() == R.id.llDemoMainItemOnlyDialog) {
      showItemOnlyDialog();
    } else if (v.getId() == R.id.llDemoMainMyAlertDialog) {
      showMyAlertDialog();

    } else if (v.getId() == R.id.llDemoMainSelectPictureActivity) {
      selectPicture();
    } else if (v.getId() == R.id.llDemoMainCutPictureActivity) {
      cutPicture(picturePath);
    } else if (v.getId() == R.id.llDemoMainWebViewActivity) {
      toActivity(
          WebViewActivity.createIntent(
              context,
              SettingUtil.isOnTestMode ? "测试服务器网址" : "正式服务器网址",
              SettingUtil.getCurrentServerAddress(context)));
    } else if (v.getId() == R.id.llDemoMainEditTextInfoActivity) {
      editName(false);

    } else if (v.getId() == R.id.llDemoMainDemoActivity) {
      toActivity(DemoActivity.createIntent(context, 0));
    } else if (v.getId() == R.id.llDemoMainDemoFragmentActivity) {
      toActivity(DemoFragmentActivity.createIntent(context, null));
    } else if (v.getId() == R.id.llDemoMainDemoTabActivity) {
      toActivity(
          DemoTabActivity.createIntent(context).putExtra(DemoTabActivity.INTENT_TITLE, "Yes!"));
    } else if (v.getId() == R.id.llDemoMainDemoTimeRefresherActivity) {
      toActivity(DemoTimeRefresherActivity.createIntent(context));

    } else if (v.getId() == R.id.llDemoMainTopMenuWindow) {
      showTopMenu();
    } else if (v.getId() == R.id.llDemoMainBottomMenuWindow) {
      toActivity(
          BottomMenuWindow.createIntent(context, topbarColorNames)
              .putExtra(BottomMenuWindow.INTENT_TITLE, "选择颜色"),
          REQUEST_TO_BOTTOM_MENU,
          false);
    } else if (v.getId() == R.id.llDemoMainEditTextInfoWindow) {
      editName(true);
    } else if (v.getId() == R.id.llDemoMainDatePickerWindow) {
      toActivity(
          DatePickerWindow.createIntent(
              context, new int[] {1971, 0, 1}, TimeUtil.getDateDetail(System.currentTimeMillis())),
          REQUEST_TO_DATE_PICKER,
          false);
    } else if (v.getId() == R.id.llDemoMainPlacePickerWindow) {
      toActivity(
          PlacePickerWindow.createIntent(context, getPackageName(), 2),
          REQUEST_TO_PLACE_PICKER,
          false);
    }
  }