List of usage examples for android.text.format DateUtils LENGTH_LONG
int LENGTH_LONG
To view the source code for android.text.format DateUtils LENGTH_LONG.
Click Source Link
From source file:org.ohmage.reminders.types.time.TimeTrigDesc.java
public static String getDayOfWeekString(int dayOfWeek) { return DateUtils.getDayOfWeekString(dayOfWeek, DateUtils.LENGTH_LONG); }
From source file:com.provision.alarmemi.paper.fragments.SetAlarmFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { mActivity.setOnLifeCycleChangeListener(this); isChanged = isCloud = false;/*from w ww .j a va2s.co m*/ // Override the default content view. root = (ViewGroup) super.onCreateView(inflater, container, bundle); final ImageView moreAlarm = (ImageView) root.findViewById(R.id.more_alarm); FragmentChangeActivity.moreAlarm = moreAlarm; moreAlarm.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (menu.isMenuShowing()) { menu.showContent(); } else { menu.showMenu(true); } } }); // Make the entire view selected when focused. moreAlarm.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { v.setSelected(hasFocus); } }); addPreferencesFromResource(R.xml.alarm_prefs); myUUID = SplashActivity.myUUID; // Get each preference so we can retrieve the value later. mLabel = findPreference("label"); mLabel.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showEditTextPreference(mLabel.getKey(), mLabel.getTitle(), mLabelText); return true; } }); Preference.OnPreferenceChangeListener preferceChangedListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference p, Object newValue) { isChanged = true; return true; } }; mEnabledPref = (CheckBoxPreference) findPreference("enabled"); mEnabledPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (!isCloud) { isChanged = true; if ((Boolean) newValue) showCategory(); else hideCategory(); return true; } if ((Boolean) newValue) { try { tempjson = new JSONArray("[]"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } selectedDevice = ""; for (int i = 0; i < json.length(); i++) { if (UIDitems[i].toString().equals(myUUID)) checkedItems[i] = true; if (checkedItems[i]) { Map<String, String> map = new HashMap<String, String>(); map.put("name", URLDecoder.decode(items[i].toString())); map.put("uid", UIDitems[i].toString()); tempjson.put(map); selectedDevice += items[i] + ", "; } } if (!selectedDevice.equals("")) selectedDevice = selectedDevice.substring(0, selectedDevice.length() - 2); } else { try { tempjson = new JSONArray("[]"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } selectedDevice = ""; for (int i = 0; i < json.length(); i++) { if (UIDitems[i].toString().equals(myUUID)) checkedItems[i] = false; if (checkedItems[i]) { Map<String, String> map = new HashMap<String, String>(); map.put("name", URLDecoder.decode(items[i].toString())); map.put("uid", UIDitems[i].toString()); tempjson.put(map); selectedDevice += items[i] + ", "; } } if (!selectedDevice.equals("")) selectedDevice = selectedDevice.substring(0, selectedDevice.length() - 2); } mForest.setSummary(selectedDevice); isChanged = true; return true; } }); mTimePref = findPreference("time"); mVibratePref = (CheckBoxPreference) findPreference("vibrate"); mVibratePref.setOnPreferenceChangeListener(preferceChangedListener); mRepeatPref = findPreference("setRepeat"); mRepeatPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { String[] values = new String[] { DateUtils.getDayOfWeekString(Calendar.MONDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.TUESDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.WEDNESDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.THURSDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.FRIDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.SATURDAY, DateUtils.LENGTH_LONG), DateUtils.getDayOfWeekString(Calendar.SUNDAY, DateUtils.LENGTH_LONG) }; Intent intent = new Intent(mActivity, RepeatListPreference.class); intent.putExtra("key", mRepeatPref.getKey()); intent.putExtra("title", mRepeatPref.getTitle()); intent.putExtra("lists", values); intent.putExtra("multi", true); startActivity(intent); return true; } }); mForestName = findPreference("forest_name"); mForest = findPreference("forest"); mColorPref = (AmbilWarnaPreference) findPreference("color"); prefs = mActivity.getSharedPreferences("forest", mActivity.MODE_PRIVATE); Intent i = mActivity.setAlarmGetIntent; mId = i.getIntExtra(Alarms.ALARM_ID, -1); alarm = null; if (mId == -1) { // No alarm id means create a new alarm. alarm = new Alarm(); isChanged = true; } else { // * load alarm details from database alarm = Alarms.getAlarm(mActivity.getContentResolver(), mId); // Bad alarm, bail to avoid a NPE. if (alarm == null) { finish(); return root; } isCloud = wasCloud = alarm.cloudEnabled; } mOriginalAlarm = alarm; if (wasCloud) { try { Log.e("url", " : " + alarm.cloudName); json = new JSONArray(prefs.getString(alarm.cloudName + "_registeredDevice", "")); String cloud_uid = alarm.cloudUID; if (cloud_uid.equals("")) cloud_uid = "[]"; Log.e("url", cloud_uid); tempjson = new JSONArray(cloud_uid); items = new String[json.length()]; UIDitems = new CharSequence[json.length()]; checkedItems = new boolean[json.length()]; for (int j = 0; j < json.length(); j++) { JSONObject jsonObj = json.getJSONObject(j); items[j] = jsonObj.getString("name"); UIDitems[j] = jsonObj.getString("uid"); checkedItems[j] = alarm.cloudUID.contains(jsonObj.getString("uid")); } } catch (Exception e) { Log.e("url", e.toString()); } selectedDevice = alarm.cloudDevices; mForestName.setEnabled(false); } else { if (prefs.getString("name", "").length() > 0) { names = prefs.getString("name", "").substring(1).split("\\|"); nameCheckedIndex = -1; } else mForestName.setEnabled(false); mForest.setEnabled(false); } memi_count = alarm.memiCount; snooze_strength = alarm.snoozeStrength; snooze_count = alarm.snoozeCount; updatePrefs(mOriginalAlarm); mTimePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { showTimePicker(); return false; } }); mForestName.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showListPreference(mForestName.getKey(), mForestName.getTitle(), names, String.valueOf(nameCheckedIndex), false); return true; } }); mForest.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference arg0) { showListPreference(mForest.getKey(), mForest.getTitle(), items, booleanArrayToString(checkedItems), true); return true; } }); mColorPref.setOnPreferenceChangeListener(preferceChangedListener); // We have to do this to get the save/cancel buttons to highlight on // their own. ((ListView) root.findViewById(android.R.id.list)).setItemsCanFocus(true); // Attach actions to each button. View.OnClickListener back_click = new View.OnClickListener() { public void onClick(View v) { DontSaveDialog(false, null, false); } }; ImageView b = (ImageView) root.findViewById(R.id.back); b.setOnClickListener(back_click); b = (ImageView) root.findViewById(R.id.logo); b.setOnClickListener(back_click); b = (ImageView) root.findViewById(R.id.alarm_save); b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { saveAlarm(); } }); b = (ImageView) root.findViewById(R.id.alarm_delete); if (mId == -1) { b.setEnabled(false); } else { b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { deleteAlarm(); } }); } // The last thing we do is pop the time picker if this is a new alarm. if (mId == -1) { // Assume the user hit cancel mTimePickerCancelled = true; showTimePicker(); } if (!isCloud && !alarm.enabled) hideCategory(); FragmentChangeActivity.OnNotifyArrived.sendEmptyMessage(0); return root; }
From source file:de.tum.in.tumcampus.auxiliary.calendar.DayView.java
private void init(Context context) { setFocusable(true);/*from w w w .j a va2s.c o m*/ // Allow focus in touch mode so that we can do keyboard shortcuts // even after we've entered touch mode. setFocusableInTouchMode(true); setClickable(true); setOnCreateContextMenuListener(this); mFirstDayOfWeek = Time.MONDAY; mCurrentTime = new Time(DayUtils.getTimeZone(context, mTZUpdater)); long currentTime = System.currentTimeMillis(); mCurrentTime.set(currentTime); mTodayJulianDay = Time.getJulianDay(currentTime, mCurrentTime.gmtoff); mEventTextPaint.setTextSize(EVENT_TEXT_FONT_SIZE); mEventTextPaint.setTextAlign(Align.LEFT); mEventTextPaint.setAntiAlias(true); int gridLineColor = 0xff707070; Paint p = mSelectionPaint; p.setColor(gridLineColor); p.setStyle(Style.FILL); p.setAntiAlias(false); p = mPaint; p.setAntiAlias(true); // Long day names mDayStrsLong = new String[14]; // Allocate space for 2 weeks worth of weekday names so that we can // easily start the week display at any week day. mDayStrs = new String[14]; // Also create an array of 2-letter abbreviations. mDayStrs2Letter = new String[14]; for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) { int index = i - Calendar.SUNDAY; mDayStrsLong[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_LONG).toUpperCase(); mDayStrsLong[index + 7] = mDayStrsLong[index]; // e.g. Tue for Tuesday mDayStrs[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_MEDIUM).toUpperCase(); mDayStrs[index + 7] = mDayStrs[index]; // e.g. Tu for Tuesday mDayStrs2Letter[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_SHORT).toUpperCase(); // If we don't have 2-letter day strings, fall back to 1-letter. if (mDayStrs2Letter[index].equals(mDayStrs[index])) { mDayStrs2Letter[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_SHORTEST); } mDayStrs2Letter[index + 7] = mDayStrs2Letter[index]; } // Figure out how much space we need for the 3-letter abbrev names // in the worst case. p.setTextSize(DATE_HEADER_FONT_SIZE); p.setTypeface(mBold); String[] dateStrs = { " 28", " 30" }; mDateStrWidth = computeMaxStringWidth(0, dateStrs, p); Time time = new Time(); time.setJulianDay(mFirstJulianDay); String s = SimpleDateFormat.getDateInstance().format(new Date(time.toMillis(false))); mDateStrWidthLong = computeMaxStringWidth(0, new String[] { s }, p); p.setTextSize(DAY_HEADER_FONT_SIZE); mDateStrWidth += computeMaxStringWidth(0, mDayStrs, p); mDateStrWidthLong += computeMaxStringWidth(0, mDayStrsLong, p); p.setTextSize(HOURS_TEXT_SIZE); p.setTypeface(null); handleOnResume(); mAmString = DateUtils.getAMPMString(Calendar.AM).toUpperCase(); mPmString = DateUtils.getAMPMString(Calendar.PM).toUpperCase(); String[] ampm = { mAmString, mPmString }; p.setTextSize(AMPM_TEXT_SIZE); mHoursWidth = Math.max(HOURS_MARGIN, computeMaxStringWidth(mHoursWidth, ampm, p) + HOURS_RIGHT_MARGIN); mHoursWidth = Math.max(MIN_HOURS_WIDTH, mHoursWidth); LayoutInflater inflater; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Resources.Theme dialogTheme = getResources().newTheme(); dialogTheme.applyStyle(android.R.style.Theme_Dialog, true); TypedArray ta = dialogTheme.obtainStyledAttributes(new int[] { android.R.attr.windowBackground }); // Catch long clicks for creating a new event mBaseDate = new Time(DayUtils.getTimeZone(context, mTZUpdater)); long millis = System.currentTimeMillis(); mBaseDate.set(millis); mEarliestStartHour = new int[mNumDays]; mHasAllDayEvent = new boolean[mNumDays]; // mLines is the array of points used with Canvas.drawLines() in // drawGridBackground() and drawAllDayEvents(). Its size depends // on the max number of lines that can ever be drawn by any single // drawLines() call in either of those methods. final int maxGridLines = (24 + 1) // max horizontal lines we might draw + (mNumDays + 1); // max vertical lines we might draw mLines = new float[maxGridLines * 4]; }
From source file:com.plusot.senselib.SenseMain.java
@SuppressWarnings("deprecation") public void showPopupDialog(int dialogId, int viewId, String[] items) {// , if (!alive) { if (dialogId == STEP_POPUP) popupToShow = STEP_POPUP;/* w w w . j a v a 2 s.c o m*/ return; } int iEnd = 3; int timeOut = 0; int defaultChoice = 0; boolean cancelable = true; popupToShow = -1; String title = null; Map<String, String> lookup = null; if (items == null) items = getResources().getStringArray(R.array.value_popup_dialog_items); switch (dialogId) { case VALUE_POPUP: title = getString(R.string.valuepopup); items = getResources().getStringArray(R.array.value_popup_dialog_items); if (viewHasValue(viewId)) { popupValue = viewGetCurrentValue(viewId); title = popupValue.getValueType(this); if (popupValue.getValueType().equals(ValueType.POWER)) { items = Arrays.copyOf(items, items.length + 1); items[items.length - 1] = getString(R.string.calibrate); } else if (popupValue.getValueType().equals(ValueType.SLOPE)) { items = Arrays.copyOf(items, items.length + 1); items[items.length - 1] = getString(R.string.set_level); } } break; case VALUESELECT_POPUP: title = getString(R.string.valuepopup); items = Value.getValuePopupList(this, PreferenceKey.XTRAVALUES.isTrue()); break; case UNIT_POPUP: title = getString(R.string.unitpopup); if (items == null || items.length == 0) ToastHelper.showToastLong(R.string.no_unit_choice); break; case YEAR_POPUP: title = getString(R.string.yearpopup); if (fileExplorer == null) { items = null; } else { items = fileExplorer.getYears(); } if (items == null || items.length == 0) { ToastHelper.showToastLong(R.string.no_year_choice); return; } else if (items.length > 1) { break; } logYear = items[0]; dialogId = MONTH_POPUP; case MONTH_POPUP: title = getString(R.string.monthpopup); if (fileExplorer == null) { items = null; } else { logMonths = fileExplorer.getMonths(logYear); items = FileExplorer.getMonths(logYear, logMonths); } if (items == null || items.length == 0) { ToastHelper.showToastLong(getString(R.string.no_month_choice, logYear)); return; } else if (items.length > 1) { break; } logMonth = logMonths[0]; LLog.d(Globals.TAG, CLASSTAG + ".showPopupDialog: logMonth = " + logMonth); dialogId = DAY_POPUP; case DAY_POPUP: title = getString(R.string.daypopup); if (fileExplorer == null) { items = null; } else { logDays = fileExplorer.getDays(logYear, logMonth); items = FileExplorer.getDays(logYear, DateUtils.getMonthString(logMonth - 1, DateUtils.LENGTH_LONG), logDays); } break; case TIMES_POPUP: title = getString(R.string.timespopup); if (fileExplorer == null) { items = null; } else { items = fileExplorer.getTimes(logYear, logMonth, logDay); } break; case MOVESTART_POPUP: lastAskForActivityStart = System.currentTimeMillis(); if (moveStartBusy) { title = null; } else { moveStartBusy = true; title = getString(R.string.movestartpopup); items = getResources().getStringArray(R.array.start_popup_dialog_items); if (SenseGlobals.stopState.equals(SenseGlobals.StopState.STOP)) items = Arrays.copyOfRange(items, 1, iEnd); else items = Arrays.copyOfRange(items, 0, iEnd); cancelable = false; } break; case STEP_POPUP: lastAskForActivityStart = System.currentTimeMillis(); timeOut = 10000; switch (step) { case 0: title = getString(R.string.recoverypopup); items = getResources().getStringArray(R.array.fitnessorrecovery_popup_dialog_items); cancelable = false; break; case 1: title = getString(R.string.step1settingspopup); List<String> list = new ArrayList<String>(); String profile = PreferenceKey.getProfileName(); list.add(getString(R.string.step1_bikeprofile, profile)); //list.add(getString(R.string.popitem_wheelcirumference, prefs.getWheelCirc())); if (PreferenceKey.USEPAIRING.isTrue()) list.add(getString(R.string.popitem_pairing_on, profile)); else list.add(getString(R.string.popitem_pairing_off, profile)); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); if (adapter != null && adapter.isEnabled()) list.add(getString(R.string.popitem_bluetooth_on)); else list.add(getString(R.string.popitem_bluetooth_off)); list.add(getString(R.string.step_continue)); items = list.toArray(new String[0]); cancelable = false; break; case 2: if (PreferenceKey.XTRAVALUES.isTrue()) { title = getString(R.string.startpopup); iEnd = 3; } else { title = getString(R.string.step2startpopup); iEnd = 4; } cancelable = false; if (title == null) title = getString(R.string.startpopup); items = getResources().getStringArray(R.array.start_popup_dialog_items); if (SenseGlobals.stopState.equals(SenseGlobals.StopState.STOP)) { items = Arrays.copyOfRange(items, 1, iEnd); startOptions = 3; } else { items = Arrays.copyOfRange(items, 0, iEnd); startOptions = 4; } break; } break; case START_POPUP: lastAskForActivityStart = System.currentTimeMillis(); if (title == null) title = getString(R.string.startpopup); timeOut = 10000; items = getResources().getStringArray(R.array.start_popup_dialog_items); if (SenseGlobals.stopState.equals(SenseGlobals.StopState.STOP)) items = Arrays.copyOfRange(items, 1, iEnd); else items = Arrays.copyOfRange(items, 0, iEnd); break; case ARGOSSTOP_POPUP: cancelable = false; switch (argosStopStep) { case 0: title = getString(R.string.intensitypopup); items = getResources().getStringArray(R.array.intensity_popup_dialog_items); break; case 1: title = getString(R.string.fitnesspopup); items = getResources().getStringArray(R.array.fitnessorrecovery_popup_dialog_items); break; } break; case FULLSTOP_POPUP: lastAskForActivityStart = System.currentTimeMillis(); title = getString(R.string.stoppopup); items = getResources().getStringArray(R.array.stop_popup_dialog_items); break; case STOP_POPUP: lastAskForActivityStart = System.currentTimeMillis(); title = getString(R.string.stoppopup); items = getResources().getStringArray(R.array.stop_popup_dialog_items); break; case SHARE_POPUP: title = getString(R.string.sharepopup); items = getResources().getStringArray(R.array.share_popup_dialog_items); if (Globals.testing.isNoTest()) items = Arrays.copyOf(items, items.length - 1); break; case INTERVAL_POPUP: title = getString(R.string.menu_interval); items = getResources().getStringArray(R.array.interval_popup_dialog_items); break; case GPX_POPUP: title = getString(R.string.menu_gpx); FileExplorer.FileList list = FileExplorer.getFileList( new String[] { Globals.getDataPath(), Globals.getDownloadPath(), SenseGlobals.getGpxPath() }, new String[] { ".gpx" }, false); items = list.items; lookup = list.lookup; break; } if (title != null && items != null && items.length > 0) { if (!PopupDialog.showPopupDialog(getFragmentManager(), title, dialogId, viewId, items, lookup, cancelable, timeOut, defaultChoice) && dialogId == STEP_POPUP) popupToShow = STEP_POPUP; } }
From source file:com.plusot.senselib.SenseMain.java
@SuppressWarnings("deprecation") public void onPopupResult(int dialogId, int viewId, int iWhich, int itemsSize, String sWhich, String sTag) { // , int tag) { switch (dialogId) { case VALUE_POPUP: switch (iWhich) { /*case 0:/*from w w w . java 2s . co m*/ showPopupDialog(VALUESELECT_POPUP, viewId, null); // , 0); break;*/ case 0: showMultiChoiceDialog(VALUESELECT_POPUP, viewId); break; case 1: // if (SenseGlobals.isLite) // showLiteWarning(); // else if (PreferenceKey.VOICEON.isTrue()) showMultiChoiceDialog(SPEECHSELECT_POPUP, viewId); else warnNoSpeech(); break; case 2: if (popupValue == null) { popupValue = viewGetCurrentValue(viewId); } if (popupValue != null) { final String[] units = Unit.getValidUnits(popupValue.getValueType().getUnitType(), this); showPopupDialog(UNIT_POPUP, viewId, units); } break; case 3: if (sWhich.equals(getString(R.string.calibrate))) { calibrate(); } else if (sWhich.equals(getString(R.string.set_level))) { if (Manager.managers.get(ManagerType.SENSOR_MANAGER) == null) return; ((AndroidSensorManager) Manager.managers.get(ManagerType.SENSOR_MANAGER)).setLevel(); ToastHelper.showToastLong(R.string.level_message); } break; } break; case UNIT_POPUP: final Unit unit = Unit.getUnitByChoiceString(sWhich, this); if (popupValue != null) { popupValue.setUnit(unit); } break; case VALUESELECT_POPUP: viewSetValue(viewId, Value.getValueByString(this, sWhich)); ToastHelper.showToastShort(getString(R.string.hint_long_click)); saveConfiguration(); break; case YEAR_POPUP: logYear = sWhich; showPopupDialog(MONTH_POPUP, viewId, null); // , 0); break; case MONTH_POPUP: logMonth = logMonths[iWhich]; LLog.d(Globals.TAG, CLASSTAG + ".showPopupDialog: logMonth = " + logMonth); showPopupDialog(DAY_POPUP, viewId, null); // , 0); break; case DAY_POPUP: logDay = logDays[iWhich]; if (fileExplorer != null) { switch (fileExplorer.getTag()) { case FileExplorer.ACTIVITY_TAG: showPopupDialog(TIMES_POPUP, viewId, null); break; } } break; case TIMES_POPUP: if (fileExplorer != null) { switch (fileExplorer.getTag()) { case FileExplorer.ACTIVITY_TAG: stopActivity("onPopupResult", false); ToastHelper.showToastLong(getString(R.string.chosen_file) + " = " + logDay + " " + DateUtils.getMonthString(logMonth - 1, DateUtils.LENGTH_LONG) + " " + logYear + " " + sWhich); DataLog dataLog = DataLog.getInstance(); if (dataLog != null) { String file = fileExplorer.getFileList(logYear, logMonth, logDay, sWhich); if (file != null) { SenseGlobals.replaySession = logYear + String.format("%02d%02d", logMonth, logDay) + "-" + sWhich.substring(0, 2) + sWhich.substring(3, 5) + sWhich.substring(6, 8); LLog.d(Globals.TAG, CLASSTAG + ".onPopupResult: ReplaySession = " + SenseGlobals.replaySession); dataLog.readCsv(new String[] { file }, this); } } // if (showMap) showLocation(); break; } } break; case STEP_POPUP: switch (step) { case 0: argosRecovery = 6 + iWhich; step = 1; showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null); break; case 1: LLog.d(Globals.TAG, CLASSTAG + ".onPopuResult: STEP1SETTINGS_POPUP = " + iWhich); //ActivityUtil.lockScreenOrientation(this); switch (iWhich) { case 0: startActivityForResult(new Intent(this, BikeSettingsActivity.class), RESULT_STEP1); break; case 1: startActivityForResult(new Intent(SenseMain.this, AntSettingsActivity.class), RESULT_STEP1); break; case 2: startActivityForResult(new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS), RESULT_STEP1); break; default: //enableAnt(); step = 2; showPopupDialog(STEP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null); break; } break; case 2: if (iWhich == startOptions - 1) startUpDialogs("STEP2START_POPUP"); else { View view = this.findViewById(R.id.main_layout); if (view != null) view.setVisibility(View.VISIBLE); if (iWhich >= 0 && iWhich <= startOptions - 3) startActivity(iWhich == startOptions - 3); stepsDone = true; } lastAskForActivityStart = System.currentTimeMillis(); break; } break; case MOVESTART_POPUP: moveStartBusy = false; lastAskForActivityStart = System.currentTimeMillis(); case START_POPUP: if (iWhich >= 0 && iWhich <= itemsSize - 2) startActivity(iWhich == itemsSize - 2); break; case ARGOSSTOP_POPUP: switch (argosStopStep) { case 0: SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("recovery=" + argosRecovery); SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("intensity=" + (6 + iWhich)); argosStopStep = 1; showPopupDialog(ARGOSSTOP_POPUP, VIEW_ID_BASE + viewsAdded - 1, null); break; case 1: SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE).log("fitness=" + (6 + iWhich)); new InputDialog(this, 666, R.string.remarkspopup_title, R.string.remarkspopup_description, "", R.string.remarkspopup_hint, new InputDialog.Listener() { @Override public void onClose(int id, String temp) { SimpleLog.getInstance(SimpleLogType.TEXT, ARGOS_MENTALSTATEFILE) .log("remark=" + temp); argosStopStep = 2; new SleepAndWake(new SleepAndWake.Listener() { @Override public void onWake() { shouldFinish = (shouldFinish == 1) ? 2 : 0; sendMail(true); } }, 100); } }).show(); break; } break; case FULLSTOP_POPUP: lastAskForActivityStart = System.currentTimeMillis(); if (iWhich == 0) { ToastHelper.showToastLong(R.string.toast_pause); pauseActivity("onPopupResult"); finishIt(); } else { stopActivity("onPopupResult", true); } // if (dialogId == FULLSTOP_POPUP) finishIt(); break; case STOP_POPUP: lastAskForActivityStart = System.currentTimeMillis(); if (iWhich == 0) { ToastHelper.showToastLong(R.string.toast_pause); pauseActivity("onPopupResult"); } else { stopActivity("onPopupResult", false); } break; case SHARE_POPUP: switch (iWhich) { case 0: this.sendMail(false); break; case 1: // if (SenseGlobals.isLite) { // this.showLiteWarning(); // } else if (!PreferenceKey.HTTPPOST.isTrue()) showTweetWarning(); else { String link = getString(R.string.tweet_msg, Globals.TAG, PreferenceKey.SHARE_URL.getString() + "?device=" + SenseUserInfo.getDeviceId(), TimeUtil.formatTime(System.currentTimeMillis(), "EEE dd MMM HH:mm:ss")); int session = HttpSender.getSession(); if (session >= 0) link += "&session=" + session; new Tweet(this, null).send(link); } break; case 2: // if (SenseGlobals.isLite) // this.showLiteWarning(); // else this.sendTP(); break; case 3: if (!Value.fileTypes.contains(FileType.FIT)) { this.warnNoFit(); break; } switch (new SendStravaMail(this).send()) { case SUCCES: break; case NOACCOUNT: this.warnAccount(); break; case NOFILES: this.warnNoFilesToday(); break; } break; case 4: StringBuffer buf = new StringBuffer(); buf.append("\nApp version: " + UserInfo.appNameVersion() + "\n"); buf.append("Android version: " + Build.VERSION.RELEASE + "\n"); buf.append("Android incremental: " + Build.VERSION.INCREMENTAL + "\n"); buf.append("Android SDK: " + Build.VERSION.SDK_INT + "\n"); //buf.append("FINGERPRINT: "+Build.FINGERPRINT+ "\n"); buf.append("Device manufacturer: " + Build.MANUFACTURER + "\n"); buf.append("Device brand: " + Build.BRAND + "\n"); buf.append("Device model: " + Build.MODEL + "\n"); buf.append("Device board: " + Build.BOARD + "\n"); buf.append("Device id: " + Build.DEVICE); new LogMail(this, getString(R.string.reportmail, TimeUtil.formatTime(System.currentTimeMillis()), buf), getString(R.string.mail_sending), getString(R.string.no_mail_to_send), null); } break; case INTERVAL_POPUP: switch (iWhich) { case 0: newInterval(); break; case 1: new LapsDialog(this, Laps.getLaps() - 1, false).show(); } break; case GPX_POPUP: ToastHelper.showToastLong(getString(R.string.get_gpx_file, sWhich + " " + sTag)); getGPX(sTag); break; } }