├── myJot ├── .gitignore ├── debug.keystore ├── ted_android.jks ├── myJot-release.apk ├── src │ ├── assets │ │ └── fonts │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ ├── RobotoSlab-Light.ttf │ │ │ ├── RobotoSlab-Thin.ttf │ │ │ └── RobotoSlab-Regular.ttf │ └── main │ │ ├── res │ │ ├── drawable-xxhdpi │ │ │ ├── pin.png │ │ │ ├── set.png │ │ │ ├── skip.png │ │ │ ├── close.png │ │ │ ├── delete.png │ │ │ ├── history.png │ │ │ ├── share.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_arrow_back_white_24dp.png │ │ ├── drawable │ │ │ ├── widgetpreview.png │ │ │ ├── widgetpreviewfourxone.png │ │ │ ├── widgetpreviewfourxtwo.png │ │ │ ├── widgetpreviewonexone.png │ │ │ ├── widgetpreviewfourxfour.png │ │ │ ├── widgetpreviewfourxthree.png │ │ │ ├── widget_bg_red.xml │ │ │ ├── widget_bg_blue.xml │ │ │ ├── widget_bg_green.xml │ │ │ ├── widget_bg_default.xml │ │ │ ├── btn_background_pressed.xml │ │ │ └── btn_background.xml │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_action_new.png │ │ │ ├── ic_launcher.png │ │ │ └── main_menu_bg.9.png │ │ ├── values │ │ │ ├── integers.xml │ │ │ ├── attrs.xml │ │ │ ├── dimens.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── anim │ │ │ ├── anim_interpolator_fragment.xml │ │ │ ├── popwindow_fade_out.xml │ │ │ ├── popwindow_fade_in.xml │ │ │ ├── anim_fragment_out.xml │ │ │ ├── anim_fragment_close_in.xml │ │ │ ├── anim_fragment_close_out.xml │ │ │ └── anim_fragment_in.xml │ │ ├── values-sw400dp │ │ │ ├── styles.xml │ │ │ └── dimen.xml │ │ ├── values-sw360dp │ │ │ ├── dimen.xml │ │ │ └── styles.xml │ │ ├── values-sw600dp │ │ │ └── styles.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── color │ │ │ └── dialog_button_selector.xml │ │ ├── xml │ │ │ ├── widget_fourxone.xml │ │ │ ├── widget_onexone.xml │ │ │ ├── widget_fourxfour.xml │ │ │ ├── widget_fourxtwo.xml │ │ │ ├── widget_fourxthree.xml │ │ │ └── setting_pref.xml │ │ ├── layout │ │ │ ├── widgetlayout_fourxfour.xml │ │ │ ├── activity_setting.xml │ │ │ ├── widgetlayout_fourxone.xml │ │ │ ├── widgetlayout_onexone.xml │ │ │ ├── widgetlayout_fourxthree.xml │ │ │ ├── widgetlayout_fourxtwo.xml │ │ │ ├── color_picker_layout.xml │ │ │ └── activity_main.xml │ │ ├── values-en │ │ │ └── strings.xml │ │ ├── values-en-rUS │ │ │ └── strings.xml │ │ └── values-zh-rCN │ │ │ └── strings.xml │ │ ├── java │ │ └── com │ │ │ └── ted │ │ │ └── jots │ │ │ └── myjot │ │ │ ├── data │ │ │ ├── DataModel.java │ │ │ └── DataManager.java │ │ │ ├── utils │ │ │ ├── CheckDoubleClick.java │ │ │ └── SystemUtil.java │ │ │ ├── view │ │ │ ├── colorpickerview │ │ │ │ ├── view │ │ │ │ │ ├── DrawingUtils.java │ │ │ │ │ └── ColorPanelView.java │ │ │ │ └── drawable │ │ │ │ │ └── AlphaPatternDrawable.java │ │ │ └── behavior │ │ │ │ ├── CustomFrameLayout.java │ │ │ │ └── MoveUpwardBehavior.java │ │ │ ├── widget │ │ │ ├── WidgetForFourXOne.java │ │ │ ├── WidgetForOneXOne.java │ │ │ ├── WidgetForFourXTwo.java │ │ │ ├── WidgetForFourXFour.java │ │ │ ├── WidgetForFourXThree.java │ │ │ └── BaseAppWidgetProvider.java │ │ │ ├── setting │ │ │ ├── CommonDialogPreference.java │ │ │ ├── SettingActivity.java │ │ │ ├── ColorPickerPreference.java │ │ │ ├── SingleDialogFragment.java │ │ │ ├── CommonDialogFragment.java │ │ │ ├── ColorPickerPreDlgFragCompat.java │ │ │ └── SettingFragment.java │ │ │ ├── config │ │ │ └── ConfigManager.java │ │ │ ├── main │ │ │ ├── MainPresenter.java │ │ │ ├── MainMenuHelper.java │ │ │ ├── ReceiveDataActivity.java │ │ │ └── MainActivity.java │ │ │ ├── listener │ │ │ └── MobileShakeListener.java │ │ │ └── service │ │ │ └── WatchingService.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro ├── build.gradle ├── manifest-merger-release-report.txt └── myJot.iml ├── library ├── .gitignore ├── gradle.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── fab_add.png │ │ ├── drawable-mdpi │ │ │ └── fab_add.png │ │ ├── drawable-xhdpi │ │ │ └── fab_add.png │ │ ├── drawable-xxhdpi │ │ │ └── fab_add.png │ │ ├── values │ │ │ ├── ids.xml │ │ │ ├── dimens.xml │ │ │ └── attrs.xml │ │ └── anim │ │ │ ├── fab_scale_up.xml │ │ │ ├── fab_scale_down.xml │ │ │ ├── fab_slide_in_from_left.xml │ │ │ ├── fab_slide_in_from_right.xml │ │ │ ├── fab_slide_out_to_left.xml │ │ │ └── fab_slide_out_to_right.xml │ │ └── java │ │ └── com │ │ └── github │ │ └── clans │ │ └── fab │ │ └── Util.java ├── build.gradle ├── proguard-rules.pro └── library.iml ├── .gitignore ├── settings.gradle ├── .gradle └── 2.14.1 │ ├── taskArtifacts │ ├── cache.properties │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── taskArtifacts.bin │ ├── cache.properties.lock │ └── fileSnapshotsToTreeSnapshotsIndex.bin │ └── tasks │ ├── _myJot_compileDebugJavaWithJavac │ ├── localClassSetAnalysis │ │ ├── localClassSetAnalysis.bin │ │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ │ ├── localJarClasspathSnapshot.bin │ │ └── localJarClasspathSnapshot.lock │ ├── _library_compileDebugJavaWithJavac │ ├── localClassSetAnalysis │ │ ├── localClassSetAnalysis.bin │ │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ │ ├── localJarClasspathSnapshot.bin │ │ └── localJarClasspathSnapshot.lock │ ├── _myJot_compileReleaseJavaWithJavac │ ├── localClassSetAnalysis │ │ ├── localClassSetAnalysis.bin │ │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ │ ├── localJarClasspathSnapshot.bin │ │ └── localJarClasspathSnapshot.lock │ └── _library_compileReleaseJavaWithJavac │ ├── localClassSetAnalysis │ ├── localClassSetAnalysis.bin │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ ├── localJarClasspathSnapshot.bin │ └── localJarClasspathSnapshot.lock ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── ScreenShot ├── myJot-release_2.2_0617.apk ├── Screenshot_2015-06-17-17-41-44.png ├── Screenshot_2015-06-17-17-43-35.png ├── Screenshot_2015-06-17-17-44-05.png ├── Screenshot_2015-06-17-17-44-28.png └── Screenshot_2015-06-17-17-45-44.png ├── README.md ├── local.properties ├── OneNote.iml ├── gradlew.bat ├── manifest-merger-release-report.txt ├── gradlew └── LICENSE /myJot/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /.idea 3 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':myJot' 2 | include ':library' 3 | -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 22 10:58:41 CST 2016 2 | -------------------------------------------------------------------------------- /myJot/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/debug.keystore -------------------------------------------------------------------------------- /myJot/ted_android.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/ted_android.jks -------------------------------------------------------------------------------- /myJot/myJot-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/myJot-release.apk -------------------------------------------------------------------------------- /library/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Floating Action Button Library 2 | POM_ARTIFACT_ID=fab 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ScreenShot/myJot-release_2.2_0617.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/myJot-release_2.2_0617.apk -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /myJot/src/assets/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/assets/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /myJot/src/assets/fonts/RobotoSlab-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/assets/fonts/RobotoSlab-Light.ttf -------------------------------------------------------------------------------- /myJot/src/assets/fonts/RobotoSlab-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/assets/fonts/RobotoSlab-Thin.ttf -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/pin.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/set.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/skip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/skip.png -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /ScreenShot/Screenshot_2015-06-17-17-41-44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/Screenshot_2015-06-17-17-41-44.png -------------------------------------------------------------------------------- /ScreenShot/Screenshot_2015-06-17-17-43-35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/Screenshot_2015-06-17-17-43-35.png -------------------------------------------------------------------------------- /ScreenShot/Screenshot_2015-06-17-17-44-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/Screenshot_2015-06-17-17-44-05.png -------------------------------------------------------------------------------- /ScreenShot/Screenshot_2015-06-17-17-44-28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/Screenshot_2015-06-17-17-44-28.png -------------------------------------------------------------------------------- /ScreenShot/Screenshot_2015-06-17-17-45-44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/ScreenShot/Screenshot_2015-06-17-17-45-44.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/fab_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/library/src/main/res/drawable-hdpi/fab_add.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/fab_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/library/src/main/res/drawable-mdpi/fab_add.png -------------------------------------------------------------------------------- /myJot/src/assets/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/assets/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/close.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/delete.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/history.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/share.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreview.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/fab_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/library/src/main/res/drawable-xhdpi/fab_add.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/fab_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/library/src/main/res/drawable-xxhdpi/fab_add.png -------------------------------------------------------------------------------- /library/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xhdpi/ic_action_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xhdpi/ic_action_new.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xhdpi/main_menu_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xhdpi/main_menu_bg.9.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreviewfourxone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreviewfourxone.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreviewfourxtwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreviewfourxtwo.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreviewonexone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreviewonexone.png -------------------------------------------------------------------------------- /myJot/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 350 4 | 5 | -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreviewfourxfour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreviewfourxfour.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widgetpreviewfourxthree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable/widgetpreviewfourxthree.png -------------------------------------------------------------------------------- /myJot/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/myJot/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin -------------------------------------------------------------------------------- /myJot/src/main/res/anim/anim_interpolator_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widget_bg_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-sw400dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 56dp 5 | 40dp 6 | 14sp 7 | 8 | -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widget_bg_blue.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widget_bg_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-sw400dp/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 70dp 5 | 40dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_myJot_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/widget_bg_default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-sw360dp/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 65dp 5 | 40dp 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-sw600dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongwei-git/OneNote/HEAD/.gradle/2.14.1/tasks/_library_compileReleaseJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /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.14.1-all.zip 7 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-sw360dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneNote 2 | 烂笔头应用的源码,下载地址 http://www.wandoujia.com/apps/com.ted.jots.myjot 3 | 4 | # ScreenShot 5 | ![img](https://github.com/xiongwei-git/OneNote/blob/master/ScreenShot/Screenshot_2015-06-17-17-44-05.png) 6 | 7 | ![img](https://github.com/xiongwei-git/OneNote/blob/master/ScreenShot/Screenshot_2015-06-17-17-44-28.png) 8 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/popwindow_fade_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/popwindow_fade_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/anim_fragment_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/anim_fragment_close_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/anim_fragment_close_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_scale_up.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/data/DataModel.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.data; 2 | 3 | /** 4 | * Created by Ted on 2015/2/14. 5 | * DataModel 6 | */ 7 | public class DataModel { 8 | 9 | private String content; 10 | 11 | public String getContent() { 12 | return content; 13 | } 14 | 15 | public void setContent(String content) { 16 | this.content = content; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_scale_down.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /myJot/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/utils/CheckDoubleClick.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.utils; 2 | 3 | public class CheckDoubleClick { 4 | private static long lastClickTime = 0; 5 | 6 | public static boolean isFastDoubleClick() { 7 | long time = System.currentTimeMillis(); 8 | long timeD = time - lastClickTime; 9 | if (0 < timeD && timeD < 500) { 10 | return true; 11 | } 12 | lastClickTime = time; 13 | return false; 14 | } 15 | } -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/btn_background_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_slide_in_from_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_slide_in_from_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_slide_out_to_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /library/src/main/res/anim/fab_slide_out_to_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 12 | -------------------------------------------------------------------------------- /myJot/src/main/res/color/dialog_button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Wed Dec 21 20:50:06 CST 2016 11 | sdk.dir=/Users/ted/Library/Android/sdk 12 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/widget_fourxone.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/widget_onexone.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/widget_fourxfour.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/widget_fourxtwo.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/widget_fourxthree.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /myJot/src/main/res/drawable/btn_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /myJot/src/main/res/anim/anim_fragment_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion getProject().compileSdkVersion 5 | buildToolsVersion getProject().buildToolsVersion 6 | 7 | defaultConfig { 8 | minSdkVersion getProject().minSdkVersion 9 | targetSdkVersion getProject().targetSdkVersion 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | compile fileTree(dir: 'libs', include: ['*.jar']) 22 | } 23 | -------------------------------------------------------------------------------- /library/src/main/java/com/github/clans/fab/Util.java: -------------------------------------------------------------------------------- 1 | package com.github.clans.fab; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | 6 | final class Util { 7 | 8 | private Util() { 9 | } 10 | 11 | static int dpToPx(Context context, float dp) { 12 | final float scale = context.getResources().getDisplayMetrics().density; 13 | return Math.round(dp * scale); 14 | } 15 | 16 | static boolean hasJellyBean() { 17 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; 18 | } 19 | 20 | static boolean hasLollipop() { 21 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /myJot/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 48dp 6 | 118dp 7 | 8 | 0dp 9 | 230dp 10 | 6dp 11 | 12 | 65dp 13 | 32dp 14 | 15 | 16 | -------------------------------------------------------------------------------- /library/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 D:/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 | -------------------------------------------------------------------------------- /myJot/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 C:/adt-bundle-windows-x86_64-20140702/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 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/utils/SystemUtil.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.utils; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.inputmethod.InputMethodManager; 6 | 7 | /** 8 | * 系统功能调用工具类 9 | * 10 | * @author ted 11 | */ 12 | public final class SystemUtil { 13 | 14 | 15 | public static void HideSoftInput(Activity activity) { 16 | if(null == activity || activity.getCurrentFocus() == null){ 17 | return; 18 | } 19 | InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); 20 | inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/view/colorpickerview/view/DrawingUtils.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.view.colorpickerview.view; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | import android.util.TypedValue; 6 | 7 | public class DrawingUtils { 8 | 9 | public static int dpToPx(Context c, float dipValue) { 10 | DisplayMetrics metrics = c.getResources().getDisplayMetrics(); 11 | 12 | float val = TypedValue.applyDimension( 13 | TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics); 14 | 15 | // Round 16 | int res = (int)(val + 0.5); 17 | 18 | // Ensure at least 1 pixel if val was > 0 19 | if(res == 0 && val > 0) { 20 | res = 1; 21 | } 22 | 23 | return res; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/view/behavior/CustomFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.view.behavior; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.util.AttributeSet; 6 | import android.widget.FrameLayout; 7 | 8 | /** 9 | * Created by ted on 2016/12/23. 10 | * in com.ted.jots.myjot.view.behavior 11 | */ 12 | 13 | @CoordinatorLayout.DefaultBehavior(MoveUpwardBehavior.class) 14 | public class CustomFrameLayout extends FrameLayout { 15 | public CustomFrameLayout(Context context) { 16 | super(context); 17 | } 18 | 19 | public CustomFrameLayout(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | } 22 | 23 | public CustomFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { 24 | super(context, attrs, defStyleAttr); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/WidgetForFourXOne.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.widget.RemoteViews; 6 | 7 | import com.ted.jots.myjot.R; 8 | 9 | /** 10 | * Created by Ted on 2015/2/14. 11 | * WidgetForFourXOne 12 | */ 13 | public class WidgetForFourXOne extends BaseAppWidgetProvider { 14 | @Override 15 | public ComponentName getWidgetComponentName(Context context) { 16 | return new ComponentName(context, WidgetForFourXOne.class); 17 | } 18 | 19 | @Override 20 | public RemoteViews getWidgetRemoteViews(Context context) { 21 | return new RemoteViews(context.getPackageName(), R.layout.widgetlayout_fourxone); 22 | } 23 | 24 | @Override 25 | public int getClickViewId() { 26 | return R.id.widget_layout_4_1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/WidgetForOneXOne.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.widget.RemoteViews; 6 | 7 | import com.ted.jots.myjot.R; 8 | 9 | /** 10 | * Created by Ted on 2015/2/14. 11 | * WidgetForOneXOne 12 | */ 13 | public class WidgetForOneXOne extends BaseAppWidgetProvider { 14 | @Override 15 | public ComponentName getWidgetComponentName(Context context) { 16 | return new ComponentName(context, WidgetForOneXOne.class); 17 | } 18 | 19 | @Override 20 | public RemoteViews getWidgetRemoteViews(Context context) { 21 | return new RemoteViews(context.getPackageName(), R.layout.widgetlayout_onexone); 22 | } 23 | 24 | @Override 25 | public int getClickViewId() { 26 | return R.id.widget_layout_1_1; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/WidgetForFourXTwo.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.widget.RemoteViews; 6 | 7 | import com.ted.jots.myjot.R; 8 | 9 | /** 10 | * Created by Ted on 2015/2/14. 11 | * WidgetForFourXTwo 12 | */ 13 | public class WidgetForFourXTwo extends BaseAppWidgetProvider { 14 | @Override 15 | public ComponentName getWidgetComponentName(Context context) { 16 | return new ComponentName(context, WidgetForFourXTwo.class); 17 | } 18 | 19 | @Override 20 | public RemoteViews getWidgetRemoteViews(Context context) { 21 | return new RemoteViews(context.getPackageName(), R.layout.widgetlayout_fourxtwo); 22 | } 23 | 24 | @Override 25 | public int getClickViewId() { 26 | return R.id.widget_layout_4_2; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/WidgetForFourXFour.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.widget.RemoteViews; 6 | 7 | import com.ted.jots.myjot.R; 8 | 9 | 10 | /** 11 | * Created by Ted on 2015/2/14. 12 | * WidgetForFourXFour 13 | */ 14 | public class WidgetForFourXFour extends BaseAppWidgetProvider { 15 | 16 | @Override 17 | public ComponentName getWidgetComponentName(Context context) { 18 | return new ComponentName(context, WidgetForFourXFour.class); 19 | } 20 | 21 | @Override 22 | public RemoteViews getWidgetRemoteViews(Context context) { 23 | return new RemoteViews(context.getPackageName(), R.layout.widgetlayout_fourxfour); 24 | } 25 | 26 | @Override 27 | public int getClickViewId() { 28 | return R.id.widget_layout_4_4; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/WidgetForFourXThree.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.content.ComponentName; 4 | import android.content.Context; 5 | import android.widget.RemoteViews; 6 | 7 | import com.ted.jots.myjot.R; 8 | 9 | /** 10 | * Created by Ted on 2015/2/14. 11 | * WidgetForFourXThree 12 | */ 13 | public class WidgetForFourXThree extends BaseAppWidgetProvider { 14 | @Override 15 | public ComponentName getWidgetComponentName(Context context) { 16 | return new ComponentName(context, WidgetForFourXThree.class); 17 | } 18 | 19 | @Override 20 | public RemoteViews getWidgetRemoteViews(Context context) { 21 | return new RemoteViews(context.getPackageName(), R.layout.widgetlayout_fourxthree); 22 | } 23 | 24 | @Override 25 | public int getClickViewId() { 26 | return R.id.widget_layout_4_3; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/widgetlayout_fourxfour.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/activity_setting.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/widgetlayout_fourxone.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/widgetlayout_onexone.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/widgetlayout_fourxthree.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/widgetlayout_fourxtwo.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 22 | 23 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/CommonDialogPreference.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.content.Context; 4 | import android.support.v7.preference.DialogPreference; 5 | import android.util.AttributeSet; 6 | 7 | /** 8 | * Created by ted on 2016/12/27. 9 | * in com.ted.jots.myjot.setting 10 | */ 11 | 12 | public class CommonDialogPreference extends DialogPreference { 13 | 14 | public CommonDialogPreference(Context context) { 15 | super(context); 16 | } 17 | 18 | public CommonDialogPreference(Context context, AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | public CommonDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) { 23 | super(context, attrs, defStyleAttr); 24 | } 25 | 26 | public CommonDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 27 | super(context, attrs, defStyleAttr, defStyleRes); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /OneNote.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/view/behavior/MoveUpwardBehavior.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.view.behavior; 2 | 3 | import android.os.Build; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.support.design.widget.Snackbar; 6 | import android.view.View; 7 | 8 | /** 9 | * Created by ted on 2016/12/23. 10 | * in com.ted.jots.myjot.view.behavior 11 | */ 12 | 13 | public class MoveUpwardBehavior extends CoordinatorLayout.Behavior { 14 | private static final boolean SNACKBAR_BEHAVIOR_ENABLED; 15 | 16 | @Override 17 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { 18 | return SNACKBAR_BEHAVIOR_ENABLED && dependency instanceof Snackbar.SnackbarLayout; 19 | } 20 | 21 | @Override 22 | public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { 23 | float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight()); 24 | child.setTranslationY(translationY); 25 | return true; 26 | } 27 | 28 | static { 29 | SNACKBAR_BEHAVIOR_ENABLED = Build.VERSION.SDK_INT >= 11; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/SettingActivity.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | 8 | import com.ted.jots.myjot.R; 9 | 10 | /** 11 | * Created by ted on 2016/12/24. 12 | * in com.ted.jots.myjot.setting 13 | */ 14 | 15 | public class SettingActivity extends AppCompatActivity { 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_setting); 21 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 22 | setSupportActionBar(toolbar); 23 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 24 | @Override 25 | public void onClick(View v) { 26 | finish(); 27 | } 28 | }); 29 | if(null != getSupportActionBar()) 30 | getSupportActionBar().setTitle(R.string.setting); 31 | if (null == savedInstanceState) 32 | getSupportFragmentManager().beginTransaction().add( 33 | R.id.setting_fragment_container, new SettingFragment()).commit(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/data/DataManager.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.data; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.text.TextUtils; 6 | 7 | import com.ted.jots.myjot.config.ConfigManager; 8 | 9 | /** 10 | * Created by Ted on 2015/2/14. 11 | * DataManager 12 | */ 13 | public class DataManager { 14 | 15 | private static final String KEY_FOR_SP_CONTENT = "com_ted_my_jots_content"; 16 | 17 | public static DataModel readData(Context context) { 18 | DataModel model = new DataModel(); 19 | String data = getLastVersionData(context); 20 | if (TextUtils.isEmpty(data)) 21 | data = ConfigManager.getSharedPreferences(context).getString(KEY_FOR_SP_CONTENT, ""); 22 | model.setContent(data); 23 | return model; 24 | } 25 | 26 | 27 | public static void writeData(Context context, DataModel model) { 28 | if (null == model) return; 29 | String date = model.getContent(); 30 | if (TextUtils.isEmpty(date)) date = ""; 31 | SharedPreferences.Editor editor = ConfigManager.getSharedPreferences(context).edit(); 32 | editor.putString(KEY_FOR_SP_CONTENT, date); 33 | editor.apply(); 34 | } 35 | 36 | private static String getLastVersionData(Context context) { 37 | SharedPreferences sp = context.getSharedPreferences("sp_for_com_ted_my_jots", Context.MODE_PRIVATE); 38 | if (sp.getBoolean("hasReadLastVersion", false)) { 39 | return ""; 40 | } 41 | sp.edit().putBoolean("hasReadLastVersion", true).apply(); 42 | return sp.getString(KEY_FOR_SP_CONTENT, ""); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/ColorPickerPreference.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.support.v7.preference.DialogPreference; 6 | import android.util.AttributeSet; 7 | 8 | import com.ted.jots.myjot.R; 9 | 10 | /** 11 | * Created by ted on 2016/12/27. 12 | * in com.ted.jots.myjot.setting 13 | */ 14 | 15 | public class ColorPickerPreference extends DialogPreference { 16 | 17 | private int mColor; 18 | 19 | public ColorPickerPreference(Context context) { 20 | this(context, null); 21 | } 22 | 23 | public ColorPickerPreference(Context context, AttributeSet attrs) { 24 | this(context, attrs, R.attr.preferenceStyle); 25 | } 26 | 27 | public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr) { 28 | this(context, attrs, defStyleAttr, defStyleAttr); 29 | 30 | } 31 | 32 | public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 33 | super(context, attrs, defStyleAttr, defStyleRes); 34 | } 35 | 36 | public int getColor() { 37 | return mColor; 38 | } 39 | 40 | public void setColor(int color) { 41 | mColor = color; 42 | persistInt(color); 43 | } 44 | 45 | @Override 46 | protected Object onGetDefaultValue(TypedArray a, int index) { 47 | return a.getInt(index, 0); 48 | } 49 | 50 | @Override 51 | public int getDialogLayoutResource() { 52 | return R.layout.color_picker_layout; 53 | } 54 | 55 | 56 | @Override 57 | protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) { 58 | setColor(restorePersistedValue ? getPersistedInt(mColor) : (int) defaultValue); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/SingleDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.annotation.NonNull; 7 | import android.support.v4.app.DialogFragment; 8 | import android.support.v7.app.AlertDialog; 9 | import android.support.v7.preference.Preference; 10 | 11 | import com.ted.jots.myjot.R; 12 | 13 | /** 14 | * Created by ted on 2016/12/27. 15 | * in com.ted.jots.myjot.setting 16 | */ 17 | 18 | public class SingleDialogFragment extends DialogFragment { 19 | //private String mDialogPreferenceKey; 20 | 21 | public static SingleDialogFragment newIns(Preference preference) { 22 | SingleDialogFragment ins = new SingleDialogFragment(); 23 | Bundle args = new Bundle(); 24 | CommonDialogPreference dialogPreference = (CommonDialogPreference) preference; 25 | args.putString("title", dialogPreference.getDialogTitle().toString()); 26 | args.putString("msg", dialogPreference.getDialogMessage().toString()); 27 | args.putString("neutral", dialogPreference.getPositiveButtonText().toString()); 28 | args.putString("key", dialogPreference.getKey()); 29 | ins.setArguments(args); 30 | return ins; 31 | } 32 | 33 | 34 | @NonNull 35 | @Override 36 | public Dialog onCreateDialog(Bundle savedInstanceState) { 37 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 38 | builder.setTitle(getArguments().getString("title", "")); 39 | builder.setMessage(getArguments().getString("msg", "")); 40 | builder.setNeutralButton(getArguments().getString("neutral", getString(R.string.i_see)), null); 41 | return builder.create(); 42 | } 43 | 44 | @Override 45 | public void onAttach(Context context) { 46 | super.onAttach(context); 47 | //mDialogPreferenceKey = getArguments().getString("key", ""); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /myJot/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 18 | 19 | 27 | 28 | 30 | 31 | 32 | 35 | 36 | 37 | 39 | 40 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /myJot/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:2.2.3' 7 | } 8 | } 9 | apply plugin: 'com.android.application' 10 | 11 | repositories { 12 | jcenter() 13 | } 14 | 15 | android { 16 | compileSdkVersion getProject().compileSdkVersion 17 | buildToolsVersion getProject().buildToolsVersion 18 | 19 | lintOptions { 20 | abortOnError false 21 | } 22 | 23 | packagingOptions { 24 | exclude 'META-INF/license.txt' 25 | exclude 'META-INF/notice.txt' 26 | exclude 'META-INF/LICENSE' 27 | exclude 'META-INF/NOTICE' 28 | } 29 | 30 | defaultConfig { 31 | applicationId "com.ted.jots.myjot" 32 | minSdkVersion getProject().minSdkVersion 33 | targetSdkVersion getProject().targetSdkVersion 34 | versionCode getProject().versionCode 35 | versionName getProject().versionName 36 | } 37 | 38 | signingConfigs { 39 | 40 | debug { 41 | storeFile file("debug.keystore") 42 | } 43 | 44 | release { 45 | storeFile file("ted_android.jks") 46 | storePassword "xiongwei" 47 | keyAlias "ted_android" 48 | keyPassword "xiongwei" 49 | v2SigningEnabled false 50 | } 51 | } 52 | 53 | compileOptions { 54 | sourceCompatibility JavaVersion.VERSION_1_7 55 | targetCompatibility JavaVersion.VERSION_1_7 56 | } 57 | 58 | buildTypes { 59 | release { 60 | minifyEnabled true 61 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 62 | signingConfig signingConfigs.release 63 | } 64 | } 65 | } 66 | 67 | 68 | dependencies { 69 | compile fileTree(dir: 'libs', include: ['*.jar']) 70 | compile project(':library') 71 | compile "com.android.support:appcompat-v7:25.1.0" 72 | compile "com.android.support:design:25.1.0" 73 | compile 'com.android.support:preference-v7:25.1.0' 74 | compile 'com.android.support:preference-v14:25.1.0' 75 | } -------------------------------------------------------------------------------- /myJot/src/main/res/layout/color_picker_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 27 | 28 | 33 | 34 | 43 | 44 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /myJot/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 25 | 26 | 30 | 31 | 42 | 43 | 44 | 45 | 46 | 47 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/config/ConfigManager.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.config; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.support.v7.preference.PreferenceManager; 6 | import android.text.TextUtils; 7 | 8 | import com.ted.jots.myjot.R; 9 | 10 | /** 11 | * Created by Ted on 2015/2/15. 12 | * ConfigManager 13 | */ 14 | public class ConfigManager { 15 | public static final int DEFAULT_ARGB_COLOR = 0xcc1a1a1a; 16 | public static final int DEFAULT_TEXT_COLOR = 0xffffffff; 17 | public static final int DEFAULT_HINT_COLOR = 0xff3ba3f8; 18 | private static final String KEY_FOR_SP_USE_MENU = "com_ted_my_jots_use_menu"; 19 | 20 | 21 | public static SharedPreferences getSharedPreferences(Context context) { 22 | return PreferenceManager.getDefaultSharedPreferences(context); 23 | } 24 | 25 | public static boolean hasUseMenu(Context context) { 26 | return getSharedPreferences(context).getBoolean(KEY_FOR_SP_USE_MENU, false); 27 | } 28 | 29 | public static void useMenu(Context context) { 30 | SharedPreferences.Editor editor = getSharedPreferences(context).edit(); 31 | editor.putBoolean(KEY_FOR_SP_USE_MENU, true); 32 | editor.apply(); 33 | } 34 | 35 | 36 | public static int getConfigAppBgColor(Context context) { 37 | int defaultColor = DEFAULT_ARGB_COLOR; 38 | int configColor = getSharedPreferences(context).getInt(context.getString(R.string.edit_page_color_key), -1); 39 | if (configColor == -1) configColor = defaultColor; 40 | return configColor; 41 | } 42 | 43 | public static int getConfigAppTxtColor(Context context) { 44 | int defaultColor = DEFAULT_TEXT_COLOR; 45 | int configColor = getSharedPreferences(context).getInt(context.getString(R.string.font_color_key), -1); 46 | if (configColor == -1) configColor = defaultColor; 47 | return configColor; 48 | } 49 | 50 | public static int getConfigWidgetBgColor(Context context) { 51 | return getConfigAppBgColor(context); 52 | } 53 | 54 | public static boolean getSupportListenClipboard(Context context) { 55 | return getSharedPreferences(context).getBoolean(context.getString(R.string.is_support_clipboard_key), true); 56 | } 57 | 58 | public static long getConfigListenClipboardTime(Context context) { 59 | String value = getSharedPreferences(context).getString(context.getString(R.string.listen_clipboard_time_key), "1"); 60 | if (TextUtils.isEmpty(value)) value = "1"; 61 | int second = 15; 62 | switch (value) { 63 | case "0": 64 | second = 5; 65 | break; 66 | case "1": 67 | second = 15; 68 | break; 69 | case "2": 70 | second = 30; 71 | break; 72 | case "3": 73 | second = 120; 74 | break; 75 | default: 76 | break; 77 | } 78 | return 1000L * second; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/main/MainPresenter.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.main; 2 | 3 | import android.app.Activity; 4 | import android.content.ActivityNotFoundException; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.net.Uri; 8 | import android.text.TextUtils; 9 | import android.widget.Toast; 10 | 11 | import com.ted.jots.myjot.R; 12 | import com.ted.jots.myjot.widget.WidgetForFourXFour; 13 | import com.ted.jots.myjot.widget.WidgetForFourXOne; 14 | import com.ted.jots.myjot.widget.WidgetForFourXThree; 15 | import com.ted.jots.myjot.widget.WidgetForFourXTwo; 16 | import com.ted.jots.myjot.widget.WidgetForOneXOne; 17 | 18 | /** 19 | * Created by ted on 2016/12/23. 20 | * in com.ted.jots.myjot.main 21 | */ 22 | 23 | public class MainPresenter { 24 | 25 | public static void onShare(Context context, String content) { 26 | if (TextUtils.isEmpty(content)) return; 27 | Intent intent = new Intent(); 28 | intent.setAction("android.intent.action.SEND"); 29 | intent.putExtra("android.intent.extra.TEXT", content); 30 | intent.setType("text/plain"); 31 | context.startActivity(intent); 32 | } 33 | 34 | public static void onShareApp(Context context) { 35 | String content = context.getString(R.string.share_app_description); 36 | Intent intent = new Intent(); 37 | intent.setAction("android.intent.action.SEND"); 38 | intent.putExtra("android.intent.extra.TEXT", content); 39 | intent.setType("text/plain"); 40 | context.startActivity(intent); 41 | } 42 | 43 | public static void onTanksDeveloper(Activity activity) { 44 | Uri uri = Uri.parse("market://details?id=" + activity.getPackageName()); 45 | Intent intent = new Intent(Intent.ACTION_VIEW, uri); 46 | try { 47 | activity.startActivity(intent); 48 | } catch (ActivityNotFoundException e) { 49 | Toast.makeText(activity, R.string.no_market_tips, Toast.LENGTH_SHORT).show(); 50 | } 51 | } 52 | 53 | public static void updateMyWidget(Context context, String content) { 54 | String updateAction = "android.appwidget.action.APPWIDGET_SET_DATA"; 55 | Intent intent1 = new Intent(context, WidgetForOneXOne.class); 56 | intent1.setAction(updateAction); 57 | intent1.putExtra("TEXT_STRING", content); 58 | context.sendBroadcast(intent1); 59 | Intent intent2 = new Intent(context, WidgetForFourXTwo.class); 60 | intent2.putExtra("TEXT_STRING", content); 61 | intent2.setAction(updateAction); 62 | context.sendBroadcast(intent2); 63 | Intent intent3 = new Intent(context, WidgetForFourXThree.class); 64 | intent3.putExtra("TEXT_STRING", content); 65 | intent3.setAction(updateAction); 66 | context.sendBroadcast(intent3); 67 | Intent intent4 = new Intent(context, WidgetForFourXFour.class); 68 | intent4.putExtra("TEXT_STRING", content); 69 | intent4.setAction(updateAction); 70 | context.sendBroadcast(intent4); 71 | Intent intent5 = new Intent(context, WidgetForFourXOne.class); 72 | intent5.putExtra("TEXT_STRING", content); 73 | intent5.setAction(updateAction); 74 | context.sendBroadcast(intent5); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/CommonDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.content.DialogInterface; 6 | import android.os.Bundle; 7 | import android.support.annotation.NonNull; 8 | import android.support.v4.app.DialogFragment; 9 | import android.support.v7.app.AlertDialog; 10 | import android.support.v7.preference.Preference; 11 | import android.text.TextUtils; 12 | 13 | /** 14 | * Created by ted on 2016/12/27. 15 | * in com.ted.jots.myjot.setting 16 | */ 17 | 18 | public class CommonDialogFragment extends DialogFragment { 19 | private String mDialogPreferenceKey; 20 | 21 | public static CommonDialogFragment newIns(Preference preference) { 22 | CommonDialogFragment ins = new CommonDialogFragment(); 23 | Bundle args = new Bundle(); 24 | CommonDialogPreference dialogPreference = (CommonDialogPreference) preference; 25 | args.putString("title", dialogPreference.getDialogTitle().toString()); 26 | args.putString("msg", dialogPreference.getDialogMessage().toString()); 27 | args.putString("positive", dialogPreference.getPositiveButtonText().toString()); 28 | args.putString("negative", dialogPreference.getNegativeButtonText().toString()); 29 | args.putString("key", dialogPreference.getKey()); 30 | ins.setArguments(args); 31 | return ins; 32 | } 33 | 34 | private DialogInterface.OnClickListener mPositiveOnClickListener = new DialogInterface.OnClickListener() { 35 | @Override 36 | public void onClick(DialogInterface dialogInterface, int i) { 37 | if (null != getTargetFragment() && getTargetFragment() instanceof SettingFragment) { 38 | ((SettingFragment) getTargetFragment()).onDialogCall(mDialogPreferenceKey, true); 39 | } 40 | } 41 | }; 42 | 43 | private DialogInterface.OnClickListener mNegativeOnClickListener = new DialogInterface.OnClickListener() { 44 | @Override 45 | public void onClick(DialogInterface dialogInterface, int i) { 46 | if (null != getTargetFragment() && getTargetFragment() instanceof SettingFragment) { 47 | ((SettingFragment) getTargetFragment()).onDialogCall(mDialogPreferenceKey, false); 48 | } 49 | } 50 | }; 51 | 52 | @NonNull 53 | @Override 54 | public Dialog onCreateDialog(Bundle savedInstanceState) { 55 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 56 | builder.setTitle(getArguments().getString("title", "")); 57 | builder.setMessage(getArguments().getString("msg", "")); 58 | String negative = getArguments().getString("negative", ""); 59 | if(!TextUtils.isEmpty(negative)){ 60 | builder.setNegativeButton(negative, mNegativeOnClickListener); 61 | } 62 | String positive = getArguments().getString("positive", ""); 63 | if(!TextUtils.isEmpty(positive)){ 64 | builder.setPositiveButton(positive, mPositiveOnClickListener); 65 | } 66 | return builder.create(); 67 | } 68 | 69 | @Override 70 | public void onAttach(Context context) { 71 | super.onAttach(context); 72 | mDialogPreferenceKey = getArguments().getString("key", ""); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/ColorPickerPreDlgFragCompat.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.preference.DialogPreference; 5 | import android.support.v7.preference.PreferenceDialogFragmentCompat; 6 | import android.view.View; 7 | 8 | import com.ted.jots.myjot.R; 9 | import com.ted.jots.myjot.config.ConfigManager; 10 | import com.ted.jots.myjot.view.colorpickerview.view.ColorPanelView; 11 | import com.ted.jots.myjot.view.colorpickerview.view.ColorPickerView; 12 | 13 | /** 14 | * Created by ted on 2016/12/27. 15 | * in com.ted.jots.myjot.setting 16 | */ 17 | 18 | public class ColorPickerPreDlgFragCompat extends PreferenceDialogFragmentCompat { 19 | private ColorPanelView mNewColorPanelView; 20 | private ColorPickerView mColorPickerView; 21 | 22 | public static ColorPickerPreDlgFragCompat newInstance(String key) { 23 | final ColorPickerPreDlgFragCompat 24 | fragment = new ColorPickerPreDlgFragCompat(); 25 | final Bundle b = new Bundle(); 26 | b.putString(ARG_KEY, key); 27 | fragment.setArguments(b); 28 | return fragment; 29 | } 30 | 31 | private ColorPickerView.OnColorChangedListener onColorChangedListener = new ColorPickerView.OnColorChangedListener() { 32 | @Override 33 | public void onColorChanged(int newColor) { 34 | mNewColorPanelView.setColor(mColorPickerView.getColor()); 35 | } 36 | }; 37 | 38 | @Override 39 | protected void onBindDialogView(View view) { 40 | super.onBindDialogView(view); 41 | mColorPickerView = (ColorPickerView) view.findViewById(R.id.color_picker_view); 42 | ColorPanelView preColorPanelView = (ColorPanelView) view.findViewById(R.id.color_panel_old); 43 | mNewColorPanelView = (ColorPanelView) view.findViewById(R.id.color_panel_new); 44 | if (null == mColorPickerView || null == preColorPanelView || null == mNewColorPanelView) { 45 | throw new IllegalStateException("Dialog view must contain a ColorPickerView or ColorPanelView"); 46 | } 47 | mColorPickerView.setOnColorChangedListener(onColorChangedListener); 48 | 49 | boolean isFontColor = getString(R.string.font_color_key).equals(getArguments().getString(ARG_KEY)); 50 | mColorPickerView.setAlphaSliderVisible(!isFontColor); 51 | int color = -1; 52 | DialogPreference preference = getPreference(); 53 | if (preference instanceof ColorPickerPreference) { 54 | color = ((ColorPickerPreference) preference).getColor(); 55 | } 56 | if (color == 0) color = getDefaultColor(isFontColor); 57 | mColorPickerView.setColor(color, true); 58 | preColorPanelView.setColor(color); 59 | } 60 | 61 | @Override 62 | public void onDialogClosed(boolean positiveResult) { 63 | if (positiveResult) { 64 | int color = mColorPickerView.getColor(); 65 | DialogPreference preference = getPreference(); 66 | if (preference instanceof ColorPickerPreference) { 67 | ((ColorPickerPreference) preference).setColor(color); 68 | } 69 | } 70 | } 71 | 72 | private int getDefaultColor(boolean isFont) { 73 | return isFont ? ConfigManager.getConfigAppTxtColor(getActivity()) 74 | : ConfigManager.getConfigAppBgColor(getActivity()); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 烂笔头 5 | 6 | 7 | 5秒 8 | 15秒 9 | 30秒 10 | 2分钟 11 | 12 | 13 | 0 14 | 1 15 | 2 16 | 3 17 | 18 | 19 | edit_page_color_key 20 | font_color_key 21 | is_support_clipboard_key 22 | listen_clipboard_time_key 23 | reset_all_setting_key 24 | app_use_courses_key 25 | share_app_to_friend_key 26 | about_developer_key 27 | 28 | 添加到烂笔头备忘 29 | 您刚刚清空了内容\u000d 30 | 点击此处开始输入内容 31 | 剪切板内容已经加入烂笔头 32 | 分享内容已经加入烂笔头 33 | 后悔了 34 | 我发现了一个非常不错的App叫【烂笔头】,\n点击下载http://www.wandoujia.com/apps/com.ted.jots.myjot 35 | 烂笔头小技巧 36 | 应用虽小,还是有一些小技巧滴 37 | 应用使用技巧 38 | 1、复制任何文本内容,摇一摇手机即可快速保存\n2、在其他应用分享文本内容时,选择添加到烂笔头即可保存\n3、更多便捷功能,敬请期待 39 | 复制内容之后在%s以内摇一摇,即可快速记录内容 40 | 别闹,先输入点文字再说吧! 41 | 设置应用 42 | 分享内容 43 | 清空内容 44 | 你还未安装应用市场哟 45 | 设置 46 | 知道了 47 | 颜色设置 48 | 设置编辑页面和桌面小部件的背景颜色 49 | 背景颜色 50 | 设置编辑页面和桌面小部件的字体颜色 51 | 字体颜色 52 | 快捷输入设置 53 | 复制内容之后,只要摇一摇即可快捷记录内容 54 | 是否监听剪切板 55 | 监听剪切板时间 56 | 其他设置 57 | 您确定要恢复最初设置么? 58 | 重置 59 | 确认 60 | 取消 61 | 将所有设置恢复默认值 62 | 重置所有设置 63 | 好东西当然一起分享 64 | 分享应用给好友 65 | 关于开发者 66 | 关闭 67 | 点赞 68 | 熊伟(Ted)\nAndroid程序开发者\nhttp://mrxiong.com/ 69 | 长按圆形图标即可唤出菜单页面 70 | 71 | -------------------------------------------------------------------------------- /myJot/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 烂笔头 5 | 6 | 7 | 5秒 8 | 15秒 9 | 30秒 10 | 2分钟 11 | 12 | 13 | 0 14 | 1 15 | 2 16 | 3 17 | 18 | 19 | edit_page_color_key 20 | font_color_key 21 | is_support_clipboard_key 22 | listen_clipboard_time_key 23 | reset_all_setting_key 24 | app_use_courses_key 25 | share_app_to_friend_key 26 | about_developer_key 27 | 28 | 添加到烂笔头备忘 29 | 您刚刚清空了内容\u000d 30 | 点击此处开始输入内容 31 | 剪切板内容已经加入烂笔头 32 | 分享内容已经加入烂笔头 33 | 后悔了 34 | 我发现了一个非常不错的App叫【烂笔头】,\n点击下载http://www.wandoujia.com/apps/com.ted.jots.myjot 35 | 烂笔头小技巧 36 | 应用虽小,还是有一些小技巧滴 37 | 应用使用技巧 38 | 1、复制任何文本内容,摇一摇手机即可快速保存\n2、在其他应用分享文本内容时,选择添加到烂笔头即可保存\n3、更多便捷功能,敬请期待 39 | 复制内容之后在%s以内摇一摇,即可快速记录内容 40 | 别闹,先输入点文字再说吧! 41 | 设置应用 42 | 分享内容 43 | 清空内容 44 | 你还未安装应用市场哟 45 | 设置 46 | 知道了 47 | 颜色设置 48 | 设置编辑页面和桌面小部件的背景颜色 49 | 背景颜色 50 | 设置编辑页面和桌面小部件的字体颜色 51 | 字体颜色 52 | 快捷输入设置 53 | 复制内容之后,只要摇一摇即可快捷记录内容 54 | 是否监听剪切板 55 | 监听剪切板时间 56 | 其他设置 57 | 您确定要恢复最初设置么? 58 | 重置 59 | 确认 60 | 取消 61 | 将所有设置恢复默认值 62 | 重置所有设置 63 | 好东西当然一起分享 64 | 分享应用给好友 65 | 关于开发者 66 | 关闭 67 | 点赞 68 | 熊伟(Ted)\nAndroid程序开发者\nhttp://mrxiong.com/ 69 | 长按圆形图标即可唤出菜单页面 70 | 71 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-en-rUS/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 烂笔头 5 | 6 | 7 | 5秒 8 | 15秒 9 | 30秒 10 | 2分钟 11 | 12 | 13 | 0 14 | 1 15 | 2 16 | 3 17 | 18 | 19 | edit_page_color_key 20 | font_color_key 21 | is_support_clipboard_key 22 | listen_clipboard_time_key 23 | reset_all_setting_key 24 | app_use_courses_key 25 | share_app_to_friend_key 26 | about_developer_key 27 | 28 | 添加到烂笔头备忘 29 | 您刚刚清空了内容\u000d 30 | 点击此处开始输入内容 31 | 剪切板内容已经加入烂笔头 32 | 分享内容已经加入烂笔头 33 | 后悔了 34 | 我发现了一个非常不错的App叫【烂笔头】,\n点击下载http://www.wandoujia.com/apps/com.ted.jots.myjot 35 | 烂笔头小技巧 36 | 应用虽小,还是有一些小技巧滴 37 | 应用使用技巧 38 | 1、复制任何文本内容,摇一摇手机即可快速保存\n2、在其他应用分享文本内容时,选择添加到烂笔头即可保存\n3、更多便捷功能,敬请期待 39 | 复制内容之后在%s以内摇一摇,即可快速记录内容 40 | 别闹,先输入点文字再说吧! 41 | 设置应用 42 | 分享内容 43 | 清空内容 44 | 你还未安装应用市场哟 45 | 设置 46 | 知道了 47 | 颜色设置 48 | 设置编辑页面和桌面小部件的背景颜色 49 | 背景颜色 50 | 设置编辑页面和桌面小部件的字体颜色 51 | 字体颜色 52 | 快捷输入设置 53 | 复制内容之后,只要摇一摇即可快捷记录内容 54 | 是否监听剪切板 55 | 监听剪切板时间 56 | 其他设置 57 | 您确定要恢复最初设置么? 58 | 重置 59 | 确认 60 | 取消 61 | 将所有设置恢复默认值 62 | 重置所有设置 63 | 好东西当然一起分享 64 | 分享应用给好友 65 | 关于开发者 66 | 关闭 67 | 点赞 68 | 熊伟(Ted)\nAndroid程序开发者\nhttp://mrxiong.com/ 69 | 长按圆形图标即可唤出菜单页面 70 | 71 | -------------------------------------------------------------------------------- /myJot/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 烂笔头 5 | 6 | 7 | 5秒 8 | 15秒 9 | 30秒 10 | 2分钟 11 | 12 | 13 | 0 14 | 1 15 | 2 16 | 3 17 | 18 | 19 | edit_page_color_key 20 | font_color_key 21 | is_support_clipboard_key 22 | listen_clipboard_time_key 23 | reset_all_setting_key 24 | app_use_courses_key 25 | share_app_to_friend_key 26 | about_developer_key 27 | 28 | 添加到烂笔头备忘 29 | 您刚刚清空了内容\u000d 30 | 点击此处开始输入内容 31 | 剪切板内容已经加入烂笔头 32 | 分享内容已经加入烂笔头 33 | 后悔了 34 | 我发现了一个非常不错的App叫【烂笔头】,\n点击下载http://www.wandoujia.com/apps/com.ted.jots.myjot 35 | 烂笔头小技巧 36 | 应用虽小,还是有一些小技巧滴 37 | 应用使用技巧 38 | 1、复制任何文本内容,摇一摇手机即可快速保存\n2、在其他应用分享文本内容时,选择添加到烂笔头即可保存\n3、更多便捷功能,敬请期待 39 | 复制内容之后在%s以内摇一摇,即可快速记录内容 40 | 别闹,先输入点文字再说吧! 41 | 设置应用 42 | 分享内容 43 | 清空内容 44 | 你还未安装应用市场哟 45 | 设置 46 | 知道了 47 | 颜色设置 48 | 设置编辑页面和桌面小部件的背景颜色 49 | 背景颜色 50 | 设置编辑页面和桌面小部件的字体颜色 51 | 字体颜色 52 | 快捷输入设置 53 | 复制内容之后,只要摇一摇即可快捷记录内容 54 | 是否监听剪切板 55 | 监听剪切板时间 56 | 其他设置 57 | 您确定要恢复最初设置么? 58 | 重置 59 | 确认 60 | 取消 61 | 将所有设置恢复默认值 62 | 重置所有设置 63 | 好东西当然一起分享 64 | 分享应用给好友 65 | 关于开发者 66 | 关闭 67 | 点赞 68 | 熊伟(Ted)\nAndroid程序开发者\nhttp://mrxiong.com/ 69 | 长按圆形图标即可唤出菜单页面 70 | 71 | 72 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/main/MainMenuHelper.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.main; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.github.clans.fab.FloatingActionButton; 7 | import com.github.clans.fab.FloatingActionMenu; 8 | import com.ted.jots.myjot.R; 9 | import com.ted.jots.myjot.utils.CheckDoubleClick; 10 | 11 | /** 12 | * Created by ted on 2016/12/22. 13 | * in com.ted.jots.myjot.main 14 | */ 15 | 16 | public class MainMenuHelper implements View.OnClickListener { 17 | public static final int MENU_TYPE_CLEAR = 0; 18 | public static final int MENU_TYPE_SHARE = 1; 19 | public static final int MENU_TYPE_SETTING = 2; 20 | 21 | 22 | // @IntDef({MENU_TYPE_CLEAR,MENU_TYPE_SETTING,MENU_TYPE_SHARE}) 23 | // @Retention(RetentionPolicy.SOURCE) 24 | // private @interface MenuType{} 25 | 26 | private MainMenuClickListener menuClickListener; 27 | 28 | @Override 29 | public void onClick(View view) { 30 | if (CheckDoubleClick.isFastDoubleClick()) return; 31 | Object tag = view.getTag(); 32 | if (null != tag && tag instanceof Integer) { 33 | int type = (Integer) tag; 34 | if (null != menuClickListener) { 35 | menuClickListener.onMenuClick(type); 36 | } 37 | } 38 | } 39 | 40 | public MainMenuHelper(MainMenuClickListener listener) { 41 | this.menuClickListener = listener; 42 | } 43 | 44 | public void initBasicMenu(FloatingActionMenu menu) { 45 | if (menu.getChildCount() > 2) return; 46 | menu.addMenuButton(getClearButton(menu.getContext())); 47 | menu.addMenuButton(getShareButton(menu.getContext())); 48 | menu.addMenuButton(getSettingButton(menu.getContext())); 49 | } 50 | 51 | private FloatingActionButton getSettingButton(Context context) { 52 | final FloatingActionButton settingBtn = new FloatingActionButton(context); 53 | settingBtn.setButtonSize(FloatingActionButton.SIZE_MINI); 54 | settingBtn.setColorNormalResId(R.color.app_logo_color_light); 55 | settingBtn.setColorPressedResId(R.color.app_logo_color); 56 | settingBtn.setImageResource(R.drawable.set); 57 | settingBtn.setTag(MENU_TYPE_SETTING); 58 | settingBtn.setLabelText(R.string.config_app); 59 | settingBtn.setOnClickListener(this); 60 | return settingBtn; 61 | } 62 | 63 | private FloatingActionButton getShareButton(Context context) { 64 | final FloatingActionButton shareBtn = new FloatingActionButton(context); 65 | shareBtn.setButtonSize(FloatingActionButton.SIZE_MINI); 66 | shareBtn.setImageResource(R.drawable.share); 67 | shareBtn.setTag(MENU_TYPE_SHARE); 68 | shareBtn.setLabelText(R.string.share_to); 69 | shareBtn.setColorNormalResId(R.color.app_logo_color_light); 70 | shareBtn.setColorPressedResId(R.color.app_logo_color); 71 | shareBtn.setOnClickListener(this); 72 | return shareBtn; 73 | } 74 | 75 | private FloatingActionButton getClearButton(Context context) { 76 | final FloatingActionButton clearBtn = new FloatingActionButton(context); 77 | clearBtn.setButtonSize(FloatingActionButton.SIZE_MINI); 78 | clearBtn.setImageResource(R.drawable.delete); 79 | clearBtn.setTag(MENU_TYPE_CLEAR); 80 | clearBtn.setLabelText(R.string.delete_all_data); 81 | clearBtn.setColorNormalResId(R.color.app_logo_color_light); 82 | clearBtn.setColorPressedResId(R.color.app_logo_color); 83 | clearBtn.setOnClickListener(this); 84 | return clearBtn; 85 | } 86 | 87 | 88 | public interface MainMenuClickListener { 89 | void onMenuClick(int type); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/main/ReceiveDataActivity.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.main; 2 | 3 | import android.app.Activity; 4 | import android.content.ClipData; 5 | import android.content.ClipDescription; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.os.Build; 9 | import android.os.Bundle; 10 | import android.text.TextUtils; 11 | import android.widget.Toast; 12 | import com.ted.jots.myjot.R; 13 | import com.ted.jots.myjot.data.DataManager; 14 | import com.ted.jots.myjot.data.DataModel; 15 | import com.ted.jots.myjot.service.WatchingService; 16 | 17 | /** 18 | * Created by Ted on 2015/3/5. 19 | * ReceiveDataActivity 20 | */ 21 | public class ReceiveDataActivity extends Activity { 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | Intent intent = getIntent(); 25 | if ("android.intent.action.SEND".equals(intent.getAction())){ 26 | onReceiveData(intent); 27 | } 28 | super.onCreate(savedInstanceState); 29 | } 30 | 31 | private void onReceiveData(Intent intent){ 32 | if(Build.VERSION.SDK_INT > 15){ 33 | ClipData clipData = intent.getClipData(); 34 | ClipDescription clipDescription; 35 | clipDescription = clipData.getDescription(); 36 | if ((!clipDescription.hasMimeType("text/plain")) && (!clipDescription.hasMimeType("text/html"))){ 37 | /**剪切板里面的不是文本内容*/ 38 | finish(); 39 | }else { 40 | DataModel newDataModel = new DataModel(); 41 | StringBuilder stringBuilder = new StringBuilder(); 42 | int count = clipData.getItemCount(); 43 | for(int i=0;i < count;i++){ 44 | ClipData.Item item = clipData.getItemAt(i); 45 | if(null != item){ 46 | stringBuilder.append(item.getText()); 47 | } 48 | } 49 | newDataModel.setContent(stringBuilder.toString()); 50 | onSaveShareMemo(newDataModel); 51 | } 52 | }else { 53 | String type = intent.getType(); 54 | if(TextUtils.isEmpty(type))return; 55 | if(type.contains("text/plain")){ 56 | String subject = intent.getStringExtra(android.content.Intent.EXTRA_SUBJECT); 57 | String body = intent.getStringExtra(android.content.Intent.EXTRA_TEXT); 58 | DataModel newDataModel = new DataModel(); 59 | newDataModel.setContent(subject + body); 60 | onSaveShareMemo(newDataModel); 61 | }else finish(); 62 | } 63 | } 64 | 65 | private void onSaveShareMemo(DataModel newDataModel){ 66 | if(null == newDataModel || TextUtils.isEmpty(newDataModel.getContent()))return; 67 | DataModel preDataModel = DataManager.readData(this); 68 | StringBuilder saveBuilder = new StringBuilder(); 69 | String preContent = preDataModel.getContent(); 70 | saveBuilder.append(preContent).append(TextUtils.isEmpty(preContent)?"":"\n").append(newDataModel.getContent()); 71 | newDataModel.setContent(saveBuilder.toString()); 72 | DataManager.writeData(this,newDataModel); 73 | Context context = getApplicationContext(); 74 | Toast.makeText(context, context.getResources().getString(R.string.have_add_share), Toast.LENGTH_LONG).show(); 75 | Intent intent = new Intent(WatchingService.RELOAD_DATA_ACTION); 76 | sendBroadcast(intent); 77 | updateMyWidget(newDataModel); 78 | finish(); 79 | } 80 | 81 | public void updateMyWidget(DataModel newDataModel) { 82 | MainPresenter.updateMyWidget(this,newDataModel.getContent()); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/widget/BaseAppWidgetProvider.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.widget; 2 | 3 | import android.app.PendingIntent; 4 | import android.appwidget.AppWidgetManager; 5 | import android.appwidget.AppWidgetProvider; 6 | import android.content.ComponentName; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.util.Log; 10 | import android.widget.RemoteViews; 11 | 12 | import com.ted.jots.myjot.R; 13 | import com.ted.jots.myjot.config.ConfigManager; 14 | import com.ted.jots.myjot.data.DataManager; 15 | import com.ted.jots.myjot.main.MainActivity; 16 | 17 | /** 18 | * Created by ted on 2016/12/30. 19 | * in com.ted.jots.myjot.widget 20 | */ 21 | 22 | public abstract class BaseAppWidgetProvider extends AppWidgetProvider { 23 | @Override 24 | public void onReceive(Context context, Intent intent) { 25 | super.onReceive(context, intent); 26 | if (!"android.appwidget.action.APPWIDGET_SET_DATA".equals(intent.getAction())) return; 27 | if (null == getWidgetComponentName(context) || null == getWidgetRemoteViews(context)) 28 | return; 29 | int[] widgetIds = AppWidgetManager.getInstance(context).getAppWidgetIds(getWidgetComponentName(context)); 30 | for (int widgetId : widgetIds) { 31 | try { 32 | String str = intent.getExtras().getString("TEXT_STRING"); 33 | RemoteViews remoteViews = getWidgetRemoteViews(context); 34 | remoteViews.setTextViewText(R.id.widget_update, str); 35 | remoteViews.setInt(getClickViewId(), "setBackgroundColor", ConfigManager.getConfigWidgetBgColor(context)); 36 | remoteViews.setTextColor(R.id.widget_update, ConfigManager.getConfigAppTxtColor(context)); 37 | remoteViews.setOnClickPendingIntent(getClickViewId(), 38 | PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT)); 39 | AppWidgetManager.getInstance(context).updateAppWidget(widgetId, remoteViews); 40 | } catch (Exception e) { 41 | e.printStackTrace(); 42 | Log.e("ted", "update widget error @" + widgetId); 43 | } 44 | } 45 | } 46 | 47 | public abstract ComponentName getWidgetComponentName(Context context); 48 | 49 | public abstract RemoteViews getWidgetRemoteViews(Context context); 50 | 51 | public abstract int getClickViewId(); 52 | 53 | @Override 54 | public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { 55 | super.onUpdate(context, appWidgetManager, appWidgetIds); 56 | int[] widgetIds = appWidgetManager.getAppWidgetIds(getWidgetComponentName(context)); 57 | for (int widgetId : widgetIds) { 58 | try { 59 | RemoteViews remoteViews = getWidgetRemoteViews(context); 60 | remoteViews.setTextViewText(R.id.widget_update, DataManager.readData(context).getContent()); 61 | remoteViews.setInt(getClickViewId(), "setBackgroundColor", ConfigManager.getConfigWidgetBgColor(context)); 62 | remoteViews.setTextColor(R.id.widget_update, ConfigManager.getConfigAppTxtColor(context)); 63 | remoteViews.setOnClickPendingIntent(getClickViewId(), 64 | PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT)); 65 | AppWidgetManager.getInstance(context).updateAppWidget(widgetId, remoteViews); 66 | } catch (Exception e) { 67 | e.printStackTrace(); 68 | Log.e("ted", "update widget error @" + widgetId); 69 | } 70 | 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /myJot/src/main/res/xml/setting_pref.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 58 | 59 | 63 | 64 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/listener/MobileShakeListener.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.listener; 2 | 3 | import android.content.Context; 4 | import android.hardware.Sensor; 5 | import android.hardware.SensorEvent; 6 | import android.hardware.SensorEventListener; 7 | import android.hardware.SensorManager; 8 | 9 | /** 10 | * Created by Ted on 14-8-4. 11 | * MobileShakeListener 12 | */ 13 | public class MobileShakeListener implements SensorEventListener { 14 | // 速度阈值,当摇晃速度达到这值后产生作用 15 | private static final int SPEED_SHAKE = 1500; 16 | // 两次检测的时间间隔 17 | private static final int UPDATE_INTERVAL_TIME = 70; 18 | /** 19 | * 回调时间隔,避免频繁回调 20 | */ 21 | private static final int CALL_INTERVAL_TIME = 2000; 22 | // 传感器管理器 23 | private SensorManager sensorManager; 24 | // 重力感应监听器 25 | private OnShakeListener onShakeListener; 26 | // 上下文 27 | private Context mContext; 28 | // 手机上一个位置时重力感应坐标 29 | private float lastX; 30 | private float lastY; 31 | private float lastZ; 32 | // 上次检测时间 33 | private long lastUpdateTime = 0; 34 | private long lastCallBackTime = 0; 35 | 36 | // 构造器 37 | public MobileShakeListener(Context c) { 38 | // 获得监听对象 39 | mContext = c; 40 | } 41 | 42 | // 开始 43 | public void start() { 44 | // 获得传感器管理器 45 | sensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE); 46 | if (sensorManager != null) { 47 | // 获得重力传感器 48 | Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); 49 | // 注册 50 | if (sensor != null) { 51 | sensorManager.registerListener(this, sensor, 52 | SensorManager.SENSOR_DELAY_GAME); 53 | } 54 | } 55 | } 56 | 57 | // 停止检测 58 | public void stop() { 59 | if (null != sensorManager) { 60 | sensorManager.unregisterListener(this); 61 | } 62 | } 63 | 64 | // 设置重力感应监听器 65 | public void setOnShakeListener(OnShakeListener listener) { 66 | onShakeListener = listener; 67 | } 68 | 69 | // 重力感应器感应获得变化数据 70 | @Override 71 | public void onSensorChanged(SensorEvent event) { 72 | // 现在检测时间 73 | long currentUpdateTime = System.currentTimeMillis(); 74 | // 两次检测的时间间隔 75 | long timeInterval = currentUpdateTime - lastUpdateTime; 76 | // 判断是否达到了检测时间间隔 77 | if (timeInterval < UPDATE_INTERVAL_TIME) 78 | return; 79 | // 现在的时间变成last时间 80 | lastUpdateTime = currentUpdateTime; 81 | 82 | // 获得x,y,z坐标 83 | float x = event.values[0]; 84 | float y = event.values[1]; 85 | float z = event.values[2]; 86 | 87 | // 获得x,y,z的变化值 88 | float deltaX = x - lastX; 89 | float deltaY = y - lastY; 90 | float deltaZ = z - lastZ; 91 | 92 | // 将现在的坐标变成last坐标 93 | lastX = x; 94 | lastY = y; 95 | lastZ = z; 96 | 97 | double speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) / timeInterval * 10000; 98 | // 达到速度阀值,发出提示 99 | if (speed >= SPEED_SHAKE) { 100 | long callBackTimeInterval = currentUpdateTime - lastCallBackTime; 101 | if (callBackTimeInterval > CALL_INTERVAL_TIME) { 102 | lastCallBackTime = currentUpdateTime; 103 | onShakeListener.onShake(); 104 | } 105 | } 106 | } 107 | 108 | @Override 109 | public void onAccuracyChanged(Sensor sensor, int accuracy) { 110 | 111 | } 112 | 113 | // 摇晃监听接口 114 | public interface OnShakeListener { 115 | void onShake(); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /myJot/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 | 56 | 57 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 85 | 86 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /manifest-merger-release-report.txt: -------------------------------------------------------------------------------- 1 | -- Merging decision tree log --- 2 | manifest 3 | ADDED from AndroidManifest.xml:2:1 4 | xmlns:android 5 | ADDED from AndroidManifest.xml:2:11 6 | package 7 | ADDED from AndroidManifest.xml:3:5 8 | INJECTED from AndroidManifest.xml:0:0 9 | INJECTED from AndroidManifest.xml:0:0 10 | android:versionName 11 | ADDED from AndroidManifest.xml:5:5 12 | INJECTED from AndroidManifest.xml:0:0 13 | INJECTED from AndroidManifest.xml:0:0 14 | android:versionCode 15 | ADDED from AndroidManifest.xml:4:5 16 | INJECTED from AndroidManifest.xml:0:0 17 | INJECTED from AndroidManifest.xml:0:0 18 | application 19 | ADDED from AndroidManifest.xml:7:5 20 | MERGED from com.android.support:appcompat-v7:21.0.3:16:5 21 | MERGED from com.android.support:support-v4:21.0.3:16:5 22 | MERGED from com.github.navasmdc:MaterialDesign:1.4:11:5 23 | MERGED from com.afollestad:material-dialogs:0.6.2.4:12:5 24 | MERGED from com.android.support:appcompat-v7:21.0.3:16:5 25 | MERGED from com.android.support:support-v4:21.0.3:16:5 26 | MERGED from com.android.support:cardview-v7:21.0.3:16:5 27 | android:label 28 | ADDED from AndroidManifest.xml:10:9 29 | android:allowBackup 30 | ADDED from AndroidManifest.xml:8:9 31 | android:icon 32 | ADDED from AndroidManifest.xml:9:9 33 | android:theme 34 | ADDED from AndroidManifest.xml:11:9 35 | receiver#com.ted.jots.myjot.widget.WidgetForOneXOne 36 | ADDED from AndroidManifest.xml:12:9 37 | android:name 38 | ADDED from AndroidManifest.xml:12:19 39 | intent-filter#ACTION.WIDGET.UPDATE.FROM.ACTIVITY+android.appwidget.action.APPWIDGET_UPDATE 40 | ADDED from AndroidManifest.xml:13:13 41 | action#android.appwidget.action.APPWIDGET_UPDATE 42 | ADDED from AndroidManifest.xml:14:17 43 | android:name 44 | ADDED from AndroidManifest.xml:14:25 45 | action#ACTION.WIDGET.UPDATE.FROM.ACTIVITY 46 | ADDED from AndroidManifest.xml:15:17 47 | android:name 48 | ADDED from AndroidManifest.xml:15:25 49 | meta-data#android.appwidget.provider 50 | ADDED from AndroidManifest.xml:17:13 51 | android:resource 52 | ADDED from AndroidManifest.xml:17:66 53 | android:name 54 | ADDED from AndroidManifest.xml:17:24 55 | receiver#com.ted.jots.myjot.widget.WidgetForFourXOne 56 | ADDED from AndroidManifest.xml:19:9 57 | android:name 58 | ADDED from AndroidManifest.xml:19:19 59 | receiver#com.ted.jots.myjot.widget.WidgetForFourXTwo 60 | ADDED from AndroidManifest.xml:26:9 61 | android:name 62 | ADDED from AndroidManifest.xml:26:19 63 | receiver#com.ted.jots.myjot.widget.WidgetForFourXThree 64 | ADDED from AndroidManifest.xml:33:9 65 | android:name 66 | ADDED from AndroidManifest.xml:33:19 67 | receiver#com.ted.jots.myjot.widget.WidgetForFourXFour 68 | ADDED from AndroidManifest.xml:40:9 69 | android:name 70 | ADDED from AndroidManifest.xml:40:19 71 | activity#com.ted.jots.myjot.main.MainActivity 72 | ADDED from AndroidManifest.xml:48:9 73 | android:windowSoftInputMode 74 | ADDED from AndroidManifest.xml:50:13 75 | android:label 76 | ADDED from AndroidManifest.xml:51:13 77 | android:name 78 | ADDED from AndroidManifest.xml:49:13 79 | intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER 80 | ADDED from AndroidManifest.xml:52:13 81 | action#android.intent.action.MAIN 82 | ADDED from AndroidManifest.xml:53:17 83 | android:name 84 | ADDED from AndroidManifest.xml:53:25 85 | category#android.intent.category.LAUNCHER 86 | ADDED from AndroidManifest.xml:55:17 87 | android:name 88 | ADDED from AndroidManifest.xml:55:27 89 | uses-sdk 90 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested 91 | MERGED from com.android.support:appcompat-v7:21.0.3:15:5 92 | MERGED from com.android.support:support-v4:21.0.3:15:5 93 | MERGED from com.github.navasmdc:MaterialDesign:1.4:7:5 94 | MERGED from com.afollestad:material-dialogs:0.6.2.4:8:5 95 | MERGED from com.android.support:appcompat-v7:21.0.3:15:5 96 | MERGED from com.android.support:support-v4:21.0.3:15:5 97 | MERGED from com.android.support:cardview-v7:21.0.3:15:5 98 | android:targetSdkVersion 99 | INJECTED from AndroidManifest.xml:0:0 100 | INJECTED from AndroidManifest.xml:0:0 101 | android:minSdkVersion 102 | INJECTED from AndroidManifest.xml:0:0 103 | INJECTED from AndroidManifest.xml:0:0 104 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/view/colorpickerview/drawable/AlphaPatternDrawable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Daniel Nilsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ted.jots.myjot.view.colorpickerview.drawable; 18 | 19 | import android.graphics.Bitmap; 20 | import android.graphics.Canvas; 21 | import android.graphics.ColorFilter; 22 | import android.graphics.Paint; 23 | import android.graphics.Rect; 24 | import android.graphics.Bitmap.Config; 25 | import android.graphics.drawable.Drawable; 26 | 27 | /** 28 | * This drawable will draw a simple white and gray chessboard pattern. 29 | * It's pattern you will often see as a background behind a 30 | * partly transparent image in many applications. 31 | * @author Daniel Nilsson 32 | */ 33 | public class AlphaPatternDrawable extends Drawable { 34 | 35 | private int mRectangleSize = 10; 36 | 37 | private Paint mPaint = new Paint(); 38 | private Paint mPaintWhite = new Paint(); 39 | private Paint mPaintGray = new Paint(); 40 | 41 | private int numRectanglesHorizontal; 42 | private int numRectanglesVertical; 43 | 44 | /** 45 | * Bitmap in which the pattern will be cached. 46 | * This is so the pattern will not have to be recreated each time draw() gets called. 47 | * Because recreating the pattern i rather expensive. I will only be recreated if the 48 | * size changes. 49 | */ 50 | private Bitmap mBitmap; 51 | 52 | public AlphaPatternDrawable(int rectangleSize) { 53 | mRectangleSize = rectangleSize; 54 | mPaintWhite.setColor(0xffffffff); 55 | mPaintGray.setColor(0xffcbcbcb); 56 | } 57 | 58 | @Override 59 | public void draw(Canvas canvas) { 60 | if(mBitmap != null && !mBitmap.isRecycled()) { 61 | canvas.drawBitmap(mBitmap, null, getBounds(), mPaint); 62 | } 63 | } 64 | 65 | @Override 66 | public int getOpacity() { 67 | return 0; 68 | } 69 | 70 | @Override 71 | public void setAlpha(int alpha) { 72 | throw new UnsupportedOperationException("Alpha is not supported by this drawable."); 73 | } 74 | 75 | @Override 76 | public void setColorFilter(ColorFilter cf) { 77 | throw new UnsupportedOperationException("ColorFilter is not supported by this drawable."); 78 | } 79 | 80 | @Override 81 | protected void onBoundsChange(Rect bounds) { 82 | super.onBoundsChange(bounds); 83 | 84 | int height = bounds.height(); 85 | int width = bounds.width(); 86 | 87 | numRectanglesHorizontal = (int) Math.ceil((width / mRectangleSize)); 88 | numRectanglesVertical = (int) Math.ceil(height / mRectangleSize); 89 | 90 | generatePatternBitmap(); 91 | 92 | } 93 | 94 | /** 95 | * This will generate a bitmap with the pattern 96 | * as big as the rectangle we were allow to draw on. 97 | * We do this to chache the bitmap so we don't need to 98 | * recreate it each time draw() is called since it 99 | * takes a few milliseconds. 100 | */ 101 | private void generatePatternBitmap(){ 102 | 103 | if(getBounds().width() <= 0 || getBounds().height() <= 0){ 104 | return; 105 | } 106 | 107 | mBitmap = Bitmap.createBitmap(getBounds().width(), getBounds().height(), Config.ARGB_8888); 108 | Canvas canvas = new Canvas(mBitmap); 109 | 110 | Rect r = new Rect(); 111 | boolean verticalStartWhite = true; 112 | for (int i = 0; i <= numRectanglesVertical; i++) { 113 | 114 | boolean isWhite = verticalStartWhite; 115 | for (int j = 0; j <= numRectanglesHorizontal; j++) { 116 | 117 | r.top = i * mRectangleSize; 118 | r.left = j * mRectangleSize; 119 | r.bottom = r.top + mRectangleSize; 120 | r.right = r.left + mRectangleSize; 121 | 122 | canvas.drawRect(r, isWhite ? mPaintWhite : mPaintGray); 123 | 124 | isWhite = !isWhite; 125 | } 126 | 127 | verticalStartWhite = !verticalStartWhite; 128 | 129 | } 130 | 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/setting/SettingFragment.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.setting; 2 | 3 | import android.content.SharedPreferences; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import android.os.Message; 7 | import android.support.v4.app.DialogFragment; 8 | import android.support.v7.preference.CheckBoxPreference; 9 | import android.support.v7.preference.ListPreference; 10 | import android.support.v7.preference.Preference; 11 | import android.support.v7.preference.PreferenceFragmentCompat; 12 | import android.support.v7.preference.PreferenceManager; 13 | import android.widget.Toast; 14 | 15 | import com.ted.jots.myjot.R; 16 | import com.ted.jots.myjot.config.ConfigManager; 17 | import com.ted.jots.myjot.main.MainPresenter; 18 | 19 | /** 20 | * Created by ted on 2016/12/26. 21 | * in com.ted.jots.myjot.setting 22 | */ 23 | 24 | public class SettingFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { 25 | private Handler mUiHandler = new Handler(new Handler.Callback() { 26 | @Override 27 | public boolean handleMessage(Message message) { 28 | 29 | return false; 30 | } 31 | }); 32 | 33 | @Override 34 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 35 | addPreferencesFromResource(R.xml.setting_pref); 36 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); 37 | onSharedPreferenceChanged(sharedPreferences, getString(R.string.is_support_clipboard_key)); 38 | onSharedPreferenceChanged(sharedPreferences, getString(R.string.listen_clipboard_time_key)); 39 | } 40 | 41 | 42 | @Override 43 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { 44 | Preference preference = findPreference(key); 45 | if (preference instanceof ListPreference) { 46 | ListPreference listPreference = (ListPreference) preference; 47 | int prefIndex = listPreference.findIndexOfValue(sharedPreferences.getString(key, "")); 48 | if (prefIndex >= 0) { 49 | if (getString(R.string.listen_clipboard_time_key).equals(key)) { 50 | preference.setSummary(getString(R.string.listen_clipboard_des, 51 | listPreference.getEntries()[prefIndex])); 52 | } 53 | } 54 | } else if (preference instanceof CheckBoxPreference) { 55 | boolean result = sharedPreferences.getBoolean(key, false); 56 | findPreference(getString(R.string.listen_clipboard_time_key)).setEnabled(result); 57 | } 58 | } 59 | 60 | @Override 61 | public boolean onPreferenceTreeClick(Preference preference) { 62 | if (preference.getKey().equalsIgnoreCase(getString(R.string.share_app_to_friend_key))) { 63 | MainPresenter.onShareApp(getActivity()); 64 | } 65 | return super.onPreferenceTreeClick(preference); 66 | } 67 | 68 | @Override 69 | public void onDisplayPreferenceDialog(Preference preference) { 70 | DialogFragment dialogFragment = null; 71 | if (preference instanceof ColorPickerPreference) { 72 | dialogFragment = ColorPickerPreDlgFragCompat.newInstance(preference.getKey()); 73 | } else if (preference instanceof CommonDialogPreference) { 74 | if (getString(R.string.app_use_courses_key).equals(preference.getKey())) 75 | dialogFragment = SingleDialogFragment.newIns(preference); 76 | else dialogFragment = CommonDialogFragment.newIns(preference); 77 | } 78 | if (null != dialogFragment) { 79 | dialogFragment.setTargetFragment(this, 0); 80 | dialogFragment.show(this.getFragmentManager(), "PreferenceDialog"); 81 | } else 82 | super.onDisplayPreferenceDialog(preference); 83 | } 84 | 85 | @Override 86 | public void onResume() { 87 | super.onResume(); 88 | getPreferenceScreen().getSharedPreferences() 89 | .registerOnSharedPreferenceChangeListener(this); 90 | } 91 | 92 | @Override 93 | public void onPause() { 94 | super.onPause(); 95 | getPreferenceScreen().getSharedPreferences() 96 | .unregisterOnSharedPreferenceChangeListener(this); 97 | } 98 | 99 | @Override 100 | public void onDestroy() { 101 | super.onDestroy(); 102 | } 103 | 104 | public void onDialogCall(String dialogPreKey, boolean isOkBtn) { 105 | if (dialogPreKey.equals(getString(R.string.reset_all_setting_key)) && isOkBtn) { 106 | refreshSetting(); 107 | mUiHandler.sendEmptyMessageDelayed(0, 500); 108 | } else if (dialogPreKey.equals(getString(R.string.about_developer_key)) && isOkBtn) { 109 | MainPresenter.onTanksDeveloper(getActivity()); 110 | } 111 | } 112 | 113 | private void refreshSetting() { 114 | ((ColorPickerPreference) findPreference(getString(R.string.edit_page_color_key))).setColor(ConfigManager.DEFAULT_ARGB_COLOR); 115 | ((ColorPickerPreference) findPreference(getString(R.string.font_color_key))).setColor(ConfigManager.DEFAULT_TEXT_COLOR); 116 | ((ListPreference) findPreference(getString(R.string.listen_clipboard_time_key))).setValueIndex(1); 117 | ((CheckBoxPreference) findPreference(getString(R.string.is_support_clipboard_key))).setChecked(true); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /myJot/manifest-merger-release-report.txt: -------------------------------------------------------------------------------- 1 | -- Merging decision tree log --- 2 | manifest 3 | ADDED from AndroidManifest.xml:2:1 4 | xmlns:android 5 | ADDED from AndroidManifest.xml:2:11 6 | package 7 | ADDED from AndroidManifest.xml:3:5 8 | INJECTED from AndroidManifest.xml:0:0 9 | INJECTED from AndroidManifest.xml:0:0 10 | android:versionName 11 | ADDED from AndroidManifest.xml:5:5 12 | INJECTED from AndroidManifest.xml:0:0 13 | INJECTED from AndroidManifest.xml:0:0 14 | android:versionCode 15 | ADDED from AndroidManifest.xml:4:5 16 | INJECTED from AndroidManifest.xml:0:0 17 | INJECTED from AndroidManifest.xml:0:0 18 | uses-permission#android.permission.VIBRATE 19 | ADDED from AndroidManifest.xml:7:5 20 | android:name 21 | ADDED from AndroidManifest.xml:7:22 22 | application 23 | ADDED from AndroidManifest.xml:9:5 24 | MERGED from com.android.support:appcompat-v7:22.2.0:22:5 25 | MERGED from com.android.support:support-v4:22.2.0:22:5 26 | MERGED from com.github.navasmdc:MaterialDesign:1.5:11:5 27 | MERGED from com.afollestad:material-dialogs:0.7.6.0:12:5 28 | MERGED from com.android.support:support-v4:22.2.0:22:5 29 | MERGED from com.android.support:appcompat-v7:22.2.0:22:5 30 | MERGED from com.android.support:support-v4:22.2.0:22:5 31 | MERGED from com.android.support:support-v4:22.2.0:22:5 32 | android:label 33 | ADDED from AndroidManifest.xml:12:9 34 | android:allowBackup 35 | ADDED from AndroidManifest.xml:10:9 36 | android:icon 37 | ADDED from AndroidManifest.xml:11:9 38 | android:theme 39 | ADDED from AndroidManifest.xml:13:9 40 | receiver#com.ted.jots.myjot.widget.WidgetForOneXOne 41 | ADDED from AndroidManifest.xml:14:9 42 | android:name 43 | ADDED from AndroidManifest.xml:14:19 44 | intent-filter#ACTION.WIDGET.UPDATE.FROM.ACTIVITY+android.appwidget.action.APPWIDGET_UPDATE 45 | ADDED from AndroidManifest.xml:15:13 46 | action#android.appwidget.action.APPWIDGET_UPDATE 47 | ADDED from AndroidManifest.xml:16:17 48 | android:name 49 | ADDED from AndroidManifest.xml:16:25 50 | action#ACTION.WIDGET.UPDATE.FROM.ACTIVITY 51 | ADDED from AndroidManifest.xml:17:17 52 | android:name 53 | ADDED from AndroidManifest.xml:17:25 54 | meta-data#android.appwidget.provider 55 | ADDED from AndroidManifest.xml:19:13 56 | android:resource 57 | ADDED from AndroidManifest.xml:19:66 58 | android:name 59 | ADDED from AndroidManifest.xml:19:24 60 | receiver#com.ted.jots.myjot.widget.WidgetForFourXOne 61 | ADDED from AndroidManifest.xml:21:9 62 | android:name 63 | ADDED from AndroidManifest.xml:21:19 64 | receiver#com.ted.jots.myjot.widget.WidgetForFourXTwo 65 | ADDED from AndroidManifest.xml:28:9 66 | android:name 67 | ADDED from AndroidManifest.xml:28:19 68 | receiver#com.ted.jots.myjot.widget.WidgetForFourXThree 69 | ADDED from AndroidManifest.xml:35:9 70 | android:name 71 | ADDED from AndroidManifest.xml:35:19 72 | receiver#com.ted.jots.myjot.widget.WidgetForFourXFour 73 | ADDED from AndroidManifest.xml:42:9 74 | android:name 75 | ADDED from AndroidManifest.xml:42:19 76 | activity#com.ted.jots.myjot.main.ReceiveDataActivity 77 | ADDED from AndroidManifest.xml:50:9 78 | android:screenOrientation 79 | ADDED from AndroidManifest.xml:51:19 80 | android:label 81 | ADDED from AndroidManifest.xml:50:19 82 | android:name 83 | ADDED from AndroidManifest.xml:50:57 84 | intent-filter#android.intent.action.SEND+android.intent.category.DEFAULT 85 | ADDED from AndroidManifest.xml:52:13 86 | action#android.intent.action.SEND 87 | ADDED from AndroidManifest.xml:53:17 88 | android:name 89 | ADDED from AndroidManifest.xml:53:25 90 | category#android.intent.category.DEFAULT 91 | ADDED from AndroidManifest.xml:54:17 92 | android:name 93 | ADDED from AndroidManifest.xml:54:27 94 | data 95 | ADDED from AndroidManifest.xml:55:17 96 | android:mimeType 97 | ADDED from AndroidManifest.xml:55:23 98 | activity#com.ted.jots.myjot.main.MainActivity 99 | ADDED from AndroidManifest.xml:60:9 100 | android:windowSoftInputMode 101 | ADDED from AndroidManifest.xml:62:13 102 | android:label 103 | ADDED from AndroidManifest.xml:63:13 104 | android:name 105 | ADDED from AndroidManifest.xml:61:13 106 | intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER 107 | ADDED from AndroidManifest.xml:64:13 108 | action#android.intent.action.MAIN 109 | ADDED from AndroidManifest.xml:65:17 110 | android:name 111 | ADDED from AndroidManifest.xml:65:25 112 | category#android.intent.category.LAUNCHER 113 | ADDED from AndroidManifest.xml:67:17 114 | android:name 115 | ADDED from AndroidManifest.xml:67:27 116 | service#com.ted.jots.myjot.service.WatchingService 117 | ADDED from AndroidManifest.xml:70:9 118 | android:exported 119 | ADDED from AndroidManifest.xml:70:58 120 | android:name 121 | ADDED from AndroidManifest.xml:70:18 122 | uses-sdk 123 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested 124 | MERGED from com.android.support:appcompat-v7:22.2.0:20:5 125 | MERGED from com.android.support:support-v4:22.2.0:20:5 126 | MERGED from com.github.navasmdc:MaterialDesign:1.5:7:5 127 | MERGED from com.afollestad:material-dialogs:0.7.6.0:8:5 128 | MERGED from com.android.support:support-v4:22.2.0:20:5 129 | MERGED from com.android.support:appcompat-v7:22.2.0:20:5 130 | MERGED from com.android.support:support-v4:22.2.0:20:5 131 | MERGED from com.android.support:recyclerview-v7:22.2.0:20:5 132 | MERGED from com.android.support:support-v4:22.2.0:20:5 133 | android:targetSdkVersion 134 | INJECTED from AndroidManifest.xml:0:0 135 | INJECTED from AndroidManifest.xml:0:0 136 | android:minSdkVersion 137 | INJECTED from AndroidManifest.xml:0:0 138 | INJECTED from AndroidManifest.xml:0:0 139 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/service/WatchingService.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.service; 2 | 3 | import android.app.Service; 4 | import android.content.ClipData; 5 | import android.content.ClipDescription; 6 | import android.content.ClipboardManager; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.os.Handler; 10 | import android.os.IBinder; 11 | import android.os.Message; 12 | import android.os.Vibrator; 13 | import android.text.TextUtils; 14 | import android.widget.Toast; 15 | 16 | import com.ted.jots.myjot.R; 17 | import com.ted.jots.myjot.config.ConfigManager; 18 | import com.ted.jots.myjot.data.DataManager; 19 | import com.ted.jots.myjot.data.DataModel; 20 | import com.ted.jots.myjot.listener.MobileShakeListener; 21 | import com.ted.jots.myjot.main.MainPresenter; 22 | 23 | import java.util.concurrent.atomic.AtomicBoolean; 24 | 25 | /** 26 | * Created by Ted on 2015/3/4. 27 | * WatchingService 28 | */ 29 | public class WatchingService extends Service implements MobileShakeListener.OnShakeListener, ClipboardManager.OnPrimaryClipChangedListener { 30 | public static final String RELOAD_DATA_ACTION = "com.ted.jots.myjot.reload_data"; 31 | public static final int CLOSE_SHAKE_MSG = 0x1; 32 | 33 | private MobileShakeListener mMobileShakeListener; 34 | private AtomicBoolean mShakeCallOver; 35 | private ClipboardManager mClipboardManager = null; 36 | private DataModel newDataModel; 37 | 38 | private long mLastUpdateTime = 0L; 39 | 40 | private Handler mHandler = new Handler(new Handler.Callback() { 41 | @Override 42 | public boolean handleMessage(Message message) { 43 | switch (message.what) { 44 | case CLOSE_SHAKE_MSG: 45 | stopListenShake(); 46 | break; 47 | } 48 | return false; 49 | } 50 | }); 51 | 52 | 53 | @Override 54 | public void onCreate() { 55 | super.onCreate(); 56 | mShakeCallOver = new AtomicBoolean(true); 57 | } 58 | 59 | 60 | @Override 61 | public IBinder onBind(Intent intent) { 62 | return null; 63 | } 64 | 65 | @Override 66 | public int onStartCommand(Intent intent, int flags, int startId) { 67 | mClipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 68 | mClipboardManager.addPrimaryClipChangedListener(this); 69 | return START_STICKY; 70 | } 71 | 72 | @Override 73 | public void onDestroy() { 74 | if (null != mMobileShakeListener) 75 | mMobileShakeListener.stop(); 76 | if (null != mClipboardManager) 77 | mClipboardManager.removePrimaryClipChangedListener(this); 78 | super.onDestroy(); 79 | } 80 | 81 | @Override 82 | public void onPrimaryClipChanged() { 83 | if (ConfigManager.getSupportListenClipboard(this)) { 84 | makeClipMemo(); 85 | startListenShake(); 86 | } 87 | } 88 | 89 | @Override 90 | public void onShake() { 91 | if (mShakeCallOver.compareAndSet(true, false)) { 92 | stopListenShake(); 93 | doVibrate(); 94 | onSaveClipMemo(); 95 | mShakeCallOver.set(true); 96 | } 97 | } 98 | 99 | 100 | private void makeClipMemo() { 101 | /*上一个便签插入是否结束*/ 102 | // boolean insertFinish = true; 103 | // if (!insertFinish) { 104 | // //LogUtil.e("上次插入事务尚未结束"); 105 | // return; 106 | // } 107 | long nowTime = System.currentTimeMillis(); 108 | if (nowTime - this.mLastUpdateTime < 1000L) { 109 | //LogUtil.e("与上次间隔时间太短"); 110 | return; 111 | } 112 | newDataModel = new DataModel(); 113 | ClipDescription clipDescription; 114 | ClipData clipData; 115 | StringBuilder stringBuilder; 116 | clipDescription = this.mClipboardManager.getPrimaryClipDescription(); 117 | if ((!clipDescription.hasMimeType("text/plain")) && (!clipDescription.hasMimeType("text/html"))) { 118 | //LogUtil.e("剪切板里面的不是文本内容"); 119 | return; 120 | } 121 | this.mLastUpdateTime = nowTime; 122 | clipData = this.mClipboardManager.getPrimaryClip(); 123 | stringBuilder = new StringBuilder(); 124 | int count = clipData.getItemCount(); 125 | for (int i = 0; i < count; i++) { 126 | ClipData.Item item = clipData.getItemAt(i); 127 | if (null != item) { 128 | stringBuilder.append(item.getText()); 129 | } 130 | } 131 | newDataModel.setContent(stringBuilder.toString()); 132 | } 133 | 134 | private void onSaveClipMemo() { 135 | if (null == newDataModel || TextUtils.isEmpty(newDataModel.getContent())) return; 136 | DataModel preDataModel = DataManager.readData(this); 137 | StringBuilder saveBuilder = new StringBuilder(); 138 | String preContent = preDataModel.getContent(); 139 | saveBuilder.append(preContent).append(TextUtils.isEmpty(preContent) ? "" : "\n").append(newDataModel.getContent()); 140 | newDataModel.setContent(saveBuilder.toString()); 141 | DataManager.writeData(this, newDataModel); 142 | Intent intent = new Intent(RELOAD_DATA_ACTION); 143 | Context context = getApplicationContext(); 144 | Toast.makeText(context, context.getResources().getString(R.string.have_add_clip), Toast.LENGTH_LONG).show(); 145 | sendBroadcast(intent); 146 | MainPresenter.updateMyWidget(this, newDataModel.getContent()); 147 | } 148 | 149 | private void doVibrate() { 150 | Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); 151 | long[] pattern = {100, 400}; 152 | vibrator.vibrate(pattern, -1); 153 | } 154 | 155 | private void startListenShake() { 156 | if (null == mMobileShakeListener) { 157 | mMobileShakeListener = new MobileShakeListener(this); 158 | mMobileShakeListener.setOnShakeListener(this); 159 | } 160 | mMobileShakeListener.start(); 161 | mHandler.sendEmptyMessageDelayed(CLOSE_SHAKE_MSG, ConfigManager.getConfigListenClipboardTime(this)); 162 | } 163 | 164 | private void stopListenShake() { 165 | if (null != mMobileShakeListener) { 166 | if (mShakeCallOver.compareAndSet(true, false)) { 167 | mMobileShakeListener.stop(); 168 | mShakeCallOver.set(true); 169 | } 170 | } 171 | 172 | } 173 | 174 | } 175 | 176 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/view/colorpickerview/view/ColorPanelView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Daniel Nilsson 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ted.jots.myjot.view.colorpickerview.view; 18 | 19 | import com.ted.jots.myjot.R; 20 | import com.ted.jots.myjot.view.colorpickerview.drawable.AlphaPatternDrawable; 21 | import android.content.Context; 22 | import android.content.res.TypedArray; 23 | import android.graphics.Canvas; 24 | import android.graphics.Paint; 25 | import android.graphics.Rect; 26 | import android.os.Bundle; 27 | import android.os.Parcelable; 28 | import android.util.AttributeSet; 29 | import android.util.TypedValue; 30 | import android.view.View; 31 | 32 | /** 33 | * This class draws a panel which which will be filled with a color which can be set. 34 | * It can be used to show the currently selected color which you will get from 35 | * the {@link ColorPickerView}. 36 | * @author Daniel Nilsson 37 | * 38 | */ 39 | public class ColorPanelView extends View{ 40 | 41 | /** 42 | * The width in pixels of the border 43 | * surrounding the color panel. 44 | */ 45 | private final static int BORDER_WIDTH_PX = 1; 46 | 47 | private final static int DEFAULT_BORDER_COLOR = 0xFF6E6E6E; 48 | 49 | private int mBorderColor = DEFAULT_BORDER_COLOR; 50 | private int mColor = 0xff000000; 51 | 52 | private Paint mBorderPaint; 53 | private Paint mColorPaint; 54 | 55 | private Rect mDrawingRect; 56 | private Rect mColorRect; 57 | 58 | private AlphaPatternDrawable mAlphaPattern; 59 | 60 | 61 | public ColorPanelView(Context context) { 62 | this(context, null); 63 | } 64 | 65 | public ColorPanelView(Context context, AttributeSet attrs){ 66 | this(context, attrs, 0); 67 | } 68 | 69 | public ColorPanelView(Context context, AttributeSet attrs, int defStyle) { 70 | super(context, attrs, defStyle); 71 | 72 | init(context, attrs); 73 | } 74 | 75 | @Override 76 | public Parcelable onSaveInstanceState() { 77 | 78 | Bundle state = new Bundle(); 79 | state.putParcelable("instanceState", super.onSaveInstanceState()); 80 | state.putInt("color", mColor); 81 | 82 | return state; 83 | } 84 | 85 | @Override 86 | public void onRestoreInstanceState(Parcelable state) { 87 | 88 | if (state instanceof Bundle) { 89 | Bundle bundle = (Bundle) state; 90 | mColor = bundle.getInt("color"); 91 | state = bundle.getParcelable("instanceState"); 92 | } 93 | super.onRestoreInstanceState(state); 94 | } 95 | 96 | 97 | private void init(Context context, AttributeSet attrs){ 98 | 99 | TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ColorPickerView); 100 | mBorderColor = a.getColor(R.styleable.ColorPickerView_borderColor, 0xFF6E6E6E); 101 | a.recycle(); 102 | 103 | applyThemeColors(context); 104 | 105 | mBorderPaint = new Paint(); 106 | mColorPaint = new Paint(); 107 | } 108 | 109 | private void applyThemeColors(Context c) { 110 | // If no specific border color has been 111 | // set we take the default secondary text color 112 | // as border/slider color. Thus it will adopt 113 | // to theme changes automatically. 114 | 115 | final TypedValue value = new TypedValue (); 116 | TypedArray a = c.obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorSecondary }); 117 | 118 | if(mBorderColor == DEFAULT_BORDER_COLOR) { 119 | mBorderColor = a.getColor(0, DEFAULT_BORDER_COLOR); 120 | } 121 | 122 | a.recycle(); 123 | } 124 | 125 | 126 | @Override 127 | protected void onDraw(Canvas canvas) { 128 | final Rect rect = mColorRect; 129 | 130 | if(BORDER_WIDTH_PX > 0){ 131 | mBorderPaint.setColor(mBorderColor); 132 | canvas.drawRect(mDrawingRect, mBorderPaint); 133 | } 134 | 135 | if(mAlphaPattern != null){ 136 | mAlphaPattern.draw(canvas); 137 | } 138 | 139 | mColorPaint.setColor(mColor); 140 | 141 | canvas.drawRect(rect, mColorPaint); 142 | } 143 | 144 | @Override 145 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 146 | 147 | int width = MeasureSpec.getSize(widthMeasureSpec); 148 | int height = MeasureSpec.getSize(heightMeasureSpec); 149 | 150 | setMeasuredDimension(width, height); 151 | } 152 | 153 | @Override 154 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 155 | super.onSizeChanged(w, h, oldw, oldh); 156 | 157 | mDrawingRect = new Rect(); 158 | mDrawingRect.left = getPaddingLeft(); 159 | mDrawingRect.right = w - getPaddingRight(); 160 | mDrawingRect.top = getPaddingTop(); 161 | mDrawingRect.bottom = h - getPaddingBottom(); 162 | 163 | setUpColorRect(); 164 | } 165 | 166 | private void setUpColorRect(){ 167 | final Rect dRect = mDrawingRect; 168 | 169 | int left = dRect.left + BORDER_WIDTH_PX; 170 | int top = dRect.top + BORDER_WIDTH_PX; 171 | int bottom = dRect.bottom - BORDER_WIDTH_PX; 172 | int right = dRect.right - BORDER_WIDTH_PX; 173 | 174 | mColorRect = new Rect(left,top, right, bottom); 175 | 176 | mAlphaPattern = new AlphaPatternDrawable(DrawingUtils.dpToPx(getContext(), 2)); 177 | 178 | mAlphaPattern.setBounds(Math.round(mColorRect.left), 179 | Math.round(mColorRect.top), 180 | Math.round(mColorRect.right), 181 | Math.round(mColorRect.bottom)); 182 | 183 | } 184 | 185 | /** 186 | * Set the color that should be shown by this view. 187 | * @param color 188 | */ 189 | public void setColor(int color){ 190 | mColor = color; 191 | invalidate(); 192 | } 193 | 194 | /** 195 | * Get the color currently show by this view. 196 | * @return 197 | */ 198 | public int getColor(){ 199 | return mColor; 200 | } 201 | 202 | /** 203 | * Set the color of the border surrounding the panel. 204 | * @param color 205 | */ 206 | public void setBorderColor(int color){ 207 | mBorderColor = color; 208 | invalidate(); 209 | } 210 | 211 | /** 212 | * Get the color of the border surrounding the panel. 213 | */ 214 | public int getBorderColor(){ 215 | return mBorderColor; 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /library/library.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /myJot/src/main/java/com/ted/jots/myjot/main/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ted.jots.myjot.main; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.content.IntentFilter; 7 | import android.graphics.drawable.Drawable; 8 | import android.os.Bundle; 9 | import android.os.Handler; 10 | import android.support.design.widget.Snackbar; 11 | import android.support.v4.widget.NestedScrollView; 12 | import android.support.v7.app.AppCompatActivity; 13 | import android.text.TextUtils; 14 | import android.view.KeyEvent; 15 | import android.view.View; 16 | import android.view.WindowManager; 17 | import android.widget.EditText; 18 | 19 | import com.github.clans.fab.FloatingActionMenu; 20 | import com.ted.jots.myjot.R; 21 | import com.ted.jots.myjot.config.ConfigManager; 22 | import com.ted.jots.myjot.data.DataManager; 23 | import com.ted.jots.myjot.data.DataModel; 24 | import com.ted.jots.myjot.service.WatchingService; 25 | import com.ted.jots.myjot.setting.SettingActivity; 26 | import com.ted.jots.myjot.utils.CheckDoubleClick; 27 | import com.ted.jots.myjot.utils.SystemUtil; 28 | 29 | import static com.ted.jots.myjot.config.ConfigManager.DEFAULT_HINT_COLOR; 30 | import static com.ted.jots.myjot.config.ConfigManager.DEFAULT_TEXT_COLOR; 31 | 32 | 33 | public class MainActivity extends AppCompatActivity { 34 | private static final int REQUEST_TO_SETTING_PAGE = 0x12; 35 | 36 | private EditText mInputEditText; 37 | private DataModel mOldData; 38 | private NestedScrollView mMainLayout; 39 | private FloatingActionMenu mMenuBtn; 40 | private MainMenuHelper mMainMainMenuHelper; 41 | 42 | private int mMenuItemType = -1; 43 | private Handler mUiHandler = new Handler(); 44 | /** 45 | * 针对监听服务的广播接收器 46 | */ 47 | private ServiceBroadcastReceiver mBroadcastReceiver; 48 | 49 | @Override 50 | protected void onCreate(Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | setContentView(R.layout.activity_main); 53 | initBase(); 54 | initViews(); 55 | readData(); 56 | initService(); 57 | } 58 | 59 | @Override 60 | protected void onResume() { 61 | super.onResume(); 62 | MainPresenter.updateMyWidget(this, getInputContent()); 63 | } 64 | 65 | @Override 66 | protected void onPause() { 67 | writeData(); 68 | MainPresenter.updateMyWidget(this, getInputContent()); 69 | super.onPause(); 70 | } 71 | 72 | @Override 73 | protected void onDestroy() { 74 | unregisterReceiver(mBroadcastReceiver); 75 | super.onDestroy(); 76 | } 77 | 78 | @Override 79 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 80 | super.onActivityResult(requestCode, resultCode, data); 81 | if (requestCode == REQUEST_TO_SETTING_PAGE) { 82 | onConfigColor(); 83 | } 84 | } 85 | 86 | @Override 87 | public boolean onKeyDown(int keyCode, KeyEvent event) { 88 | if (event.getRepeatCount() > 0) return true; 89 | if (keyCode == KeyEvent.KEYCODE_BACK) { 90 | if (mMenuBtn.isOpened()) { 91 | mMenuBtn.toggle(true); 92 | return true; 93 | } 94 | } 95 | return super.onKeyDown(keyCode, event); 96 | } 97 | 98 | private MainMenuHelper.MainMenuClickListener mMenuItemClickListener = new MainMenuHelper.MainMenuClickListener() { 99 | @Override 100 | public void onMenuClick(int type) { 101 | mMenuItemType = type; 102 | if (mMenuBtn.isOpened()) mMenuBtn.toggle(true); 103 | } 104 | }; 105 | 106 | 107 | private View.OnClickListener onClickListener = new View.OnClickListener() { 108 | @Override 109 | public void onClick(View view) { 110 | if (CheckDoubleClick.isFastDoubleClick()) return; 111 | switch (view.getId()) { 112 | case R.id.root_layout: 113 | SystemUtil.HideSoftInput(MainActivity.this); 114 | finish(); 115 | break; 116 | default: 117 | break; 118 | } 119 | } 120 | }; 121 | 122 | private View.OnClickListener mMenuClickListener = new View.OnClickListener() { 123 | @Override 124 | public void onClick(View view) { 125 | onClickMenuBtn(); 126 | } 127 | }; 128 | 129 | private View.OnLongClickListener mMenuLongClickListener = new View.OnLongClickListener() { 130 | @Override 131 | public boolean onLongClick(View view) { 132 | return onLongClickMenuBtn(); 133 | } 134 | }; 135 | 136 | private FloatingActionMenu.OnMenuToggleListener mMenuToggleListener = new FloatingActionMenu.OnMenuToggleListener() { 137 | @Override 138 | public void onMenuToggle(boolean opened) { 139 | Drawable drawable = MainActivity.this.getResources().getDrawable(opened ? R.drawable.close : R.drawable.pin); 140 | mMenuBtn.getMenuIconView().setImageDrawable(drawable); 141 | //点击菜单条目时要等菜单关闭之后再执行行为 142 | if (mMenuItemType < 0 || opened) return; 143 | if (mMenuItemType == MainMenuHelper.MENU_TYPE_SHARE) { 144 | onShareData(); 145 | } else if (mMenuItemType == MainMenuHelper.MENU_TYPE_SETTING) { 146 | startActivityForResult(new Intent(MainActivity.this, SettingActivity.class), REQUEST_TO_SETTING_PAGE); 147 | } else if (mMenuItemType == MainMenuHelper.MENU_TYPE_CLEAR) { 148 | clearData(); 149 | } 150 | mMenuItemType = -1; 151 | } 152 | }; 153 | 154 | private void onShareData() { 155 | String content = mInputEditText.getText().toString(); 156 | if (TextUtils.isEmpty(content)) { 157 | showNoDataSnackBar(); 158 | return; 159 | } 160 | MainPresenter.onShare(this, content); 161 | } 162 | 163 | 164 | private View.OnClickListener snackOnClickListener = new View.OnClickListener() { 165 | @Override 166 | public void onClick(View view) { 167 | if (null == mOldData) return; 168 | mInputEditText.setText(mOldData.getContent()); 169 | mInputEditText.setSelection(mOldData.getContent().length()); 170 | MainPresenter.updateMyWidget(MainActivity.this, getInputContent()); 171 | } 172 | }; 173 | 174 | private void initBase() { 175 | mOldData = new DataModel(); 176 | mBroadcastReceiver = new ServiceBroadcastReceiver(); 177 | mMainMainMenuHelper = new MainMenuHelper(mMenuItemClickListener); 178 | } 179 | 180 | private void initViews() { 181 | View mRootLayout = findViewById(R.id.root_layout); 182 | mMainLayout = (NestedScrollView) findViewById(R.id.main_bg_layout); 183 | mInputEditText = (EditText) findViewById(R.id.jot_input_edit_txt); 184 | mRootLayout.setOnClickListener(onClickListener); 185 | mMenuBtn = (FloatingActionMenu) findViewById(R.id.main_menu_btn); 186 | mMenuBtn.setClosedOnTouchOutside(true); 187 | mMenuBtn.hideMenuButton(false); 188 | mMenuBtn.setOnMenuButtonClickListener(mMenuClickListener); 189 | mMenuBtn.setOnMenuButtonLongClickListener(mMenuLongClickListener); 190 | mMenuBtn.setOnMenuToggleListener(mMenuToggleListener); 191 | mMainMainMenuHelper.initBasicMenu(mMenuBtn); 192 | mUiHandler.postDelayed(new Runnable() { 193 | @Override 194 | public void run() { 195 | mMenuBtn.showMenuButton(true); 196 | } 197 | }, 600); 198 | onConfigColor(); 199 | } 200 | 201 | private void onClickMenuBtn() { 202 | if (mMenuBtn.isOpened()) mMenuBtn.toggle(true); 203 | else { 204 | if (!ConfigManager.hasUseMenu(MainActivity.this)) { 205 | showMenuSnackBar(); 206 | return; 207 | } 208 | if (TextUtils.isEmpty(getInputContent())) { 209 | showNoDataSnackBar(); 210 | return; 211 | } 212 | SystemUtil.HideSoftInput(MainActivity.this); 213 | finish(); 214 | } 215 | } 216 | 217 | private boolean onLongClickMenuBtn(){ 218 | ConfigManager.useMenu(MainActivity.this); 219 | if (mMenuBtn.isOpened()) return true; 220 | mMenuBtn.toggle(true); 221 | return true; 222 | } 223 | 224 | private void initService() { 225 | startService(new Intent(this, WatchingService.class)); 226 | IntentFilter filter = new IntentFilter(WatchingService.RELOAD_DATA_ACTION); 227 | registerReceiver(mBroadcastReceiver, filter); 228 | } 229 | 230 | private void onConfigColor() { 231 | int bgColor = ConfigManager.getConfigAppBgColor(this); 232 | mMainLayout.setBackgroundColor(bgColor); 233 | mInputEditText.setHintTextColor(bgColor == DEFAULT_HINT_COLOR ? 234 | DEFAULT_TEXT_COLOR : DEFAULT_HINT_COLOR); 235 | mInputEditText.setTextColor(ConfigManager.getConfigAppTxtColor(this)); 236 | } 237 | 238 | private void clearData() { 239 | if (TextUtils.isEmpty(getInputContent())) { 240 | showNoDataSnackBar(); 241 | return; 242 | } 243 | String oldData = mInputEditText.getText().toString(); 244 | mOldData.setContent(oldData); 245 | mInputEditText.setText(""); 246 | writeData(); 247 | MainPresenter.updateMyWidget(this, getInputContent()); 248 | Snackbar.make(mMainLayout, R.string.you_just_clear_all_data, Snackbar.LENGTH_SHORT) 249 | .setAction(R.string.not_clear, snackOnClickListener).show(); 250 | } 251 | 252 | private void readData() { 253 | DataModel dataModel = DataManager.readData(this); 254 | String content = dataModel.getContent(); 255 | if (!TextUtils.isEmpty(content)) { 256 | mInputEditText.setText(content); 257 | mInputEditText.setSelection(content.length()); 258 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 259 | } else { 260 | 261 | getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED); 262 | mInputEditText.setText(""); 263 | mInputEditText.setFocusable(true); 264 | mInputEditText.setFocusableInTouchMode(true); 265 | mInputEditText.requestFocus(); 266 | } 267 | } 268 | 269 | private void writeData() { 270 | String content = mInputEditText.getText().toString(); 271 | DataModel dataModel = new DataModel(); 272 | dataModel.setContent(content); 273 | DataManager.writeData(this, dataModel); 274 | } 275 | 276 | 277 | private void showNoDataSnackBar() { 278 | Snackbar.make(mMainLayout, R.string.no_data_tips, Snackbar.LENGTH_SHORT).show(); 279 | } 280 | 281 | private void showMenuSnackBar() { 282 | Snackbar.make(mMainLayout, R.string.first_start_tips, Snackbar.LENGTH_LONG).setAction(R.string.i_see, new View.OnClickListener() { 283 | @Override 284 | public void onClick(View view) { 285 | ConfigManager.useMenu(MainActivity.this); 286 | onLongClickMenuBtn(); 287 | } 288 | }).show(); 289 | } 290 | 291 | 292 | private String getInputContent() { 293 | return mInputEditText.getText().toString(); 294 | } 295 | 296 | private class ServiceBroadcastReceiver extends BroadcastReceiver { 297 | @Override 298 | public void onReceive(Context context, Intent intent) { 299 | readData(); 300 | } 301 | } 302 | } 303 | -------------------------------------------------------------------------------- /myJot/myJot.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------