├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── watch.png │ │ │ │ ├── header.png │ │ │ │ ├── button_up.png │ │ │ │ ├── watch_back.png │ │ │ │ ├── button_back.png │ │ │ │ ├── button_down.png │ │ │ │ ├── button_select.png │ │ │ │ └── row_selector.xml │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_exit.png │ │ │ │ ├── ic_play.png │ │ │ │ ├── ic_stop.png │ │ │ │ ├── tile.9.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_preview.png │ │ │ │ ├── ic_refresh.png │ │ │ │ ├── ic_tools.png │ │ │ │ ├── ic_upload.png │ │ │ │ ├── ic_watch.png │ │ │ │ ├── ic_download.png │ │ │ │ ├── ic_extension.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_settings.png │ │ │ │ ├── ic_watch_off.png │ │ │ │ ├── ic_watchface.png │ │ │ │ ├── ic_categorize.png │ │ │ │ ├── ic_watch_dial.png │ │ │ │ ├── ic_crop_free_black_48dp.png │ │ │ │ └── ic_file_upload_black_18dp.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_exit.png │ │ │ │ ├── ic_play.png │ │ │ │ ├── ic_stop.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_preview.png │ │ │ │ ├── ic_refresh.png │ │ │ │ ├── ic_tools.png │ │ │ │ ├── ic_upload.png │ │ │ │ ├── ic_watch.png │ │ │ │ ├── ic_download.png │ │ │ │ ├── ic_extension.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_settings.png │ │ │ │ ├── ic_watch_off.png │ │ │ │ ├── ic_watchface.png │ │ │ │ ├── ic_categorize.png │ │ │ │ ├── ic_watch_dial.png │ │ │ │ ├── ic_crop_free_black_48dp.png │ │ │ │ └── ic_file_upload_black_18dp.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_exit.png │ │ │ │ ├── ic_play.png │ │ │ │ ├── ic_stop.png │ │ │ │ ├── ic_tools.png │ │ │ │ ├── ic_upload.png │ │ │ │ ├── ic_watch.png │ │ │ │ ├── ic_download.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_preview.png │ │ │ │ ├── ic_refresh.png │ │ │ │ ├── ic_settings.png │ │ │ │ ├── ic_categorize.png │ │ │ │ ├── ic_extension.png │ │ │ │ ├── ic_watch_dial.png │ │ │ │ ├── ic_watch_off.png │ │ │ │ ├── ic_watchface.png │ │ │ │ ├── ic_crop_free_black_48dp.png │ │ │ │ └── ic_file_upload_black_18dp.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_add.png │ │ │ │ ├── ic_exit.png │ │ │ │ ├── ic_play.png │ │ │ │ ├── ic_stop.png │ │ │ │ ├── ic_tools.png │ │ │ │ ├── ic_watch.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_preview.png │ │ │ │ ├── ic_refresh.png │ │ │ │ ├── ic_upload.png │ │ │ │ ├── ic_categorize.png │ │ │ │ ├── ic_download.png │ │ │ │ ├── ic_extension.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_settings.png │ │ │ │ ├── ic_watch_dial.png │ │ │ │ ├── ic_watch_off.png │ │ │ │ ├── ic_watchface.png │ │ │ │ ├── ic_crop_free_black_48dp.png │ │ │ │ └── ic_file_upload_black_18dp.png │ │ │ ├── drawable-hdpi-v9 │ │ │ │ ├── ic_watch_off.png │ │ │ │ └── ic_watch_dial.png │ │ │ ├── drawable-mdpi-v9 │ │ │ │ ├── ic_watch_off.png │ │ │ │ └── ic_watch_dial.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_crop_free_black_48dp.png │ │ │ │ └── ic_file_upload_black_18dp.png │ │ │ ├── drawable-hdpi-v11 │ │ │ │ ├── ic_watch_dial.png │ │ │ │ └── ic_watch_off.png │ │ │ ├── drawable-mdpi-v11 │ │ │ │ ├── ic_watch_dial.png │ │ │ │ └── ic_watch_off.png │ │ │ ├── drawable-xhdpi-v11 │ │ │ │ ├── ic_watch_off.png │ │ │ │ └── ic_watch_dial.png │ │ │ ├── drawable-xhdpi-v9 │ │ │ │ ├── ic_watch_dial.png │ │ │ │ └── ic_watch_off.png │ │ │ ├── drawable-xxhdpi-v9 │ │ │ │ ├── ic_watch_off.png │ │ │ │ └── ic_watch_dial.png │ │ │ ├── drawable-xxhdpi-v11 │ │ │ │ ├── ic_watch_dial.png │ │ │ │ └── ic_watch_off.png │ │ │ ├── values-hdpi │ │ │ │ └── dimens.xml │ │ │ ├── values-mdpi │ │ │ │ └── dimens.xml │ │ │ ├── values-xhdpi │ │ │ │ └── dimens.xml │ │ │ ├── values-xxhdpi │ │ │ │ └── dimens.xml │ │ │ ├── layout │ │ │ │ ├── toolbar_default.xml │ │ │ │ ├── pref_switch.xml │ │ │ │ ├── pref_image_play.xml │ │ │ │ ├── drawer_header.xml │ │ │ │ ├── fragment_plugins.xml │ │ │ │ ├── fragment_watchsets.xml │ │ │ │ ├── fragment_watches.xml │ │ │ │ ├── activity_watch_set_preview.xml │ │ │ │ ├── activity_settings.xml │ │ │ │ ├── listitem_plugin.xml │ │ │ │ ├── listitem_watchset.xml │ │ │ │ ├── listitem_device.xml │ │ │ │ ├── time_interval_dialog.xml │ │ │ │ └── activity_main.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── anim │ │ │ │ ├── slide_in.xml │ │ │ │ └── slide_out.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── template-dimens.xml │ │ │ │ ├── base-strings.xml │ │ │ │ └── arrays.xml │ │ │ ├── values-sw600dp │ │ │ │ └── template-dimens.xml │ │ │ ├── values-v21 │ │ │ │ └── base-template-styles.xml │ │ │ └── menu │ │ │ │ ├── scan.xml │ │ │ │ ├── import_watchset.xml │ │ │ │ ├── gatt_services.xml │ │ │ │ ├── drawer_view.xml │ │ │ │ └── watchsets.xml │ │ └── java │ │ │ └── com │ │ │ └── althink │ │ │ └── android │ │ │ └── ossw │ │ │ ├── emulator │ │ │ ├── event │ │ │ │ ├── EmulatorEvent.java │ │ │ │ ├── EmulatorButton.java │ │ │ │ ├── ButtonPressedEmulatorEvent.java │ │ │ │ ├── ButtonLongPressedEmulatorEvent.java │ │ │ │ └── AbstractButtonEmulatorEvent.java │ │ │ ├── fonts │ │ │ │ ├── EmulatorFont.java │ │ │ │ ├── CharInfo.java │ │ │ │ ├── CharInfoLookup.java │ │ │ │ └── FontInfo.java │ │ │ ├── source │ │ │ │ ├── EmulatorResourceSource.java │ │ │ │ ├── converter │ │ │ │ │ ├── EmulatorDataConverter.java │ │ │ │ │ ├── MockConverter.java │ │ │ │ │ ├── OnesConverter.java │ │ │ │ │ ├── TensConverter.java │ │ │ │ │ ├── HundredsConverter.java │ │ │ │ │ ├── TimeToHour24Converter.java │ │ │ │ │ ├── TimeToSecondsConverter.java │ │ │ │ │ ├── TimeToMinutesConverter.java │ │ │ │ │ ├── Hour24ToHour12Converter.java │ │ │ │ │ ├── Hour24ToHour12PeriodConverter.java │ │ │ │ │ ├── TimeToRoundedHour24Converter.java │ │ │ │ │ ├── TimeToFiveMinutesRoundedTimeConverter.java │ │ │ │ │ ├── MinutesToPastToMinutesConverter.java │ │ │ │ │ └── MinutesToPastToDesignatorConverter.java │ │ │ │ ├── EmulatorDataSource.java │ │ │ │ ├── internal │ │ │ │ │ ├── ZeroDataSource.java │ │ │ │ │ ├── MacAddressInternalEmulatorDataSource.java │ │ │ │ │ ├── FirmwareVersionInternalEmulatorDataSource.java │ │ │ │ │ ├── BatteryLevelInternalEmulatorDataSource.java │ │ │ │ │ ├── YearInternalEmulatorDataSource.java │ │ │ │ │ ├── MonthInternalEmulatorDataSource.java │ │ │ │ │ ├── Hour24InternalEmulatorDataSource.java │ │ │ │ │ ├── MinutesInternalEmulatorDataSource.java │ │ │ │ │ ├── SecondsInternalEmulatorDataSource.java │ │ │ │ │ ├── DayOfWeekInternalEmulatorDataSource.java │ │ │ │ │ ├── DayOfYearInternalEmulatorDataSource.java │ │ │ │ │ ├── DayOfMonthInternalEmulatorDataSource.java │ │ │ │ │ ├── Hour12DesignatorInternalEmulatorDataSource.java │ │ │ │ │ ├── Hour12InternalEmulatorDataSource.java │ │ │ │ │ └── TimeInSecondsInternalEmulatorDataSource.java │ │ │ │ ├── EmulatorAttachedResourceSource.java │ │ │ │ ├── EmulatorModelDataSource.java │ │ │ │ ├── EmulatorConvertedDataSource.java │ │ │ │ ├── StaticDataSource.java │ │ │ │ └── ExternalEmulatorDataSource.java │ │ │ ├── actions │ │ │ │ ├── EmulatorAction.java │ │ │ │ ├── EmulatorEventHandler.java │ │ │ │ ├── EmulatorCompoundAction.java │ │ │ │ ├── EmulatorChooseAction.java │ │ │ │ ├── SimpleEmulatorAction.java │ │ │ │ └── EmulatorModelAction.java │ │ │ ├── renderer │ │ │ │ ├── ScreenRender.java │ │ │ │ ├── EmulatorExecutionContext.java │ │ │ │ └── WatchSetRenderer.java │ │ │ ├── control │ │ │ │ ├── EmulatorControl.java │ │ │ │ ├── digits │ │ │ │ │ ├── DigitsRenderer.java │ │ │ │ │ ├── NumbersFontRenderer.java │ │ │ │ │ └── GeneratedDigits.java │ │ │ │ ├── AbstractEmulatorControl.java │ │ │ │ ├── ImageEmulatorControl.java │ │ │ │ ├── TextEmulatorControl.java │ │ │ │ ├── ChooseEmulatorControl.java │ │ │ │ ├── ImageFromSetEmulatorControl.java │ │ │ │ └── ProgressEmulatorControl.java │ │ │ ├── model │ │ │ │ └── EmulatorModelProperty.java │ │ │ ├── watchset │ │ │ │ └── WatchSetScreenEmulatorModel.java │ │ │ └── WatchEmulator.java │ │ │ ├── UploadDataType.java │ │ │ ├── watchsets │ │ │ ├── WatchSetType.java │ │ │ ├── ValueResolver.java │ │ │ ├── UtilitiesFragment.java │ │ │ ├── WatchFacesFragment.java │ │ │ ├── ApplicationsFragment.java │ │ │ ├── DataSourceType.java │ │ │ ├── KnownParseError.java │ │ │ ├── DataSourceResolutionContext.java │ │ │ ├── field │ │ │ │ ├── FieldDefinition.java │ │ │ │ ├── IntegerFieldDefinition.java │ │ │ │ └── EnumFieldDefinition.java │ │ │ ├── EnumToIntResolver.java │ │ │ ├── ScreenContext.java │ │ │ ├── CompiledWatchSet.java │ │ │ └── WatchSetPreviewActivity.java │ │ │ ├── plugins │ │ │ ├── PluginPropertyType.java │ │ │ ├── PluginFunctionDefinition.java │ │ │ ├── PluginPropertyDefinition.java │ │ │ └── PluginDefinition.java │ │ │ ├── notifications │ │ │ ├── NotificationHandler.java │ │ │ ├── message │ │ │ │ ├── NotificationMessageBuilder.java │ │ │ │ ├── NotificationSummaryMessageBuilder.java │ │ │ │ ├── AlertNotificationMessageBuilder.java │ │ │ │ ├── SimpleNotificationMessageBuilder.java │ │ │ │ ├── ListNotificationMessageBuilder.java │ │ │ │ └── AbstractNotificationMessageBuilder.java │ │ │ ├── parser │ │ │ │ ├── api18 │ │ │ │ │ ├── MessageParser.java │ │ │ │ │ ├── NotificationType.java │ │ │ │ │ ├── MessageInfo.java │ │ │ │ │ ├── DefaultTicker.java │ │ │ │ │ ├── Message.java │ │ │ │ │ ├── NotificationParser.java │ │ │ │ │ ├── DefaultView.java │ │ │ │ │ └── MessageStore.java │ │ │ │ └── NotificationIdBuilder.java │ │ │ └── model │ │ │ │ ├── NotificationType.java │ │ │ │ ├── NotificationCategory.java │ │ │ │ ├── SimpleListItem.java │ │ │ │ ├── Notification.java │ │ │ │ ├── Operation.java │ │ │ │ ├── SubjectMessageItem.java │ │ │ │ ├── SimpleNotification.java │ │ │ │ ├── ListNotification.java │ │ │ │ └── AbstractNotification.java │ │ │ ├── service │ │ │ ├── ble │ │ │ │ ├── ReadCharacteristicHandler.java │ │ │ │ ├── BleConnectionStatusHandler.java │ │ │ │ ├── CharacteristicChangeHandler.java │ │ │ │ └── BleConnectionStatus.java │ │ │ ├── WatchOperationContext.java │ │ │ ├── ExternalServiceConnection.java │ │ │ ├── WatchExtensionProperty.java │ │ │ └── WatchExtensionFunction.java │ │ │ ├── utils │ │ │ ├── StringNormalizer.java │ │ │ └── FunctionHandler.java │ │ │ ├── db │ │ │ └── WatchSetInfo.java │ │ │ └── settings │ │ │ ├── TextSwitchPreference.java │ │ │ └── TimeIntervalPreference.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── althink │ │ └── android │ │ └── ossw │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .travis.yml ├── gradle.properties ├── ossw-android.iml └── gradlew.bat /.idea/.name: -------------------------------------------------------------------------------- 1 | ossw-android -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/watch.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/header.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/button_up.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/watch_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/watch_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_exit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_stop.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/tile.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/tile.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_exit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_stop.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/button_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/button_down.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_preview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_tools.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_upload.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_watch.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_preview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_tools.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_upload.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_watch.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_exit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_stop.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_tools.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_upload.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_watch.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_exit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_stop.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_tools.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_watch.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable/button_select.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_extension.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_watchface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_watchface.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_extension.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_watchface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_watchface.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_preview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_preview.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_upload.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi-v9/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi-v9/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_categorize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_categorize.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi-v9/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi-v9/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_categorize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_categorize.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_categorize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_categorize.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_extension.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_watchface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_watchface.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_categorize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_categorize.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_download.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_extension.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_watchface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_watchface.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi-v11/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi-v11/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi-v11/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi-v11/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi-v9/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi-v9/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi-v11/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi-v11/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi-v11/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi-v11/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi-v9/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi-v9/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi-v11/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi-v11/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi-v9/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi-v9/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi-v9/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi-v9/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi-v9/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi-v9/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi-v11/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi-v11/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi-v11/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi-v11/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi-v11/ic_watch_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi-v11/ic_watch_off.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi-v9/ic_watch_dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi-v9/ic_watch_dial.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_crop_free_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_crop_free_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_file_upload_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-hdpi/ic_file_upload_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_crop_free_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_crop_free_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_file_upload_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-mdpi/ic_file_upload_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_crop_free_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_crop_free_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_crop_free_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_crop_free_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_file_upload_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xhdpi/ic_file_upload_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_file_upload_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxhdpi/ic_file_upload_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_crop_free_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxxhdpi/ic_crop_free_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_file_upload_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ossw/ossw-android/HEAD/app/src/main/res/drawable-xxxhdpi/ic_file_upload_black_18dp.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/event/EmulatorEvent.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.event; 2 | 3 | /** 4 | * Created by krzysiek on 14/06/15. 5 | */ 6 | public interface EmulatorEvent { 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/UploadDataType.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw; 2 | 3 | /** 4 | * Created by krzysiek on 20/06/15. 5 | */ 6 | public enum UploadDataType { 7 | WATCH_FACE, APPLICATION, UTILITY 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | I.gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | /.idea/datasources.xml 6 | /.idea/dataSources.ids 7 | .DS_Store 8 | /build 9 | *.apk 10 | *.ap_ 11 | *.dex 12 | bin/ 13 | gen/ 14 | .gradle 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/WatchSetType.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 08/11/15. 5 | */ 6 | public enum WatchSetType { 7 | WATCH_FACE, APPLICATION, UTILITY 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/event/EmulatorButton.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.event; 2 | 3 | /** 4 | * Created by krzysiek on 14/06/15. 5 | */ 6 | public enum EmulatorButton { 7 | UP, DOWN, SELECT, BACK 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/fonts/EmulatorFont.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.fonts; 2 | 3 | /** 4 | * Created by krzysiek on 05/07/15. 5 | */ 6 | public interface EmulatorFont { 7 | FontInfo getFontInfo(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/plugins/PluginPropertyType.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.plugins; 2 | 3 | /** 4 | * Created by krzysiek on 24/06/15. 5 | */ 6 | public enum PluginPropertyType { 7 | INTEGER, FLOAT, STRING, ENUM; 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/ValueResolver.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 21/11/15. 5 | */ 6 | public interface ValueResolver { 7 | Object resolve(Object value); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-hdpi/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 288px 4 | 336px 5 | 100px 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-mdpi/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 288px 4 | 336px 5 | 100px 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-xhdpi/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 432px 4 | 504px 5 | 150px 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-xxhdpi/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 576px 4 | 672px 5 | 200px 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/EmulatorResourceSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | /** 4 | * Created by krzysiek on 08/09/15. 5 | */ 6 | public interface EmulatorResourceSource { 7 | byte[] getData(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/NotificationHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications; 2 | 3 | /** 4 | * Created by krzysiek on 19/07/15. 5 | */ 6 | public interface NotificationHandler { 7 | void handleFunction(int functionId); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/ble/ReadCharacteristicHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service.ble; 2 | 3 | /** 4 | * Created by krzysiek on 10/10/15. 5 | */ 6 | public interface ReadCharacteristicHandler { 7 | void handleValue(byte[] data); 8 | } 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/EmulatorDataConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public interface EmulatorDataConverter { 7 | Object convert(Object value); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/NotificationMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | /** 4 | * Created by krzysiek on 19/07/15. 5 | */ 6 | public interface NotificationMessageBuilder { 7 | 8 | byte[] build(); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/MessageParser.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | //import android.app.Notification; 4 | // 5 | //public interface MessageParser { 6 | // public Message parse(Notification notification); 7 | //} 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_default.xml: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pref_switch.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/ble/BleConnectionStatusHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service.ble; 2 | 3 | /** 4 | * Created by krzysiek on 10/10/15. 5 | */ 6 | public interface BleConnectionStatusHandler { 7 | void handleConnectionStatusChange(BleConnectionStatus status); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/NotificationType.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | ///** 4 | // * Created by krzysiek on 22/07/15. 5 | // */ 6 | //public enum NotificationType { 7 | // SMS, EMAIL, INSTANT_MESSAGE, MISSED_CALL, OTHER 8 | //} 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/MessageInfo.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | ///** 4 | // * Created by krzysiek on 22/07/15. 5 | // */ 6 | //public class MessageInfo { 7 | // 8 | // public String subject; 9 | // public String info; 10 | //} 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/UtilitiesFragment.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 08/11/15. 5 | */ 6 | public class UtilitiesFragment extends WatchSetsFragment { 7 | 8 | public UtilitiesFragment() { 9 | super(WatchSetType.UTILITY); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/WatchFacesFragment.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 08/11/15. 5 | */ 6 | public class WatchFacesFragment extends WatchSetsFragment { 7 | 8 | public WatchFacesFragment () { 9 | super(WatchSetType.WATCH_FACE); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pref_image_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/ApplicationsFragment.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 08/11/15. 5 | */ 6 | public class ApplicationsFragment extends WatchSetsFragment { 7 | 8 | public ApplicationsFragment() { 9 | super(WatchSetType.APPLICATION); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/MockConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class MockConverter implements EmulatorDataConverter { 7 | @Override 8 | public Object convert(Object value) { 9 | return value; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/EmulatorAction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | 5 | /** 6 | * Created by krzysiek on 18/06/15. 7 | */ 8 | public interface EmulatorAction { 9 | 10 | void performAction(EmulatorExecutionContext ctx); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/event/ButtonPressedEmulatorEvent.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.event; 2 | 3 | /** 4 | * Created by krzysiek on 14/06/15. 5 | */ 6 | public class ButtonPressedEmulatorEvent extends AbstractButtonEmulatorEvent { 7 | public ButtonPressedEmulatorEvent(EmulatorButton button) { 8 | super(button); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/event/ButtonLongPressedEmulatorEvent.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.event; 2 | 3 | /** 4 | * Created by krzysiek on 14/06/15. 5 | */ 6 | public class ButtonLongPressedEmulatorEvent extends AbstractButtonEmulatorEvent { 7 | public ButtonLongPressedEmulatorEvent(EmulatorButton button) { 8 | super(button); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/renderer/ScreenRender.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.renderer; 2 | 3 | import com.althink.android.ossw.emulator.event.EmulatorEvent; 4 | 5 | /** 6 | * Created by krzysiek on 14/06/15. 7 | */ 8 | public interface ScreenRender { 9 | void render(LowLevelRenderer renderer); 10 | 11 | void handleEvent(EmulatorEvent event); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 22/06/15. 5 | */ 6 | public enum DataSourceType { 7 | NUMBER(1), STRING(2); 8 | 9 | private int key; 10 | 11 | private DataSourceType(int key) { 12 | this.key = key; 13 | } 14 | 15 | public int getKey() { 16 | return key; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/NotificationIdBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.parser; 2 | 3 | import android.service.notification.StatusBarNotification; 4 | 5 | /** 6 | * Created by krzysiek on 25/07/15. 7 | */ 8 | public class NotificationIdBuilder { 9 | public String build(StatusBarNotification sbn) { 10 | return sbn.getPackageName() + ":" + sbn.getId(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/KnownParseError.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 29/06/15. 5 | */ 6 | public class KnownParseError extends RuntimeException { 7 | 8 | public KnownParseError(String message) { 9 | super(message); 10 | } 11 | 12 | public KnownParseError(String message, Exception e) { 13 | super(message, e); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/ble/CharacteristicChangeHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service.ble; 2 | 3 | import android.bluetooth.BluetoothGatt; 4 | import android.bluetooth.BluetoothGattCharacteristic; 5 | 6 | /** 7 | * Created by krzysiek on 10/10/15. 8 | */ 9 | public interface CharacteristicChangeHandler { 10 | void handleCharacteristicChange(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/althink/android/ossw/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/EmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | 6 | /** 7 | * Created by krzysiek on 14/06/15. 8 | */ 9 | public interface EmulatorControl { 10 | 11 | void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/NotificationType.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | /** 4 | * Created by krzysiek on 24/07/15. 5 | */ 6 | public enum NotificationType { 7 | ALERT(1), INFO(2), UPDATE(3); 8 | 9 | private int value; 10 | 11 | NotificationType(int value) { 12 | this.value = value; 13 | } 14 | 15 | public int getValue() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/EmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.watchsets.DataSourceType; 5 | 6 | /** 7 | * Created by krzysiek on 14/06/15. 8 | */ 9 | public interface EmulatorDataSource { 10 | 11 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/utils/StringNormalizer.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.utils; 2 | 3 | import net.sf.junidecode.Junidecode; 4 | 5 | /** 6 | * Created by krzysiek on 19/07/15. 7 | */ 8 | public class StringNormalizer { 9 | 10 | public static String removeAccents(String text) { 11 | if (text == null) { 12 | return null; 13 | } 14 | String result = Junidecode.unidecode(text); 15 | return result; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/OnesConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 01/12/15. 5 | */ 6 | public class OnesConverter implements EmulatorDataConverter { 7 | @Override 8 | public Object convert(Object value) { 9 | if (!(value instanceof Integer)) { 10 | return 0; 11 | } 12 | int v = (Integer) value; 13 | return v%10; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TensConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 01/12/15. 5 | */ 6 | public class TensConverter implements EmulatorDataConverter { 7 | @Override 8 | public Object convert(Object value) { 9 | if (!(value instanceof Integer)) { 10 | return 0; 11 | } 12 | int v = (Integer) value; 13 | return (v/10)%10; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/HundredsConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 01/12/15. 5 | */ 6 | public class HundredsConverter implements EmulatorDataConverter { 7 | @Override 8 | public Object convert(Object value) { 9 | if (!(value instanceof Integer)) { 10 | return 0; 11 | } 12 | int v = (Integer) value; 13 | return (v/100)%10; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/NotificationCategory.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | /** 4 | * Created by krzysiek on 24/07/15. 5 | */ 6 | public enum NotificationCategory { 7 | INCOMING_CALL(1), MESSAGE(2), EMAIL(3), SOCIAL(4), ALARM(5), OTHER(255); 8 | 9 | private int value; 10 | 11 | NotificationCategory(int value) { 12 | this.value = value; 13 | } 14 | 15 | public int getValue() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/digits/DigitsRenderer.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control.digits; 2 | 3 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 4 | 5 | /** 6 | * Created by krzysiek on 11/09/15. 7 | */ 8 | public interface DigitsRenderer { 9 | 10 | int renderDigit(LowLevelRenderer renderer, int digit, int x, int y, boolean fullWidth, boolean drawZero); 11 | 12 | int renderDecimalSeparator(LowLevelRenderer renderer, int x, int y); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TimeToHour24Converter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class TimeToHour24Converter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | return v / 3600; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TimeToSecondsConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class TimeToSecondsConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | return v % 60; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TimeToMinutesConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class TimeToMinutesConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | return (v % 3600) / 60; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/Hour24ToHour12Converter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class Hour24ToHour12Converter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = ((Integer) value) % 12; 14 | return v == 0 ? 12 : v; 15 | } 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/DataSourceResolutionContext.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | /** 4 | * Created by krzysiek on 17/11/15. 5 | */ 6 | public class DataSourceResolutionContext { 7 | public DataSourceType dataSourceType; 8 | public int dataRange; 9 | public ValueResolver resolver; 10 | public ScreenContext screenContext; 11 | 12 | public DataSourceResolutionContext(ScreenContext screenContext) { 13 | this.screenContext = screenContext; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/Hour24ToHour12PeriodConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class Hour24ToHour12PeriodConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = ((Integer) value); 14 | return v / 12; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/field/FieldDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets.field; 2 | 3 | import com.althink.android.ossw.watchsets.ValueResolver; 4 | 5 | /** 6 | * Created by krzysiek on 21/11/15. 7 | */ 8 | public abstract class FieldDefinition implements ValueResolver { 9 | 10 | protected int fieldId; 11 | 12 | public FieldDefinition(int fieldId) { 13 | this.fieldId = fieldId; 14 | } 15 | 16 | public int getFieldId() { 17 | return fieldId; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TimeToRoundedHour24Converter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class TimeToRoundedHour24Converter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | return ((v / 60) + 29) / 60; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/fonts/CharInfo.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.fonts; 2 | 3 | /** 4 | * Created by krzysiek on 05/07/15. 5 | */ 6 | public class CharInfo { 7 | 8 | private int width; 9 | private int offset; 10 | 11 | public CharInfo(int width, int offset) { 12 | this.width = width; 13 | this.offset = offset; 14 | } 15 | 16 | public int getWidth() { 17 | return width; 18 | } 19 | 20 | public int getOffset() { 21 | return offset; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 9 | 280dp 10 | 4dp 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/EnumToIntResolver.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Created by krzysiek on 21/11/15. 7 | */ 8 | public class EnumToIntResolver implements ValueResolver { 9 | 10 | private Map valuesMap; 11 | 12 | public EnumToIntResolver(Map valuesMap) { 13 | this.valuesMap = valuesMap; 14 | } 15 | 16 | @Override 17 | public Object resolve(Object value) { 18 | return valuesMap.get(value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/model/EmulatorModelProperty.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.model; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | 5 | /** 6 | * Created by krzysiek on 22/11/15. 7 | */ 8 | public interface EmulatorModelProperty { 9 | 10 | void initialize(); 11 | 12 | void add(Object value); 13 | 14 | void subtract(Object value); 15 | 16 | void increment(); 17 | 18 | void decrement(); 19 | 20 | Object getValue(); 21 | 22 | void setValue(Object value); 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/TimeToFiveMinutesRoundedTimeConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class TimeToFiveMinutesRoundedTimeConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | return (((v + 150) / 300) % 288) * 300; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/MinutesToPastToMinutesConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class MinutesToPastToMinutesConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | if (v > 30) { 15 | return 60 - v; 16 | } 17 | return v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/SimpleListItem.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | /** 4 | * Created by krzysiek on 25/07/15. 5 | */ 6 | public class SimpleListItem { 7 | private String text; 8 | 9 | public SimpleListItem(String text) { 10 | this.text = text; 11 | } 12 | 13 | public String getText() { 14 | return text; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "SimpleListItem{" + 20 | "text='" + text + '\'' + 21 | '}'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/EmulatorEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | /** 4 | * Created by krzysiek on 22/11/15. 5 | */ 6 | public class EmulatorEventHandler { 7 | private int eventId; 8 | private EmulatorAction action; 9 | 10 | public EmulatorEventHandler(int eventId, EmulatorAction action) { 11 | this.action = action; 12 | this.eventId = eventId; 13 | } 14 | 15 | public EmulatorAction getAction() { 16 | return action; 17 | } 18 | 19 | public int getEventId() { 20 | return eventId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/ZeroDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 06/07/15. 9 | */ 10 | public class ZeroDataSource implements EmulatorDataSource { 11 | @Override 12 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 13 | return 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/Notification.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by krzysiek on 24/07/15. 8 | */ 9 | public interface Notification extends Comparable { 10 | String getId(); 11 | NotificationType getType(); 12 | NotificationCategory getCategory(); 13 | String getApplication(); 14 | Date getDate(); 15 | List getOperations(); 16 | Integer getExternalId(); 17 | void setExternalId(Integer externalId); 18 | Object getNotificationObject(); 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/converter/MinutesToPastToDesignatorConverter.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.converter; 2 | 3 | /** 4 | * Created by krzysiek on 29/11/15. 5 | */ 6 | public class MinutesToPastToDesignatorConverter implements EmulatorDataConverter { 7 | 8 | @Override 9 | public Object convert(Object value) { 10 | if (!(value instanceof Integer)) { 11 | return 0; 12 | } 13 | int v = (Integer) value; 14 | if (v > 30) { 15 | return 2; 16 | } else if (v == 0) { 17 | return 0; 18 | } else { 19 | return 1; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/MacAddressInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 05/12/15. 9 | */ 10 | public class MacAddressInternalEmulatorDataSource implements EmulatorDataSource { 11 | 12 | @Override 13 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 14 | return "XX:XX:XX:XX:XX:XX"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/db/WatchSetInfo.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.db; 2 | 3 | /** 4 | * Created by krzysiek on 04/07/15. 5 | */ 6 | public class WatchSetInfo { 7 | private Integer id; 8 | private String name; 9 | 10 | public WatchSetInfo(Integer id, String name) { 11 | this.id = id; 12 | this.name = name; 13 | } 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/FirmwareVersionInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 05/12/15. 9 | */ 10 | public class FirmwareVersionInternalEmulatorDataSource implements EmulatorDataSource { 11 | 12 | @Override 13 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 14 | return "x.x.x-s1x0"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/field/IntegerFieldDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets.field; 2 | 3 | /** 4 | * Created by krzysiek on 21/11/15. 5 | */ 6 | public class IntegerFieldDefinition extends FieldDefinition { 7 | 8 | public IntegerFieldDefinition(int fieldId) { 9 | super(fieldId); 10 | } 11 | 12 | @Override 13 | public Object resolve(Object value) { 14 | if (value instanceof String) { 15 | return Integer.parseInt((String) value); 16 | } else if (value instanceof Integer) { 17 | return (Integer) value; 18 | } else { 19 | return null; 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/DefaultTicker.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | //import android.app.Notification; 4 | // 5 | //public class DefaultTicker implements MessageParser { 6 | // @Override 7 | // public Message parse(Notification notification) { 8 | // Message result = new Message(); 9 | // 10 | // String ticker = notification.tickerText.toString(); 11 | // 12 | // int indexDelimiter = ticker.indexOf(':'); 13 | // 14 | // if (indexDelimiter == -1) 15 | // return null; 16 | // 17 | // result.subject = ticker.substring(0, indexDelimiter); 18 | // result.message = ticker.substring(indexDelimiter + 2); 19 | // 20 | // return result; 21 | // } 22 | //} 23 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/krzysiek/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/plugins/PluginFunctionDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.plugins; 2 | 3 | /** 4 | * Created by krzysiek on 16/06/15. 5 | */ 6 | public class PluginFunctionDefinition { 7 | private int id; 8 | private String name; 9 | private String description; 10 | 11 | public PluginFunctionDefinition(int id, String name, String description) { 12 | this.id = id; 13 | this.name = name; 14 | this.description = description; 15 | } 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public String getName() { 22 | return name; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/EmulatorCompoundAction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by krzysiek on 22/11/15. 9 | */ 10 | public class EmulatorCompoundAction implements EmulatorAction { 11 | 12 | private List actions; 13 | 14 | public EmulatorCompoundAction(List actions) { 15 | this.actions = actions; 16 | } 17 | 18 | @Override 19 | public void performAction(EmulatorExecutionContext ctx) { 20 | for (EmulatorAction action : actions) { 21 | action.performAction(ctx); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/fonts/CharInfoLookup.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.fonts; 2 | 3 | /** 4 | * Created by krzysiek on 05/07/15. 5 | */ 6 | public class CharInfoLookup { 7 | private char minChar; 8 | private char maxChar; 9 | private CharInfo[] charTable; 10 | 11 | public CharInfoLookup(char minChar, char maxChar, CharInfo[] charTable) { 12 | this.minChar = minChar; 13 | this.maxChar = maxChar; 14 | this.charTable = charTable; 15 | } 16 | 17 | public char getMinChar() { 18 | return minChar; 19 | } 20 | 21 | public char getMaxChar() { 22 | return maxChar; 23 | } 24 | 25 | public CharInfo[] getCharTable() { 26 | return charTable; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | #15CAB1 3 | #424242 4 | #FF6D00 5 | #00695C 6 | #FFF 7 | #FFF 8 | #212121 9 | #000 10 | #15CAB1 11 | #777 12 | 13 | #a0f5e9 14 | #d5fbf5 15 | #d5fbf5 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/BatteryLevelInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class BatteryLevelInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return 100; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/ble/BleConnectionStatus.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service.ble; 2 | 3 | import com.althink.android.ossw.R; 4 | import com.althink.android.ossw.service.OsswService; 5 | 6 | /** 7 | * Created by krzysiek on 10/10/15. 8 | * vaspa: Add resource id for internationalization 9 | */ 10 | public enum BleConnectionStatus { 11 | DISCONNECTED(R.string.disconnected), 12 | CONNECTING(R.string.connecting), 13 | CONNECTED(R.string.connected), 14 | AUTO_RECONNECT(R.string.auto_reconnect); 15 | private int stringId; 16 | 17 | BleConnectionStatus(int sId) { 18 | stringId = sId; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return OsswService.getInstance().getApplicationContext().getString(stringId); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/field/EnumFieldDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets.field; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Created by krzysiek on 21/11/15. 7 | */ 8 | public class EnumFieldDefinition extends FieldDefinition { 9 | 10 | private Map values; 11 | 12 | public EnumFieldDefinition(int fieldId, Map values) { 13 | super(fieldId); 14 | this.values = values; 15 | } 16 | 17 | public Integer getValueKey(String value) { 18 | return values.get(value); 19 | } 20 | 21 | @Override 22 | public Object resolve(Object value) { 23 | if (value instanceof String) { 24 | return values.get(value); 25 | } else { 26 | return null; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/EmulatorAttachedResourceSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.watchset.WatchSetEmulatorModel; 4 | import com.althink.android.ossw.watchsets.CompiledWatchSet; 5 | 6 | /** 7 | * Created by krzysiek on 08/09/15. 8 | */ 9 | public class EmulatorAttachedResourceSource implements EmulatorResourceSource { 10 | 11 | private WatchSetEmulatorModel watchSet; 12 | private int resourceId; 13 | 14 | public EmulatorAttachedResourceSource(WatchSetEmulatorModel watchSet, int resourceId) { 15 | this.watchSet = watchSet; 16 | this.resourceId = resourceId; 17 | } 18 | 19 | @Override 20 | public byte[] getData() { 21 | return watchSet.getResources().get(resourceId); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/YearInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class YearInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.YEAR); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/AbstractEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 14/06/15. 9 | */ 10 | public abstract class AbstractEmulatorControl implements EmulatorControl { 11 | 12 | private EmulatorDataSource dataSource; 13 | 14 | protected AbstractEmulatorControl(EmulatorDataSource dataSource) { 15 | this.dataSource = dataSource; 16 | } 17 | 18 | protected Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 19 | return dataSource.getData(type, range, ctx); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/MonthInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class MonthInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.MONTH) + 1; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/Operation.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | import android.app.PendingIntent; 4 | 5 | /** 6 | * Created by krzysiek on 24/07/15. 7 | */ 8 | public class Operation { 9 | String title; 10 | PendingIntent intent; 11 | 12 | public Operation(String title, PendingIntent intent) { 13 | this.title = title; 14 | this.intent = intent; 15 | } 16 | 17 | public String getTitle() { 18 | return title; 19 | } 20 | 21 | public PendingIntent getIntent() { 22 | return intent; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return "Operation{" + 28 | "title='" + title + '\'' + 29 | ", intent=" + intent + 30 | '}'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/Hour24InternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class Hour24InternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.HOUR_OF_DAY); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/MinutesInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class MinutesInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.MINUTE); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/SecondsInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class SecondsInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.SECOND); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/DayOfWeekInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class DayOfWeekInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.DAY_OF_WEEK); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/DayOfYearInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class DayOfYearInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.DAY_OF_YEAR); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/DayOfMonthInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class DayOfMonthInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.DAY_OF_MONTH); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/SubjectMessageItem.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | /** 4 | * Created by krzysiek on 25/07/15. 5 | */ 6 | public class SubjectMessageItem { 7 | private String subject; 8 | private String message; 9 | 10 | public SubjectMessageItem(String subject, String message) { 11 | this.subject = subject; 12 | this.message = message; 13 | } 14 | 15 | public String getSubject() { 16 | return subject; 17 | } 18 | 19 | public String getMessage() { 20 | return message; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "SubjectMessageItem{" + 26 | "subject='" + subject + '\'' + 27 | ", message='" + message + '\'' + 28 | '}'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/Hour12DesignatorInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class Hour12DesignatorInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if (!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return (int) Calendar.getInstance().get(Calendar.HOUR_OF_DAY) /12; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/Hour12InternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class Hour12InternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if(!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | int h = Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 12; 20 | return h == 0 ? 12 : h; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | android: 3 | components: 4 | # Uncomment the lines below if you want to 5 | # use the latest revision of Android SDK Tools 6 | - platform-tools 7 | - tools 8 | 9 | # The BuildTools version used by your project 10 | - build-tools-23.0.2 11 | 12 | # The SDK version used to compile your project 13 | - android-23 14 | 15 | # Additional components 16 | #- extra-google-google_play_services 17 | - extra-google-m2repository 18 | - extra-android-m2repository 19 | #- addon-google_apis-google-19 20 | 21 | # Specify at least one system image, 22 | # if you need to run emulator(s) during your tests 23 | #- sys-img-armeabi-v7a-android-19 24 | #- sys-img-x86-android-17 25 | script: 26 | - ./gradlew assemble lint 27 | after_failure: 28 | - cat /home/travis/build/ossw/ossw-android/app/build/outputs/lint-results.xml 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/renderer/EmulatorExecutionContext.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.renderer; 2 | 3 | import com.althink.android.ossw.emulator.WatchEmulator; 4 | import com.althink.android.ossw.emulator.watchset.WatchSetEmulatorModel; 5 | 6 | /** 7 | * Created by krzysiek on 22/11/15. 8 | */ 9 | public class EmulatorExecutionContext extends WatchEmulator { 10 | 11 | private WatchSetEmulatorModel watchset; 12 | private WatchEmulator emulator; 13 | 14 | public EmulatorExecutionContext(WatchSetEmulatorModel watchset, WatchEmulator emulator) { 15 | super(); 16 | this.watchset = watchset; 17 | this.emulator = emulator; 18 | } 19 | 20 | public WatchEmulator getEmulator() { 21 | return emulator; 22 | } 23 | 24 | public WatchSetEmulatorModel getWatchset() { 25 | return watchset; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/WatchOperationContext.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by krzysiek on 14/06/15. 7 | */ 8 | public class WatchOperationContext { 9 | 10 | private List externalParameters; 11 | private List externalFunctions; 12 | 13 | public WatchOperationContext(List externalParameters, List externalFunctions) { 14 | this.externalParameters = externalParameters; 15 | this.externalFunctions = externalFunctions; 16 | } 17 | 18 | public List getExternalParameters() { 19 | return externalParameters; 20 | } 21 | 22 | public List getExternalFunctions() { 23 | return externalFunctions; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default uriValue: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_plugins.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 15 | 16 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-sw600dp/template-dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | @dimen/margin_huge 22 | @dimen/margin_medium 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/NotificationSummaryMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | import com.althink.android.ossw.notifications.model.ListNotification; 4 | import com.althink.android.ossw.notifications.model.Notification; 5 | 6 | import java.io.ByteArrayOutputStream; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by krzysiek on 19/07/15. 11 | */ 12 | public class NotificationSummaryMessageBuilder implements NotificationMessageBuilder { 13 | 14 | private ByteArrayOutputStream out; 15 | 16 | public NotificationSummaryMessageBuilder(int messagesNo) { 17 | out = new ByteArrayOutputStream(); 18 | 19 | if (messagesNo > 255) { 20 | messagesNo = 255; 21 | } 22 | out.write(0); 23 | out.write(messagesNo); 24 | } 25 | 26 | @Override 27 | public byte[] build() { 28 | return out.toByteArray(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/event/AbstractButtonEmulatorEvent.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.event; 2 | 3 | /** 4 | * Created by krzysiek on 14/06/15. 5 | */ 6 | public class AbstractButtonEmulatorEvent implements EmulatorEvent { 7 | private EmulatorButton button; 8 | 9 | public AbstractButtonEmulatorEvent(EmulatorButton button) { 10 | this.button = button; 11 | } 12 | 13 | public EmulatorButton getButton() { 14 | return button; 15 | } 16 | 17 | @Override 18 | public boolean equals(Object o) { 19 | if (this == o) return true; 20 | if (o == null || getClass() != o.getClass()) return false; 21 | AbstractButtonEmulatorEvent that = (AbstractButtonEmulatorEvent) o; 22 | if (button != that.button) return false; 23 | return true; 24 | } 25 | 26 | @Override 27 | public int hashCode() { 28 | return button != null ? button.hashCode() : 0; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/EmulatorModelDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.model.EmulatorModelProperty; 4 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 22/11/15. 9 | */ 10 | public class EmulatorModelDataSource implements EmulatorDataSource { 11 | 12 | private int propertyId; 13 | 14 | public EmulatorModelDataSource(int propertyId) { 15 | this.propertyId = propertyId; 16 | } 17 | 18 | @Override 19 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 20 | EmulatorModelProperty property = ctx.getWatchset().getCurrentScreenModel().get(propertyId); 21 | if (property != null) { 22 | return property.getValue(); 23 | } 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/base-template-styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_watchsets.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 16 | 17 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/internal/TimeInSecondsInternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source.internal; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.Calendar; 8 | 9 | /** 10 | * Created by krzysiek on 29/11/15. 11 | */ 12 | public class TimeInSecondsInternalEmulatorDataSource implements EmulatorDataSource { 13 | 14 | @Override 15 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 16 | if (!DataSourceType.NUMBER.equals(type)) { 17 | return null; 18 | } 19 | return Calendar.getInstance().get(Calendar.HOUR_OF_DAY) * 3600 + 20 | Calendar.getInstance().get(Calendar.MINUTE) * 60 + 21 | Calendar.getInstance().get(Calendar.SECOND); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/EmulatorConvertedDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.converter.EmulatorDataConverter; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 29/11/15. 9 | */ 10 | public class EmulatorConvertedDataSource implements EmulatorDataSource { 11 | 12 | private EmulatorDataConverter converter; 13 | private EmulatorDataSource dataSource; 14 | 15 | public EmulatorConvertedDataSource(EmulatorDataConverter converter, EmulatorDataSource dataSource) { 16 | this.converter = converter; 17 | this.dataSource = dataSource; 18 | } 19 | 20 | @Override 21 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 22 | return converter.convert(dataSource.getData(type, range, ctx)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/StaticDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | /** 8 | * Created by krzysiek on 17/11/15. 9 | */ 10 | public class StaticDataSource implements EmulatorDataSource { 11 | private byte[] data; 12 | 13 | public StaticDataSource(byte[] data) { 14 | this.data = data; 15 | } 16 | 17 | @Override 18 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 19 | if (type == DataSourceType.STRING) { 20 | return new String(data); 21 | } else if (type == DataSourceType.NUMBER) { 22 | return new Integer((data[0]&0xFF) << 24 | (data[1]&0xFF) << 16 | (data[2]&0xFF) << 8 | (data[3]&0xFF)); 23 | } 24 | return null; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/ScreenContext.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | import com.althink.android.ossw.watchsets.field.FieldDefinition; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by krzysiek on 21/11/15. 10 | */ 11 | public class ScreenContext { 12 | private Map model = new HashMap<>(); 13 | private MemoryAllocator allocator = new MemoryAllocator(); 14 | 15 | public Map getModel() { 16 | return model; 17 | } 18 | 19 | public MemoryAllocator getAllocator() { 20 | return allocator; 21 | } 22 | 23 | public static class MemoryAllocator { 24 | 25 | int size = 0; 26 | 27 | public int addBuffer(int size) { 28 | int ptr = this.size; 29 | this.size += size; 30 | return ptr; 31 | } 32 | 33 | public int getSize() { 34 | return size; 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/ExternalServiceConnection.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service; 2 | 3 | import android.content.ComponentName; 4 | import android.content.ServiceConnection; 5 | import android.os.IBinder; 6 | import android.os.Messenger; 7 | 8 | /** 9 | * Created by krzysiek on 14/06/15. 10 | */ 11 | public class ExternalServiceConnection { 12 | 13 | private Messenger messanger; 14 | private final ServiceConnection connection = new ServiceConnection() { 15 | 16 | @Override 17 | public void onServiceConnected(ComponentName componentName, IBinder service) { 18 | messanger = new Messenger(service); 19 | } 20 | 21 | @Override 22 | public void onServiceDisconnected(ComponentName componentName) { 23 | messanger = null; 24 | } 25 | }; 26 | 27 | public Messenger getMessanger() { 28 | return messanger; 29 | } 30 | 31 | public ServiceConnection getConnection() { 32 | return connection; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_watches.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | 11 | 18 | 19 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ossw-android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_watch_set_preview.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/CompiledWatchSet.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | import com.althink.android.ossw.service.WatchOperationContext; 4 | 5 | /** 6 | * Created by krzysiek on 13/06/15. 7 | */ 8 | public class CompiledWatchSet { 9 | 10 | private int id; 11 | private String name; 12 | private byte[] watchData; 13 | private WatchOperationContext watchContext; 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | 23 | public byte[] getWatchData() { 24 | return watchData; 25 | } 26 | 27 | public void setWatchData(byte[] watchData) { 28 | this.watchData = watchData; 29 | } 30 | 31 | public int getId() { 32 | return id; 33 | } 34 | 35 | public void setId(int id) { 36 | this.id = id; 37 | } 38 | 39 | public WatchOperationContext getWatchContext() { 40 | return watchContext; 41 | } 42 | 43 | public void setWatchContext(WatchOperationContext watchContext) { 44 | this.watchContext = watchContext; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_settings.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 18 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/ImageEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 6 | import com.althink.android.ossw.emulator.source.EmulatorResourceSource; 7 | import com.althink.android.ossw.watchsets.DataSourceType; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class ImageEmulatorControl extends AbstractEmulatorControl { 13 | private int x; 14 | private int y; 15 | private int width; 16 | private int height; 17 | private EmulatorResourceSource image; 18 | 19 | public ImageEmulatorControl(int x, int y, int width, int height, EmulatorResourceSource image) { 20 | super(null); 21 | this.x = x; 22 | this.y = y; 23 | this.width = width; 24 | this.height = height; 25 | this.image = image; 26 | } 27 | 28 | public void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx) { 29 | renderer.drawImage(image.getData(), x, y, width, height); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/EmulatorChooseAction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.watchsets.DataSourceType; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * Created by krzysiek on 22/11/15. 12 | */ 13 | public class EmulatorChooseAction implements EmulatorAction { 14 | 15 | private EmulatorDataSource dataSource; 16 | private Map> map; 17 | 18 | public EmulatorChooseAction(EmulatorDataSource dataSource, Map> map) { 19 | this.map = map; 20 | this.dataSource = dataSource; 21 | } 22 | 23 | @Override 24 | public void performAction(EmulatorExecutionContext ctx) { 25 | Object value = dataSource.getData(DataSourceType.NUMBER, 0x40, ctx); 26 | List actions = map.get(value); 27 | if (actions != null) { 28 | for (EmulatorAction action : actions) { 29 | action.performAction(ctx); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/menu/scan.xml: -------------------------------------------------------------------------------- 1 | 15 | 17 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/template-dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 4dp 22 | 8dp 23 | 16dp 24 | 32dp 25 | 64dp 26 | 27 | 28 | 29 | @dimen/margin_medium 30 | @dimen/margin_medium 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 25 | 26 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_watchset.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/digits/NumbersFontRenderer.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control.digits; 2 | 3 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 4 | import com.althink.android.ossw.emulator.source.EmulatorResourceSource; 5 | 6 | import java.util.Arrays; 7 | 8 | /** 9 | * Created by krzysiek on 11/09/15. 10 | */ 11 | public class NumbersFontRenderer implements DigitsRenderer { 12 | 13 | private EmulatorResourceSource resource; 14 | 15 | public NumbersFontRenderer(EmulatorResourceSource resource) { 16 | this.resource = resource; 17 | } 18 | 19 | @Override 20 | public int renderDigit(LowLevelRenderer renderer, int digit, int x, int y, boolean fullWidth, boolean drawZero) { 21 | int digitWidth = resource.getData()[2]; 22 | int digitHeight = resource.getData()[3]; 23 | if (digit != 0 || drawZero) { 24 | int idx = 4 + (((digitWidth + 7) / 8) * digitHeight * digit); 25 | renderer.drawBitmap(resource.getData(), idx, x, y, digitWidth, digitHeight, digitWidth); 26 | } 27 | return digitWidth; 28 | } 29 | 30 | @Override 31 | public int renderDecimalSeparator(LowLevelRenderer renderer, int x, int y) { 32 | return 0; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.althink.android.ossw" 9 | minSdkVersion 18 10 | targetSdkVersion 23 11 | versionCode 15 12 | versionName "0.5.0-snapshot" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | lintOptions { 21 | checkReleaseBuilds false 22 | abortOnError false 23 | } 24 | } 25 | 26 | ext { 27 | supportLibVersion = '23.1.1' 28 | } 29 | 30 | dependencies { 31 | compile fileTree(dir: 'libs', include: ['*.jar']) 32 | compile 'com.google.code.gson:gson:2.4' 33 | compile "com.android.support:appcompat-v7:${supportLibVersion}" 34 | compile "com.android.support:design:${supportLibVersion}" 35 | compile "com.android.support:recyclerview-v7:${supportLibVersion}" 36 | compile "com.android.support:support-v4:${supportLibVersion}" 37 | compile "com.android.support:preference-v14:${supportLibVersion}" 38 | compile 'com.moparisthebest:junidecode:0.1.1' 39 | //compile 'com.ibm.icu:icu4j:55.1' 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/Message.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | //import java.util.LinkedList; 4 | //import java.util.List; 5 | // 6 | //public class Message { 7 | // public interface MessageListener { 8 | // public void onMessage(Message message); 9 | // } 10 | // 11 | // public NotificationType type = null; 12 | // public String app = null; 13 | // public String time = null; 14 | // public String subject = null; 15 | // public String message = null; 16 | // public boolean aggregated = false; 17 | // public int count; 18 | // public List messages = new LinkedList<>(); 19 | // 20 | // @Override 21 | // public String toString() { 22 | // if (aggregated) { 23 | // StringBuilder sb = new StringBuilder(); 24 | // sb.append(type).append(", ").append(time).append(", count: ").append(count).append(":\n"); 25 | // for (MessageInfo message : messages) { 26 | // sb.append(message.subject).append(" -- ").append(message.info).append("\n"); 27 | // } 28 | // return sb.toString(); 29 | // } else { 30 | // return type + ", "+time+", sent from " + this.subject + ": " + this.message; 31 | // } 32 | // } 33 | //} 34 | -------------------------------------------------------------------------------- /app/src/main/res/menu/import_watchset.xml: -------------------------------------------------------------------------------- 1 | 15 | 17 | 23 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/values/base-strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | OSSW 19 | 20 | 27 | 28 | 110010 29 | 500 30 | 2 31 | 1010000000 32 | 1000 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/digits/GeneratedDigits.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control.digits; 2 | 3 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 4 | 5 | /** 6 | * Created by krzysiek on 11/09/15. 7 | */ 8 | public class GeneratedDigits implements DigitsRenderer { 9 | 10 | private int digitWidth; 11 | private int digitHeight; 12 | private int thickness; 13 | 14 | public GeneratedDigits(int digitWidth, int digitHeight, int thickness) { 15 | this.digitWidth = digitWidth; 16 | this.digitHeight = digitHeight; 17 | this.thickness = thickness; 18 | } 19 | 20 | @Override 21 | public int renderDigit(LowLevelRenderer renderer, int digit, int x, int y, boolean fullWidth, boolean drawZero) { 22 | if (!fullWidth && digit == 1) { 23 | renderer.drawRect(x, y, thickness, digitHeight); 24 | return thickness; 25 | } else { 26 | if (drawZero || digit != 0) { 27 | renderer.drawDigit(digit, x, y, digitWidth, digitHeight, thickness); 28 | } 29 | return digitWidth; 30 | } 31 | } 32 | 33 | @Override 34 | public int renderDecimalSeparator(LowLevelRenderer renderer, int x, int y) { 35 | renderer.drawRect(x, y + digitHeight - thickness, thickness, thickness); 36 | return thickness; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/fonts/FontInfo.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.fonts; 2 | 3 | /** 4 | * Created by krzysiek on 05/07/15. 5 | */ 6 | public class FontInfo { 7 | int height; 8 | char minChar; 9 | char maxChar; 10 | int charSpace; 11 | int spaceSize; 12 | CharInfoLookup[] charInfoLookup; 13 | byte[] fontBitmaps; 14 | 15 | public FontInfo(int height, char minChar, char maxChar, int charSpace, int spaceSize, CharInfoLookup[] charInfoLookup, byte[] fontBitmaps) { 16 | this.height = height; 17 | this.minChar = minChar; 18 | this.maxChar = maxChar; 19 | this.charSpace = charSpace; 20 | this.spaceSize = spaceSize; 21 | this.charInfoLookup = charInfoLookup; 22 | this.fontBitmaps = fontBitmaps; 23 | } 24 | 25 | public int getHeight() { 26 | return height; 27 | } 28 | 29 | public char getMinChar() { 30 | return minChar; 31 | } 32 | 33 | public char getMaxChar() { 34 | return maxChar; 35 | } 36 | 37 | public int getCharSpace() { 38 | return charSpace; 39 | } 40 | 41 | public int getSpaceSize() { 42 | return spaceSize; 43 | } 44 | 45 | public CharInfoLookup[] getCharInfoLookup() { 46 | return charInfoLookup; 47 | } 48 | 49 | public byte[] getFontBitmaps() { 50 | return fontBitmaps; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/TextEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.fonts.FontInfo; 4 | import com.althink.android.ossw.emulator.fonts.OptionsBig; 5 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 6 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 7 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 8 | import com.althink.android.ossw.watchsets.DataSourceType; 9 | 10 | /** 11 | * Created by krzysiek on 14/06/15. 12 | */ 13 | public class TextEmulatorControl extends AbstractEmulatorControl { 14 | private int x; 15 | private int y; 16 | private int width; 17 | private int height; 18 | private int style; 19 | 20 | public TextEmulatorControl(int x, int y, int width, int height, int style, EmulatorDataSource dataSource) { 21 | super(dataSource); 22 | this.x = x; 23 | this.y = y; 24 | this.width = width; 25 | this.height = height; 26 | this.style = style; 27 | } 28 | 29 | public void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx) { 30 | String value = (String) getData(DataSourceType.STRING, 0, ctx); 31 | int fontType = (style >> 24) & 0xFF; 32 | int alignment = (style >> 16) & 0xFF; 33 | renderer.drawText(value, x, y, width, height, fontType, alignment); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listitem_device.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 13 | 19 | 25 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Small regular 5 | Small bold 6 | Medium regular 7 | Medium bold 8 | Big regular 9 | Menu normal 10 | Menu big 11 | 12 | 13 | smallRegular 14 | smallBold 15 | normalRegular 16 | normalBold 17 | bigRegular 18 | optionNormal 19 | optionBig 20 | 21 | 22 | 23 | IpSensorMan 24 | Music player 25 | Tasker 26 | Weather 27 | 28 | 29 | https://play.google.com/apps/testing/com.althink.android.ossw.plugins.ipsensorman 30 | https://play.google.com/apps/testing/com.althink.android.ossw.plugins.musicplayer 31 | https://play.google.com/apps/testing/com.althink.android.ossw.plugins.tasker 32 | https://play.google.com/apps/testing/com.klapaucius.ossw.weather 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/menu/gatt_services.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 22 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/time_interval_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 29 | 30 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/renderer/WatchSetRenderer.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.renderer; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.althink.android.ossw.emulator.WatchEmulator; 6 | import com.althink.android.ossw.emulator.actions.EmulatorAction; 7 | import com.althink.android.ossw.emulator.control.EmulatorControl; 8 | import com.althink.android.ossw.emulator.event.EmulatorEvent; 9 | import com.althink.android.ossw.emulator.watchset.WatchSetEmulatorModel; 10 | 11 | /** 12 | * Created by krzysiek on 14/06/15. 13 | */ 14 | public class WatchSetRenderer implements ScreenRender { 15 | 16 | private WatchSetEmulatorModel watchset; 17 | private WatchEmulator emulator; 18 | 19 | public WatchSetRenderer(WatchSetEmulatorModel watchset, WatchEmulator emulator) { 20 | this.watchset = watchset; 21 | this.emulator = emulator; 22 | } 23 | 24 | @Override 25 | public void render(LowLevelRenderer renderer) { 26 | for (EmulatorControl control : watchset.getCurrentScreenControls()) { 27 | control.draw(renderer, buildCtx()); 28 | } 29 | } 30 | 31 | @Override 32 | public void handleEvent(EmulatorEvent event) { 33 | EmulatorAction actionForEvent = watchset.getActionForEvent(event); 34 | if (actionForEvent != null) { 35 | actionForEvent.performAction(buildCtx()); 36 | } 37 | } 38 | 39 | @NonNull 40 | private EmulatorExecutionContext buildCtx() { 41 | return new EmulatorExecutionContext(watchset, emulator); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 14 | 18 | 22 | 26 | 27 | 30 | 34 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/ChooseEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 6 | import com.althink.android.ossw.watchsets.DataSourceType; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Created by krzysiek on 22/11/15. 13 | */ 14 | public class ChooseEmulatorControl extends AbstractEmulatorControl { 15 | 16 | private Map> controlsMap; 17 | 18 | public ChooseEmulatorControl(EmulatorDataSource dataSource, Map> controls) { 19 | super(dataSource); 20 | this.controlsMap = controls; 21 | } 22 | 23 | @Override 24 | public void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx) { 25 | Integer data = (Integer) getData(DataSourceType.NUMBER, 0x40, ctx); 26 | List controls = controlsMap.get(data); 27 | if (controls != null) { 28 | for (EmulatorControl control : controls) { 29 | control.draw(renderer, ctx); 30 | } 31 | } else { 32 | List otherwise = controlsMap.get(null); 33 | if (otherwise != null) { 34 | for (EmulatorControl control : otherwise) { 35 | control.draw(renderer, ctx); 36 | } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/watchset/WatchSetScreenEmulatorModel.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.watchset; 2 | 3 | import com.althink.android.ossw.emulator.actions.EmulatorAction; 4 | import com.althink.android.ossw.emulator.actions.EmulatorEventHandler; 5 | import com.althink.android.ossw.emulator.control.EmulatorControl; 6 | import com.althink.android.ossw.emulator.model.EmulatorModelProperty; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | * Created by krzysiek on 14/06/15. 13 | */ 14 | public class WatchSetScreenEmulatorModel { 15 | 16 | private List controls; 17 | 18 | private List actions; 19 | 20 | private Map model; 21 | 22 | public WatchSetScreenEmulatorModel() { 23 | } 24 | 25 | public WatchSetScreenEmulatorModel(List controls, List actions) { 26 | this.controls = controls; 27 | this.actions = actions; 28 | } 29 | 30 | public List getControls() { 31 | return controls; 32 | } 33 | 34 | public void setControls(List controls) { 35 | this.controls = controls; 36 | } 37 | 38 | public List getActions() { 39 | return actions; 40 | } 41 | 42 | public void setActions(List actions) { 43 | this.actions = actions; 44 | } 45 | 46 | public Map getModel() { 47 | return model; 48 | } 49 | 50 | public void setModel(Map model) { 51 | this.model = model; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/plugins/PluginPropertyDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.plugins; 2 | 3 | /** 4 | * Created by krzysiek on 16/06/15. 5 | */ 6 | public class PluginPropertyDefinition { 7 | private int id; 8 | private String name; 9 | private String description; 10 | private PluginPropertyType type; 11 | 12 | public PluginPropertyDefinition(int id, String name, String description, PluginPropertyType type) { 13 | this.id = id; 14 | this.name = name; 15 | this.description = description; 16 | this.type = type; 17 | } 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public String getDescription() { 28 | return description; 29 | } 30 | 31 | public PluginPropertyType getType() { 32 | return type; 33 | } 34 | 35 | @Override 36 | public boolean equals(Object o) { 37 | if (this == o) return true; 38 | if (o == null || getClass() != o.getClass()) return false; 39 | 40 | PluginPropertyDefinition that = (PluginPropertyDefinition) o; 41 | 42 | if (id != that.id) return false; 43 | if (!description.equals(that.description)) return false; 44 | if (!name.equals(that.name)) return false; 45 | if (type != that.type) return false; 46 | 47 | return true; 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | int result = id; 53 | result = 31 * result + name.hashCode(); 54 | result = 31 * result + description.hashCode(); 55 | result = 31 * result + type.hashCode(); 56 | return result; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/source/ExternalEmulatorDataSource.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.source; 2 | 3 | import com.althink.android.ossw.emulator.WatchEmulator; 4 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 5 | import com.althink.android.ossw.utils.StringNormalizer; 6 | import com.althink.android.ossw.watchsets.DataSourceType; 7 | 8 | import java.math.BigDecimal; 9 | import java.math.RoundingMode; 10 | 11 | /** 12 | * Created by krzysiek on 19/06/15. 13 | */ 14 | public class ExternalEmulatorDataSource implements EmulatorDataSource { 15 | 16 | private WatchEmulator emulator; 17 | private int property; 18 | 19 | public ExternalEmulatorDataSource(WatchEmulator emulator, int property) { 20 | this.emulator = emulator; 21 | this.property = property; 22 | } 23 | 24 | @Override 25 | public Object getData(DataSourceType type, int range, EmulatorExecutionContext ctx) { 26 | Object value = emulator.getExternalProperty(property); 27 | switch (type) { 28 | case NUMBER: 29 | int decimalNo = range & 0xF; 30 | int multi = 1; 31 | for (int i = 0; i < decimalNo; i++) { 32 | multi *= 10; 33 | } 34 | if (value instanceof Float) { 35 | BigDecimal decimal = new BigDecimal(((float) value) * multi); 36 | return decimal.setScale(0, RoundingMode.HALF_UP).intValue(); 37 | } 38 | return (int) value * multi; 39 | case STRING: 40 | return StringNormalizer.removeAccents((String)value); 41 | } 42 | return value; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/settings/TextSwitchPreference.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.settings; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.preference.PreferenceManager; 6 | import android.support.v7.preference.EditTextPreference; 7 | import android.support.v7.preference.PreferenceViewHolder; 8 | import android.support.v7.widget.SwitchCompat; 9 | import android.util.AttributeSet; 10 | import android.widget.CompoundButton; 11 | 12 | import com.althink.android.ossw.R; 13 | 14 | /** 15 | * Created by Pavel on 26/12/2015. 16 | */ 17 | public class TextSwitchPreference extends EditTextPreference { 18 | SwitchCompat switchCompat; 19 | public static final String KEY_SUFFIX = "_switch"; 20 | 21 | public TextSwitchPreference(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | @Override 26 | public void onBindViewHolder(PreferenceViewHolder holder) { 27 | super.onBindViewHolder(holder); 28 | switchCompat = (SwitchCompat) holder.itemView.findViewById(R.id.switch_button); 29 | final SharedPreferences shPref = PreferenceManager.getDefaultSharedPreferences(getContext()); 30 | try { 31 | boolean checked = shPref.getBoolean(getKey() + KEY_SUFFIX, false); 32 | switchCompat.setChecked(checked); 33 | } catch (ClassCastException e) { 34 | e.printStackTrace(); 35 | } 36 | switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 37 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 38 | shPref.edit().putBoolean(getKey() + KEY_SUFFIX, isChecked).apply(); 39 | } 40 | }); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/WatchExtensionProperty.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service; 2 | 3 | import com.althink.android.ossw.watchsets.DataSourceType; 4 | 5 | /** 6 | * Created by krzysiek on 13/06/15. 7 | */ 8 | public class WatchExtensionProperty { 9 | private String pluginId; 10 | private String propertyId; 11 | private DataSourceType type; 12 | private int range; 13 | 14 | public WatchExtensionProperty(String pluginId, String propertyId, DataSourceType type, int range) { 15 | this.pluginId = pluginId; 16 | this.propertyId = propertyId; 17 | this.type = type; 18 | this.range = range; 19 | } 20 | 21 | public String getPropertyId() { 22 | return propertyId; 23 | } 24 | 25 | public String getPluginId() { 26 | return pluginId; 27 | } 28 | 29 | public DataSourceType getType() { 30 | return type; 31 | } 32 | 33 | public void setType(DataSourceType type) { 34 | this.type = type; 35 | } 36 | 37 | public int getRange() { 38 | return range; 39 | } 40 | 41 | public void setRange(int range) { 42 | this.range = range; 43 | } 44 | 45 | @Override 46 | public boolean equals(Object o) { 47 | if (this == o) return true; 48 | if (o == null || getClass() != o.getClass()) return false; 49 | 50 | WatchExtensionProperty that = (WatchExtensionProperty) o; 51 | 52 | if (!propertyId.equals(that.propertyId)) return false; 53 | if (!pluginId.equals(that.pluginId)) return false; 54 | 55 | return true; 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | int result = pluginId.hashCode(); 61 | result = 31 * result + propertyId.hashCode(); 62 | return result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/SimpleEmulatorAction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.service.OsswService; 5 | import com.althink.android.ossw.service.WatchExtensionFunction; 6 | import com.althink.android.ossw.watch.WatchConstants; 7 | 8 | /** 9 | * Created by krzysiek on 18/06/15. 10 | */ 11 | public class SimpleEmulatorAction implements EmulatorAction { 12 | private int actionType; 13 | private int parameter; 14 | 15 | public SimpleEmulatorAction(int actionType, int parameter) { 16 | this.actionType = actionType; 17 | this.parameter = parameter; 18 | } 19 | 20 | public void performAction(EmulatorExecutionContext ctx) { 21 | switch (actionType) { 22 | case WatchConstants.WATCHSET_FUNCTION_BACKLIGHT_TOGGLE: 23 | ctx.getEmulator().toggleBacklight(); 24 | break; 25 | case WatchConstants.WATCHSET_FUNCTION_TOGGLE_COLORS: 26 | ctx.getEmulator().toggleColors(); 27 | break; 28 | case WatchConstants.WATCHSET_FUNCTION_CHANGE_SCREEN: 29 | ctx.getWatchset().setCurrentScreen(parameter); 30 | break; 31 | case WatchConstants.WATCHSET_FUNCTION_EXTENSION: 32 | WatchExtensionFunction function = ctx.getWatchset().getOperationContext().getExternalFunctions().get(parameter); 33 | OsswService service = OsswService.getInstance(); 34 | if (service != null) { 35 | service.invokeExtensionFunction(function.getPluginId(), function.getFunctionId(), function.getParameter()); 36 | } 37 | break; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/res/menu/watchsets.xml: -------------------------------------------------------------------------------- 1 | 15 | 17 | 23 | 29 | 35 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/service/WatchExtensionFunction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.service; 2 | 3 | /** 4 | * Created by krzysiek on 13/06/15. 5 | */ 6 | public class WatchExtensionFunction { 7 | private String pluginId; 8 | private String functionId; 9 | private String parameter; 10 | 11 | public WatchExtensionFunction(String pluginId, String functionId, String parameter) { 12 | this.pluginId = pluginId; 13 | this.functionId = functionId; 14 | this.parameter = parameter; 15 | } 16 | 17 | public String getPluginId() { 18 | return pluginId; 19 | } 20 | 21 | public String getFunctionId() { 22 | return functionId; 23 | } 24 | 25 | public String getParameter() { 26 | return parameter; 27 | } 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) return true; 32 | if (o == null || getClass() != o.getClass()) return false; 33 | 34 | WatchExtensionFunction that = (WatchExtensionFunction) o; 35 | 36 | if (functionId != null ? !functionId.equals(that.functionId) : that.functionId != null) 37 | return false; 38 | if (parameter != null ? !parameter.equals(that.parameter) : that.parameter != null) 39 | return false; 40 | if (pluginId != null ? !pluginId.equals(that.pluginId) : that.pluginId != null) 41 | return false; 42 | 43 | return true; 44 | } 45 | 46 | @Override 47 | public int hashCode() { 48 | int result = pluginId != null ? pluginId.hashCode() : 0; 49 | result = 31 * result + (functionId != null ? functionId.hashCode() : 0); 50 | result = 31 * result + (parameter != null ? parameter.hashCode() : 0); 51 | return result; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return pluginId + "/" + functionId + "(" + parameter + ")"; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/ImageFromSetEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 6 | import com.althink.android.ossw.emulator.source.EmulatorResourceSource; 7 | import com.althink.android.ossw.watchsets.DataSourceType; 8 | 9 | /** 10 | * Created by krzysiek on 14/06/15. 11 | */ 12 | public class ImageFromSetEmulatorControl extends AbstractEmulatorControl { 13 | private int x; 14 | private int y; 15 | private int width; 16 | private int height; 17 | private EmulatorResourceSource image; 18 | 19 | public ImageFromSetEmulatorControl(int x, int y, int width, int height, EmulatorResourceSource image, EmulatorDataSource dataSource) { 20 | super(dataSource); 21 | this.x = x; 22 | this.y = y; 23 | this.width = width; 24 | this.height = height; 25 | this.image = image; 26 | } 27 | 28 | public void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx) { 29 | Object value = getData(DataSourceType.NUMBER, 0, ctx); 30 | if (value == null) { 31 | return; 32 | } 33 | int intValue = (int) value; 34 | 35 | int firstImageId = 0xFF&image.getData()[2]; 36 | int numberOfImages = 0xFF&image.getData()[3]; 37 | 38 | if (intValue < firstImageId || intValue >= firstImageId + numberOfImages) { 39 | return; 40 | } 41 | 42 | int imageWidth = 0xFF&image.getData()[4]; 43 | int imageHeight = 0xFF&image.getData()[5]; 44 | 45 | int imageNo = intValue - firstImageId; 46 | int idx = 6 + (((imageWidth + 7) / 8) * imageHeight * imageNo); 47 | renderer.drawBitmap(image.getData(), idx, x, y, imageWidth, imageHeight, imageWidth); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/plugins/PluginDefinition.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.plugins; 2 | 3 | import android.provider.BaseColumns; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by krzysiek on 12/06/15. 9 | */ 10 | public class PluginDefinition implements Comparable { 11 | 12 | private String pluginId; 13 | private String label; 14 | private String packageName; 15 | private String url; 16 | 17 | private List functions; 18 | private List properties; 19 | 20 | public PluginDefinition(String pluginId, String label, String packageName) { 21 | this.pluginId = pluginId; 22 | this.label = label; 23 | this.packageName = packageName; 24 | this.functions = functions; 25 | this.properties = properties; 26 | } 27 | 28 | public PluginDefinition(String label, String url) { 29 | this.label = label; 30 | this.url = url; 31 | this.packageName = url.substring(url.lastIndexOf('/') + 1); 32 | } 33 | 34 | public String getPluginId() { 35 | return pluginId; 36 | } 37 | 38 | public String getLabel() { 39 | return label; 40 | } 41 | 42 | public String getPackageName() { 43 | return packageName; 44 | } 45 | 46 | public String getUrl() { 47 | return url; 48 | } 49 | 50 | public void setUrl(String url) { 51 | this.url = url; 52 | } 53 | 54 | public List getFunctions() { 55 | return functions; 56 | } 57 | 58 | public List getProperties() { 59 | return properties; 60 | } 61 | 62 | public void setFunctions(List functions) { 63 | this.functions = functions; 64 | } 65 | 66 | public void setProperties(List properties) { 67 | this.properties = properties; 68 | } 69 | 70 | @Override 71 | public int compareTo(PluginDefinition another) { 72 | return label.compareTo(another.getLabel()); 73 | } 74 | } -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/watchsets/WatchSetPreviewActivity.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.watchsets; 2 | 3 | import android.net.Uri; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import com.althink.android.ossw.R; 10 | 11 | public class WatchSetPreviewActivity extends AppCompatActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | setContentView(R.layout.activity_watch_set_preview); 17 | } 18 | 19 | @Override 20 | protected void onPostCreate(Bundle savedInstanceState) { 21 | super.onPostCreate(savedInstanceState); 22 | setContentView(R.layout.activity_watch_set_preview); 23 | Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); 24 | mToolbar.setClickable(true); 25 | setSupportActionBar(mToolbar); 26 | getSupportActionBar().setHomeButtonEnabled(true); 27 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 28 | 29 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { 30 | @Override 31 | public void onClick(View v) { 32 | finish(); 33 | } 34 | }); 35 | WatchSetImportFragment importFragment = new WatchSetImportFragment(); 36 | 37 | Bundle extras = getIntent().getExtras(); 38 | if (extras != null) { 39 | WatchSetType t = (WatchSetType) extras.getSerializable("type"); 40 | importFragment.setWatchsetType(t); 41 | String param = extras.getString("uri"); 42 | if (param != null && !param.isEmpty()) { 43 | Uri uri = Uri.parse(param); 44 | importFragment.setUri(uri); 45 | } 46 | if (extras.containsKey("id")) 47 | importFragment.setId(extras.getInt("id")); 48 | } 49 | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, importFragment) 50 | .commit(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/control/ProgressEmulatorControl.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.control; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 6 | import com.althink.android.ossw.watchsets.DataSourceType; 7 | 8 | /** 9 | * Created by krzysiek on 14/06/15. 10 | */ 11 | public class ProgressEmulatorControl extends AbstractEmulatorControl { 12 | private int maxValue; 13 | private int x; 14 | private int y; 15 | private int width; 16 | private int height; 17 | private int style; 18 | 19 | public ProgressEmulatorControl(int maxValue, int x, int y, int width, int height, int style, EmulatorDataSource dataSource) { 20 | super(dataSource); 21 | this.maxValue = maxValue; 22 | this.x = x; 23 | this.y = y; 24 | this.width = width; 25 | this.height = height; 26 | this.style = style; 27 | } 28 | 29 | public void draw(LowLevelRenderer renderer, EmulatorExecutionContext ctx) { 30 | Object value = getData(DataSourceType.NUMBER, 0, ctx); 31 | if (value == null || !(value instanceof Integer)) { 32 | return; 33 | } 34 | int intValue = (int) value; 35 | float percentage = (float) intValue / (float) maxValue; 36 | if (percentage > 1) { 37 | percentage = 1; 38 | } 39 | 40 | int border = style >> 16 & 0xFF; 41 | boolean vertical = (style >> 24 & 0x20) != 0; 42 | int delta = 0; 43 | if (border > 0) { 44 | renderer.drawEmptyRect(x, y, width, height, border); 45 | delta = border + 1; 46 | } 47 | 48 | if (vertical) { 49 | int h = height - (2 * delta); 50 | int barHeight = (int)(h * percentage); 51 | renderer.drawRect(x + delta, y + delta + h - barHeight, width - 2 * delta, barHeight); 52 | } else { 53 | renderer.drawRect(x + delta, y + delta, (int) ((width - (2 * delta)) * percentage), height - (2 * delta)); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/SimpleNotification.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by krzysiek on 24/07/15. 8 | */ 9 | public class SimpleNotification extends AbstractNotification { 10 | 11 | private String title; 12 | private String text; 13 | 14 | public SimpleNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, String title, String text, Object notificationObject) { 15 | super(id, type, category, application, date, operations, notificationObject); 16 | this.title = title; 17 | this.text = text; 18 | } 19 | 20 | public SimpleNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, String title, String text, Object notificationObject, Integer externalId) { 21 | super(id, type, category, application, date, operations, notificationObject, externalId); 22 | this.title = title; 23 | this.text = text; 24 | } 25 | 26 | public String getTitle() { 27 | return title; 28 | } 29 | 30 | public String getText() { 31 | return text; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "SimpleNotification{" + 37 | "title='" + title + '\'' + 38 | ", text='" + text + '\'' + 39 | "}+" + super.toString(); 40 | } 41 | 42 | @Override 43 | public boolean equals(Object o) { 44 | if (this == o) return true; 45 | if (o == null || getClass() != o.getClass()) return false; 46 | 47 | SimpleNotification that = (SimpleNotification) o; 48 | 49 | if (text != null ? !text.equals(that.text) : that.text != null) return false; 50 | if (title != null ? !title.equals(that.title) : that.title != null) return false; 51 | 52 | return true; 53 | } 54 | 55 | @Override 56 | public int hashCode() { 57 | int result = title != null ? title.hashCode() : 0; 58 | result = 31 * result + (text != null ? text.hashCode() : 0); 59 | return result; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/AlertNotificationMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | import com.althink.android.ossw.notifications.model.NotificationCategory; 4 | import com.althink.android.ossw.notifications.model.Operation; 5 | import com.althink.android.ossw.utils.StringNormalizer; 6 | 7 | import java.io.ByteArrayOutputStream; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by krzysiek on 19/07/15. 12 | */ 13 | public class AlertNotificationMessageBuilder extends AbstractNotificationMessageBuilder { 14 | 15 | private ByteArrayOutputStream out; 16 | 17 | public AlertNotificationMessageBuilder(NotificationCategory category, String title, String text, List operations) { 18 | out = new ByteArrayOutputStream(); 19 | ByteArrayOutputStream content = new ByteArrayOutputStream(); 20 | 21 | int operationsNo = operations.size() > 2 ? 2 : operations.size(); 22 | 23 | int font = getAlertFont(); 24 | 25 | int headerSize = 5 + operationsNo * 2; 26 | int offset = headerSize; 27 | byte[] textData = title != null ? StringNormalizer.removeAccents(title + "\u000B" + text).getBytes() : new byte[0]; 28 | 29 | out.write(category.getValue()); 30 | 31 | offset = addReferencedParameter(content, offset, textData); 32 | out.write(font); 33 | out.write(operationsNo); 34 | 35 | for(int i=0; i>8)&0xFF); 53 | out.write(offset&0xFF); 54 | } 55 | 56 | 57 | @Override 58 | public byte[] build() { 59 | return out.toByteArray(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/ListNotification.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by krzysiek on 25/07/15. 8 | */ 9 | public class ListNotification extends AbstractNotification { 10 | private String title; 11 | private List items; 12 | 13 | public ListNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, String title, List items, Object notificationObject) { 14 | super(id, type, category, application, date, operations, notificationObject); 15 | this.title = title; 16 | this.items = items; 17 | } 18 | 19 | public ListNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, String title, List items, Object notificationObject, Integer externalId) { 20 | super(id, type, category, application, date, operations, notificationObject, externalId); 21 | this.title = title; 22 | this.items = items; 23 | } 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public void setTitle(String title) { 30 | this.title = title; 31 | } 32 | 33 | public List getItems() { 34 | return items; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "ListNotification{" + 40 | "title='" + title + '\'' + 41 | ", items=" + items + 42 | "}+" + super.toString(); 43 | } 44 | 45 | @Override 46 | public boolean equals(Object o) { 47 | if (this == o) return true; 48 | if (o == null || getClass() != o.getClass()) return false; 49 | 50 | ListNotification that = (ListNotification) o; 51 | 52 | if (items != null ? !items.equals(that.items) : that.items != null) return false; 53 | if (title != null ? !title.equals(that.title) : that.title != null) return false; 54 | 55 | return true; 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | int result = title != null ? title.hashCode() : 0; 61 | result = 31 * result + (items != null ? items.hashCode() : 0); 62 | return result; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/NotificationParser.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | //import java.text.SimpleDateFormat; 4 | //import java.util.Date; 5 | //import java.util.Locale; 6 | // 7 | //import android.app.Notification; 8 | //import android.util.Log; 9 | // 10 | //public enum NotificationParser { 11 | // SMS("com.android.mms", new DefaultTicker()), 12 | // GMAIL("com.google.android.gm", new EmailBigView()), 13 | // EMAIL("com.android.email", new EmailBigView()), 14 | // MISSED_CALL("com.android.phone", new MissedCallBigView()), 15 | // MISSED_CALL_5("com.android.server.telecom", new MissedCallBigView()), 16 | // THREEMA("ch.threema.app", new DefaultView()), 17 | // TEXTSECURE("org.thoughtcrime.securesms", new DefaultView()), 18 | // HANGOUTS("com.google.android.talk", new DefaultView()), 19 | // FACEBOOK("com.facebook.orca", new DefaultView()), 20 | // SYKPE("com.skype.raider", new DefaultView()), 21 | // WHATSAPP("com.whatsapp", new DefaultBigView()), 22 | // CHADDER("com.etransfr.chadder", new DefaultView()), 23 | // SAYHEY("de.simyo.app.sayhey", new DefaultView()), 24 | // TELEGRAM("org.telegram.messenger", new DefaultView()); 25 | // 26 | // private static final String TAG = NotificationParser.class.getName(); 27 | // 28 | // private String packageName; 29 | // private MessageParser parser; 30 | // 31 | // NotificationParser(String packageName, MessageParser parser) { 32 | // this.packageName = packageName.toLowerCase(Locale.ENGLISH); 33 | // this.parser = parser; 34 | // } 35 | // 36 | // public static Message getMessage(String packageName, Notification notification) { 37 | // String notificationPackage = packageName.toLowerCase( 38 | // Locale.ENGLISH); 39 | // 40 | // for (NotificationParser messenger : NotificationParser.values()) { 41 | // if (!messenger.packageName.equals(notificationPackage)) 42 | // continue; 43 | // 44 | // Log.d(TAG, "Found matching messenger: " + messenger.packageName); 45 | // 46 | // Message result = messenger.parser.parse(notification); 47 | // 48 | // if (result == null) 49 | // return null; 50 | // 51 | // result.app = packageName; 52 | // result.time = new SimpleDateFormat("yyy-MM-dd HH:mm", Locale.US).format(new Date()); 53 | // 54 | // return result; 55 | // } 56 | // 57 | // return null; 58 | // } 59 | //} 60 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/actions/EmulatorModelAction.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator.actions; 2 | 3 | import com.althink.android.ossw.emulator.renderer.EmulatorExecutionContext; 4 | import com.althink.android.ossw.emulator.source.EmulatorDataSource; 5 | import com.althink.android.ossw.service.OsswService; 6 | import com.althink.android.ossw.service.WatchExtensionFunction; 7 | import com.althink.android.ossw.watch.WatchConstants; 8 | import com.althink.android.ossw.watchsets.DataSourceType; 9 | 10 | /** 11 | * Created by krzysiek on 23/11/15. 12 | */ 13 | public class EmulatorModelAction implements EmulatorAction { 14 | 15 | private int actionType; 16 | private int propertyId; 17 | private EmulatorDataSource dataSource; 18 | 19 | public EmulatorModelAction(int actionType, int propertyId) { 20 | this.actionType = actionType; 21 | this.propertyId = propertyId; 22 | } 23 | 24 | public EmulatorModelAction(int actionType, int propertyId, EmulatorDataSource dataSource) { 25 | this.actionType = actionType; 26 | this.dataSource = dataSource; 27 | this.propertyId = propertyId; 28 | } 29 | 30 | @Override 31 | public void performAction(EmulatorExecutionContext ctx) { 32 | switch (actionType) { 33 | case WatchConstants.WATCHSET_FUNCTION_MODEL_SET: 34 | ctx.getWatchset().getCurrentScreenModel().get(propertyId).setValue(dataSource.getData(DataSourceType.NUMBER, 0x40, ctx)); 35 | break; 36 | case WatchConstants.WATCHSET_FUNCTION_MODEL_INCREMENT: 37 | ctx.getWatchset().getCurrentScreenModel().get(propertyId).increment(); 38 | break; 39 | case WatchConstants.WATCHSET_FUNCTION_MODEL_DECREMENT: 40 | ctx.getWatchset().getCurrentScreenModel().get(propertyId).decrement(); 41 | break; 42 | case WatchConstants.WATCHSET_FUNCTION_MODEL_ADD: 43 | ctx.getWatchset().getCurrentScreenModel().get(propertyId).add(dataSource.getData(DataSourceType.NUMBER, 0x40, ctx)); 44 | break; 45 | case WatchConstants.WATCHSET_FUNCTION_MODEL_SUBTRACT: 46 | ctx.getWatchset().getCurrentScreenModel().get(propertyId).subtract(dataSource.getData(DataSourceType.NUMBER, 0x40, ctx)); 47 | break; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/SimpleNotificationMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | import android.util.Log; 4 | 5 | import com.althink.android.ossw.emulator.fonts.FontUtils; 6 | import com.althink.android.ossw.notifications.model.NotificationCategory; 7 | import com.althink.android.ossw.notifications.model.SimpleNotification; 8 | import com.althink.android.ossw.utils.StringNormalizer; 9 | import com.althink.android.ossw.watch.WatchConstants; 10 | 11 | import java.io.ByteArrayOutputStream; 12 | import java.util.Arrays; 13 | 14 | /** 15 | * Created by krzysiek on 19/07/15. 16 | */ 17 | public class SimpleNotificationMessageBuilder extends AbstractNotificationMessageBuilder { 18 | 19 | private ByteArrayOutputStream out; 20 | 21 | public SimpleNotificationMessageBuilder(SimpleNotification simpleNotification, int page) { 22 | out = new ByteArrayOutputStream(); 23 | 24 | StringBuilder sb = new StringBuilder(); 25 | sb.append(simpleNotification.getTitle()); 26 | if (NotificationCategory.EMAIL == simpleNotification.getCategory()) { 27 | sb.append((char) 0x0B).append(simpleNotification.getText().replaceFirst("\n", "\u000B")); 28 | } else { 29 | sb.append((char) 0x0B).append(simpleNotification.getText()); 30 | } 31 | 32 | String text = StringNormalizer.removeAccents(sb.toString()); 33 | 34 | int font = getFont(); 35 | 36 | int ptr = 0; 37 | String data = ""; 38 | for (int i = 0; i <= page; i++) { 39 | data = calculatePageContent(text, font, ptr); 40 | ptr += data.length(); 41 | } 42 | String nextPageData = calculatePageContent(text, font, ptr).replaceAll("\\s",""); 43 | boolean hasMore = nextPageData.length() > 0; 44 | //Log.i("SimpleNotificationMB", "Data to send: " + data); 45 | //Log.i("SimpleNotificationMB", "Next page data: " + Arrays.toString(nextPageData.toCharArray())); 46 | byte[] contentData = data != null ? data.getBytes() : new byte[0]; 47 | 48 | out.write(simpleNotification.getCategory().getValue()); 49 | out.write((simpleNotification.getExternalId() >> 8) & 0xFF); 50 | out.write(simpleNotification.getExternalId() & 0xFF); 51 | out.write(page); 52 | out.write(font); 53 | out.write(hasMore ? 1 : 0); 54 | out.write(contentData, 0, contentData.length); 55 | out.write(0); 56 | } 57 | 58 | @Override 59 | public byte[] build() { 60 | return out.toByteArray(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/ListNotificationMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | import com.althink.android.ossw.emulator.fonts.FontUtils; 4 | import com.althink.android.ossw.notifications.model.ListNotification; 5 | import com.althink.android.ossw.notifications.model.SimpleListItem; 6 | import com.althink.android.ossw.notifications.model.SimpleNotification; 7 | import com.althink.android.ossw.notifications.model.SubjectMessageItem; 8 | import com.althink.android.ossw.utils.StringNormalizer; 9 | import com.althink.android.ossw.watch.WatchConstants; 10 | 11 | import java.io.ByteArrayOutputStream; 12 | 13 | /** 14 | * Created by krzysiek on 19/07/15. 15 | */ 16 | public class ListNotificationMessageBuilder extends AbstractNotificationMessageBuilder { 17 | 18 | private ByteArrayOutputStream out; 19 | 20 | public ListNotificationMessageBuilder(ListNotification simpleNotification, int page) { 21 | out = new ByteArrayOutputStream(); 22 | 23 | int font = getFont(); 24 | 25 | StringBuilder sb = new StringBuilder(); 26 | sb.append(simpleNotification.getTitle()); 27 | for (Object item : simpleNotification.getItems()) { 28 | if (sb.length() > 0) { 29 | sb.append((char)0x0B); 30 | } 31 | if (item instanceof SimpleListItem) { 32 | sb.append(((SimpleListItem) item).getText()); 33 | } else if (item instanceof SubjectMessageItem) { 34 | sb.append(((SubjectMessageItem) item).getSubject()).append((char)0x0B).append(((SubjectMessageItem) item).getMessage()); 35 | } 36 | } 37 | String text = StringNormalizer.removeAccents(sb.toString()); 38 | 39 | int ptr = 0; 40 | String data = ""; 41 | for (int i = 0; i <= page; i++) { 42 | data = calculatePageContent(text, font, ptr); 43 | ptr += data.length(); 44 | } 45 | boolean hasMore = ptr < text.length(); 46 | byte[] contentData = data != null ? data.getBytes() : new byte[0]; 47 | 48 | out.write(simpleNotification.getCategory().getValue()); 49 | out.write((simpleNotification.getExternalId() >> 8) & 0xFF); 50 | out.write(simpleNotification.getExternalId() & 0xFF); 51 | out.write(page); 52 | out.write(font); 53 | out.write(hasMore ? 1 : 0); 54 | out.write(contentData, 0, contentData.length); 55 | out.write(0); 56 | } 57 | 58 | @Override 59 | public byte[] build() { 60 | return out.toByteArray(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/message/AbstractNotificationMessageBuilder.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.message; 2 | 3 | import android.content.SharedPreferences; 4 | import android.preference.PreferenceManager; 5 | 6 | import com.althink.android.ossw.emulator.fonts.FontUtils; 7 | import com.althink.android.ossw.service.OsswService; 8 | import com.althink.android.ossw.watch.WatchConstants; 9 | 10 | /** 11 | * Created by krzysiek on 09/08/15. 12 | */ 13 | public abstract class AbstractNotificationMessageBuilder implements NotificationMessageBuilder { 14 | 15 | 16 | protected int getAlertFont() { 17 | OsswService service = OsswService.getInstance(); 18 | if (service != null) { 19 | SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(service); 20 | String font = sharedPref.getString("alert_notifications_font", "optionNormal"); 21 | return getFont(font); 22 | } 23 | return WatchConstants.FONT_NAME_OPTION_NORMAL; 24 | } 25 | 26 | protected int getFont() { 27 | OsswService service = OsswService.getInstance(); 28 | if (service != null) { 29 | SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(service); 30 | String font = sharedPref.getString("notifications_font", "normalBold"); 31 | return getFont(font); 32 | } 33 | return WatchConstants.FONT_NAME_NORMAL_BOLD; 34 | } 35 | 36 | private int getFont(String font) { 37 | switch (font) { 38 | case "bigRegular": 39 | return WatchConstants.FONT_BIG_REGULAR; 40 | case "normalBold": 41 | return WatchConstants.FONT_NORMAL_BOLD; 42 | case "normalRegular": 43 | return WatchConstants.FONT_NORMAL_REGULAR; 44 | case "smallBold": 45 | return WatchConstants.FONT_SMALL_BOLD; 46 | case "smallRegular": 47 | return WatchConstants.FONT_SMALL_REGULAR; 48 | case "optionNormal": 49 | return WatchConstants.FONT_OPTION_NORMAL; 50 | case "optionBig": 51 | return WatchConstants.FONT_OPTION_BIG; 52 | } 53 | return WatchConstants.FONT_NAME_NORMAL_BOLD; 54 | } 55 | 56 | protected String calculatePageContent(String text, int font, int ptr) { 57 | return FontUtils.calcTextToDraw(text, ptr, 3, 3, WatchConstants.SCREEN_WIDTH - 6, WatchConstants.SCREEN_HEIGHT - 6, font, WatchConstants.HORIZONTAL_ALIGN_LEFT | WatchConstants.TEXT_FLAGS_MULTILINE); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/emulator/WatchEmulator.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.emulator; 2 | 3 | import com.althink.android.ossw.emulator.event.EmulatorEvent; 4 | import com.althink.android.ossw.emulator.renderer.LowLevelRenderer; 5 | import com.althink.android.ossw.emulator.renderer.ScreenRender; 6 | import com.althink.android.ossw.emulator.renderer.WatchSetRenderer; 7 | import com.althink.android.ossw.emulator.watchset.WatchSetEmulatorModel; 8 | import com.althink.android.ossw.emulator.watchset.WatchSetEmulatorParser; 9 | import com.althink.android.ossw.service.OsswService; 10 | import com.althink.android.ossw.service.WatchExtensionProperty; 11 | import com.althink.android.ossw.watchsets.CompiledWatchSet; 12 | 13 | /** 14 | * Created by krzysiek on 14/06/15. 15 | */ 16 | public class WatchEmulator { 17 | 18 | private final static String TAG = WatchEmulator.class.getSimpleName(); 19 | 20 | private ScreenRender screenRenderer; 21 | 22 | private boolean colorsInverted = false; 23 | 24 | private boolean backlight = false; 25 | 26 | private WatchSetEmulatorModel watchSet; 27 | 28 | public void render(LowLevelRenderer llr) { 29 | llr.setMode(colorsInverted, backlight); 30 | llr.clearScreen(); 31 | if (screenRenderer != null) { 32 | screenRenderer.render(llr); 33 | } 34 | } 35 | 36 | public void handleEvent(EmulatorEvent event) { 37 | screenRenderer.handleEvent(event); 38 | } 39 | 40 | public WatchSetEmulatorModel parseWatchSet(CompiledWatchSet watchSet) { 41 | WatchSetEmulatorModel emulatorModel = new WatchSetEmulatorParser(this).parse(watchSet.getWatchData()); 42 | emulatorModel.setOperationContext(watchSet.getWatchContext()); 43 | return emulatorModel; 44 | } 45 | 46 | public void showWatchSet(WatchSetEmulatorModel watchSet) { 47 | 48 | this.watchSet = watchSet; 49 | screenRenderer = new WatchSetRenderer(watchSet, this); 50 | } 51 | 52 | public void toggleBacklight() { 53 | backlight = !backlight; 54 | } 55 | 56 | public void toggleColors() { 57 | colorsInverted = !colorsInverted; 58 | } 59 | 60 | public Object getExternalProperty(int property) { 61 | OsswService service = OsswService.getInstance(); 62 | if (service == null) { 63 | return null; 64 | } 65 | WatchExtensionProperty extensionProperty = watchSet.getOperationContext().getExternalParameters().get(property); 66 | return service.getPropertyFromExtension(extensionProperty.getPluginId(), extensionProperty.getPropertyId()); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/DefaultView.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model.api19; 2 | // 3 | //import java.lang.reflect.Field; 4 | //import java.util.ArrayList; 5 | // 6 | //import android.app.Notification; 7 | //import android.os.Parcel; 8 | //import android.os.Parcelable; 9 | //import android.text.TextUtils; 10 | //import android.util.Log; 11 | //import android.widget.RemoteViews; 12 | // 13 | //import com.althink.android.ossw.notifications.NotificationListener; 14 | // 15 | //public class DefaultView implements MessageParser { 16 | // private static final String TAG = DefaultView.class.getName(); 17 | // 18 | // @Override 19 | // public Message parse(Notification notification) { 20 | // Message result = new Message(); 21 | // 22 | // try { 23 | // RemoteViews views = notification.contentView; 24 | // Class rvClass = views.getClass(); 25 | // 26 | // Field field = rvClass.getDeclaredField("mActions"); 27 | // field.setAccessible(true); 28 | // 29 | // @SuppressWarnings("unchecked") 30 | // ArrayList actions = (ArrayList) field 31 | // .get(views); 32 | // 33 | // for (Parcelable action : actions) { 34 | // try { 35 | // // create parcel from action 36 | // Parcel parcel = Parcel.obtain(); 37 | // action.writeToParcel(parcel, 0); 38 | // parcel.setDataPosition(0); 39 | // 40 | // // check if is 2 / ReflectionAction 41 | // int tag = parcel.readInt(); 42 | // if (tag != 2) 43 | // continue; 44 | // 45 | // int viewId = parcel.readInt(); 46 | // 47 | // String methodName = parcel.readString(); 48 | // if (methodName == null || !methodName.equals("setText")) { 49 | // Log.w(TAG, "# Not setText: " + methodName); 50 | // continue; 51 | // } 52 | // 53 | // // should be 10 / Character Sequence, here 54 | // parcel.readInt(); 55 | // 56 | // // Store the actual string 57 | // CharSequence value = TextUtils.CHAR_SEQUENCE_CREATOR 58 | // .createFromParcel(parcel); 59 | // 60 | // Log.d(TAG, "viewId is " + viewId); 61 | // Log.d(TAG, "Found value: " + value.toString()); 62 | // 63 | // if (viewId == NotificationListener.TITLE) 64 | // result.subject = value.toString(); 65 | // else if (viewId == NotificationListener.TEXT) 66 | // result.message = value.toString(); 67 | // 68 | // parcel.recycle(); 69 | // } catch (Exception e) { 70 | // Log.e(TAG, "Error accessing object!", e); 71 | // } 72 | // } 73 | // 74 | // if (result.subject == null || result.message == null) 75 | // return null; 76 | // 77 | // return result; 78 | // } catch (Exception e) { 79 | // Log.e(TAG, "Could not access mActions!", e); 80 | // 81 | // return null; 82 | // } 83 | // } 84 | //} 85 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/parser/api18/MessageStore.java: -------------------------------------------------------------------------------- 1 | //package com.althink.android.ossw.notifications.model; 2 | // 3 | //import java.util.ArrayList; 4 | //import java.util.List; 5 | // 6 | //import org.json.JSONArray; 7 | //import org.json.JSONException; 8 | // 9 | //import android.app.Service; 10 | //import android.content.Context; 11 | //import android.content.SharedPreferences; 12 | //import android.content.SharedPreferences.Editor; 13 | //import android.util.Log; 14 | // 15 | //public class MessageStore { 16 | // private static final String TAG = MessageStore.class.getName(); 17 | // 18 | // private static MessageStore _instance = null; 19 | // 20 | // public static synchronized MessageStore getInstance(Context context) { 21 | // if (_instance == null) 22 | // _instance = new MessageStore(context); 23 | // 24 | // return _instance; 25 | // } 26 | // 27 | // // -------- 28 | // 29 | // private static final int MAX_COUNT = 20; 30 | // 31 | // private SharedPreferences preferences = null; 32 | // private List messages = null; 33 | // private MessageListener listener = null; 34 | // 35 | // public MessageStore(Context context) { 36 | // this.preferences = context.getSharedPreferences("data", 37 | // Service.MODE_PRIVATE); 38 | // 39 | // this.messages = new ArrayList(); 40 | // 41 | // try { 42 | // JSONArray array = new JSONArray(this.preferences.getString( 43 | // "messages", "[]")); 44 | // 45 | // for (int i = 0; i < array.length(); i++) { 46 | // Message message = Message.fromJSON(array.getJSONObject(i)); 47 | // this.messages.add(message); 48 | // } 49 | // } catch (JSONException e) { 50 | // Log.e(TAG, "Could not restore messages!", e); 51 | // } 52 | // } 53 | // 54 | // public void addMessage(Message message) { 55 | // this.messages.add(0, message); 56 | // 57 | // if (this.messages.size() > MAX_COUNT) 58 | // this.messages.remove(this.messages.size() - 1); 59 | // 60 | // if (this.listener != null) 61 | // this.listener.onMessage(message); 62 | // 63 | // try { 64 | // Editor editor = this.preferences.edit(); 65 | // 66 | // JSONArray array = new JSONArray(); 67 | // for (Message current : this.messages) { 68 | // array.put(current.toJSON()); 69 | // } 70 | // 71 | // editor.putString("messages", array.toString()); 72 | // editor.commit(); 73 | // } catch (JSONException e) { 74 | // Log.e(TAG, "Could not store messages persistent!", e); 75 | // } 76 | // } 77 | // 78 | // public void clear() { 79 | // this.messages.clear(); 80 | // 81 | // Editor editor = this.preferences.edit(); 82 | // editor.clear(); 83 | // editor.commit(); 84 | // } 85 | // 86 | // public List getMessages() { 87 | // return this.messages; 88 | // } 89 | // 90 | // public void setListener(MessageListener listener) { 91 | // this.listener = listener; 92 | // } 93 | //} 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/utils/FunctionHandler.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.media.AudioManager; 6 | import android.media.MediaPlayer; 7 | import android.net.Uri; 8 | import android.os.Vibrator; 9 | import android.preference.PreferenceManager; 10 | import android.util.Log; 11 | 12 | import com.althink.android.ossw.service.OsswService; 13 | 14 | import java.io.IOException; 15 | 16 | /** 17 | * Created by Pavel on 25/12/2015. 18 | */ 19 | public class FunctionHandler { 20 | private final static String TAG = FunctionHandler.class.getSimpleName(); 21 | public static final String FUNCTION_PHONE_DISCOVERY = "phone.discovery"; 22 | public static final String PREFERENCE_PHONE_DISCOVERY_AUDIO = "phone_discovery_audio"; 23 | public static final String PREFERENCE_PHONE_DISCOVERY_VIBRATE = "phone_discovery_vibrate"; 24 | private static final long[] discoveryVibration = {200, 500}; 25 | private static boolean phoneDiscoveryStarted = false; 26 | 27 | public static void handleFunction(String functionId, String parameter) { 28 | if (FUNCTION_PHONE_DISCOVERY.equals(functionId)) { 29 | MediaPlayer mediaPlayer = OsswService.getMediaPlayer(); 30 | OsswService osswService = OsswService.getInstance(); 31 | SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(osswService); 32 | Vibrator v = (Vibrator) osswService.getSystemService(Context.VIBRATOR_SERVICE); 33 | if (phoneDiscoveryStarted) { 34 | Log.i(TAG, "Phone discovery: " + phoneDiscoveryStarted + ", stopping"); 35 | phoneDiscoveryStarted = false; 36 | if (mediaPlayer.isPlaying()) 37 | mediaPlayer.stop(); 38 | v.cancel(); 39 | } else { 40 | Log.i(TAG, "Phone discovery: " + phoneDiscoveryStarted + ", starting"); 41 | phoneDiscoveryStarted = true; 42 | String uriValue = sharedPref.getString(PREFERENCE_PHONE_DISCOVERY_AUDIO, null); 43 | if (uriValue != null) { 44 | Uri uri = Uri.parse(uriValue); 45 | mediaPlayer.reset(); 46 | mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); 47 | try { 48 | mediaPlayer.setDataSource(osswService.getApplicationContext(), uri); 49 | mediaPlayer.prepare(); 50 | mediaPlayer.start(); 51 | } catch (IOException e) { 52 | e.printStackTrace(); 53 | } 54 | } 55 | boolean vibrate = sharedPref.getBoolean(PREFERENCE_PHONE_DISCOVERY_VIBRATE, true); 56 | if (vibrate) { 57 | v.vibrate(discoveryVibration, 0); 58 | } 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/notifications/model/AbstractNotification.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.notifications.model; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by krzysiek on 24/07/15. 8 | */ 9 | public class AbstractNotification implements Notification { 10 | 11 | private String id; 12 | private NotificationType type; 13 | private NotificationCategory category; 14 | private String application; 15 | private Date date; 16 | private Integer externalId; 17 | private List operations; 18 | private Object notificationObject; 19 | 20 | public AbstractNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, Object notificationObject) { 21 | this.id = id; 22 | this.type = type; 23 | this.category = category; 24 | this.application = application; 25 | this.date = date; 26 | this.operations = operations; 27 | this.notificationObject = notificationObject; 28 | } 29 | 30 | public AbstractNotification(String id, NotificationType type, NotificationCategory category, String application, Date date, List operations, Object notificationObject, Integer externalId) { 31 | this.id = id; 32 | this.type = type; 33 | this.category = category; 34 | this.application = application; 35 | this.date = date; 36 | this.operations = operations; 37 | this.notificationObject = notificationObject; 38 | this.externalId = externalId; 39 | } 40 | 41 | @Override 42 | public String getId() { 43 | return id; 44 | } 45 | 46 | @Override 47 | public NotificationType getType() { 48 | return type; 49 | } 50 | 51 | public NotificationCategory getCategory() { 52 | return category; 53 | } 54 | 55 | public String getApplication() { 56 | return application; 57 | } 58 | 59 | public List getOperations() { 60 | return operations; 61 | } 62 | 63 | public Date getDate() { 64 | return date; 65 | } 66 | 67 | public Integer getExternalId() { 68 | return externalId; 69 | } 70 | 71 | public void setExternalId(Integer externalId) { 72 | this.externalId = externalId; 73 | } 74 | 75 | public Object getNotificationObject() { 76 | return notificationObject; 77 | } 78 | 79 | @Override 80 | public String toString() { 81 | return "AbstractNotification{" + 82 | "id='" + id + '\'' + 83 | ", type=" + type + 84 | ", category=" + category + 85 | ", application='" + application + '\'' + 86 | ", date=" + date + 87 | ", externalId=" + externalId + 88 | ", operations=" + operations + 89 | '}'; 90 | } 91 | 92 | @Override 93 | public int compareTo(Notification another) { 94 | return -date.compareTo(another.getDate()); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 20 | 21 | 27 | 28 | 37 | 38 | 44 | 45 | 53 | 54 | 62 | 63 | 64 | 65 | 66 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/althink/android/ossw/settings/TimeIntervalPreference.java: -------------------------------------------------------------------------------- 1 | package com.althink.android.ossw.settings; 2 | 3 | /** 4 | * Created by Pavel on 23/12/2015. 5 | */ 6 | 7 | import android.content.Context; 8 | import android.content.res.TypedArray; 9 | import android.support.v7.preference.DialogPreference; 10 | import android.util.AttributeSet; 11 | 12 | public class TimeIntervalPreference extends DialogPreference { 13 | 14 | int fromLastHour; 15 | int fromLastMinute; 16 | int tillLastHour; 17 | int tillLastMinute; 18 | 19 | public TimeIntervalPreference(Context ctx, AttributeSet attrs) { 20 | super(ctx, attrs); 21 | setPositiveButtonText(ctx.getString(android.R.string.ok)); 22 | setNegativeButtonText(ctx.getString(android.R.string.cancel)); 23 | } 24 | 25 | @Override 26 | protected Object onGetDefaultValue(TypedArray a, int index) { 27 | return a.getString(index); 28 | } 29 | 30 | @Override 31 | protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { 32 | String time; 33 | if (restoreValue) { 34 | if (defaultValue == null) 35 | defaultValue = "00:00-23:59"; 36 | try { 37 | time = getPersistedString(defaultValue.toString()); 38 | } catch (ClassCastException e) { 39 | e.printStackTrace(); 40 | time = defaultValue.toString(); 41 | } 42 | } else { 43 | time = defaultValue.toString(); 44 | } 45 | String[] times = time.split("-"); 46 | if (times.length == 2) { 47 | fromLastHour = getHour(times[0], 0); 48 | fromLastMinute = getMinute(times[0], 0); 49 | tillLastHour = getHour(times[1], 23); 50 | tillLastMinute = getMinute(times[1], 59); 51 | } else { 52 | fromLastHour = 0; 53 | fromLastMinute = 0; 54 | tillLastHour = 23; 55 | tillLastMinute = 59; 56 | } 57 | setSummary(getSummary()); 58 | } 59 | 60 | public static int getHour(String time, int defaultVal) { 61 | String[] pieces = time.split(":"); 62 | int result = defaultVal; 63 | try { 64 | if (pieces.length == 2) 65 | result = Integer.parseInt(pieces[0]); 66 | } catch (NumberFormatException e) { 67 | e.printStackTrace(); 68 | } 69 | return result; 70 | } 71 | 72 | public static int getMinute(String time, int defaultVal) { 73 | String[] pieces = time.split(":"); 74 | int result = defaultVal; 75 | try { 76 | if (pieces.length == 2) 77 | result = Integer.parseInt(pieces[1]); 78 | } catch (NumberFormatException e) { 79 | e.printStackTrace(); 80 | } 81 | return result; 82 | } 83 | 84 | @Override 85 | public CharSequence getSummary() { 86 | return padded(fromLastHour) + ':' + padded(fromLastMinute) + '-' 87 | + padded(tillLastHour) + ':' + padded(tillLastMinute); 88 | } 89 | 90 | public static String padded(int i) { 91 | String s = String.valueOf(i); 92 | return (i < 10) ? "0" + s : s; 93 | } 94 | 95 | public void persistStringValue(String value) { 96 | persistString(value); 97 | } 98 | } --------------------------------------------------------------------------------