src\MyApplication\.idea\sonarlint\issuestore\3\4\342c9edfd27db16bba3e3455e68c749d04c55cbd
src\MyApplication\.idea\sonarlint\issuestore\6\7\67ee5a70c0947c6377cf1e29856f6a79659f84e7 src\MyApplication\.idea\sonarlint\issuestore\c\5\c5ce6afdb0606af7b3aad034a3799dc44d4d4c5c src\MyApplication\.idea\sonarlint\issuestore\index.pb src\MyApplication\app\src\main\java\com\example\administrator\myapplication\adapter\NotebookAdapter.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\app\BaseApplication.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\db\NoteDatabase.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\ui\NoteEditActivity.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\ui\WelcomeActivity.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\utils\BmobConstants.java src\MyApplication\app\src\main\java\com\example\administrator\myapplication\utils\SystemUtils.java src\MyApplication\app\src\main\res\layout\content_main.xml src\MyApplication\app\src\main\res\layout\layout_note_detail_menu.xml src\MyApplication\app\src\main\res\mipmap-hdpi\mine_avatar.jpg src\MyApplication\app\src\main\res\values\strings.xml src\MyApplication\.idea\sonarlint\issuestore\3\9\39949154a1e615e7862369e7bbdbc02d8e85f887 src\MyApplication\.idea\sonarlint\issuestore\6\7\67dcf9378cf673b1d3b665701ca8ab112314a41a src\MyApplication\.idea\sonarlint\issuestore\a\f\af19bd5acf2e10910134fc735da2908d48302bd8 src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.gitignore src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\compiler.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\copyright\profiles_settings.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\encodings.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\gradle.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\markdown-navigator\profiles_settings.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\misc.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\modules.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\.idea\runConfigurations.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\.gitignore src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\build.gradle src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\hs_err_pid14476.log src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\libs\BmobPush_v1.0.0_0627.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\libs\filechoose.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\proguard-rules.pro src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\java\cn\bmob\sdkdemo\ApplicationTest.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\AndroidManifest.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\BaseActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\BatchActionActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\BmobApplication.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\MainActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\acl\ACLActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\autoupdate\ActAutoUpdate.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\BankCard.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\GameScore.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\MyUser.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\Person.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\CRUDActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\QueryActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\QuerySQLActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\QueryStatisticActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\BmobFileActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\Movie.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\Song.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\location\LocationActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\permission\PermissionListener.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\permission\PermissionManager.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\push\ActBmobPush.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\push\MyBmobInstallation.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\Comment.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\CommentListActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\Post.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\WeiboListActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\sms\SMSCodeActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\user\UserActivity.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\drawable\selector_button.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\drawable\selector_list_item.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\act_push.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_code.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_comment.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_file.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_find.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_local_thumbnail.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_main.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_new_file.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\activity_weibo.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\item_list.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\list_item.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\list_item_weibo.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-hdpi\ic_launcher.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-mdpi\ic_launcher.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values-w820dp\dimens.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\colors.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\dimens.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\strings.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\styles.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\java\cn\bmob\sdkdemo\ExampleUnitTest.java src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\build.gradle src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\gradle.properties src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\gradle\wrapper\gradle-wrapper.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\gradle\wrapper\gradle-wrapper.properties src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\gradlew src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\gradlew.bat src\MyApplication\libs\BmobSDKDemo_v3.6.0\BmobDemo\settings.gradle src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\BmobSDK_3.6.0_20180321.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\arm64-v8a\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\armeabi-v7a\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\armeabi\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\mips\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\mips64\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\okio-1.12.0.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\org.apache.http.legacy.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\rxandroid-1.2.0.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\rxjava-1.1.6.jar src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\x86\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\libs\x86_64\libbmob.so src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_off_focused_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_off_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_off_pressed_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_on_focused_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_on_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_btn_check_on_pressed_holo_light.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_close_bg_normal.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable-hdpi\bmob_update_close_bg_tap.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_cancel_bg_focused.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_cancel_bg_normal.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_cancel_bg_selector.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_cancel_bg_tap.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_check_selector.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_close_bg_selector.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_ok_bg_focused.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_ok_bg_normal.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_ok_bg_selector.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_button_ok_bg_tap.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_dialog_bg.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\drawable\bmob_update_wifi_disable.png src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\layout\bmob_update_dialog.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\values\bmob_common_strings.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\res\values\bmob_update_string.xml src\MyApplication\libs\BmobSDKDemo_v3.6.0\更新日志.txt src\MyApplication\libs\BmobSDKDemo_v3.6.0\用前须知_多谢合作.txt src\MyApplication\libs\__MACOSX\._BmobSDKDemo_v3.6.0 src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._BmobDemo src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._libs src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._res src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._更新日志.txt src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\._用前须知_多谢合作.txt src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._.gitignore src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._.gradle src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._.idea src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._app src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._build.gradle src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._gradle src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._gradle.properties src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._gradlew src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._gradlew.bat src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._local.properties src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\._settings.gradle src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._compiler.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._copyright src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._encodings.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._gradle.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._markdown-navigator src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._modules.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\._runConfigurations.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\copyright\._profiles_settings.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\.idea\markdown-navigator\._profiles_settings.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._.gitignore src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._hs_err_pid14476.log src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._libs src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._proguard-rules.pro src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\._src src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\build\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\libs\._BmobPush_v1.0.0_0627.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\libs\._filechoose.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\._androidTest src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\._main src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\._test src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\._java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\java\._cn src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\java\cn\._bmob src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\java\cn\bmob\._sdkdemo src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\androidTest\java\cn\bmob\sdkdemo\._ApplicationTest.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\._java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\._res src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\._cn src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\._bmob src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\._sdkdemo src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._BaseActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._BatchActionActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._MainActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._acl src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._autoupdate src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._bean src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._crud src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._file src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._location src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._permission src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._push src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._relation src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._sms src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\._user src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\acl\._ACLActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\autoupdate\._ActAutoUpdate.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\._BankCard.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\._GameScore.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\._MyUser.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\bean\._Person.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\._CRUDActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\._QueryActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\._QuerySQLActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\crud\._QueryStatisticActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\._BmobFileActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\._Movie.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\file\._Song.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\location\._LocationActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\permission\._PermissionListener.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\permission\._PermissionManager.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\push\._MyBmobInstallation.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\._Comment.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\._CommentListActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\._Post.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\relation\._WeiboListActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\sms\._SMSCodeActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\java\cn\bmob\sdkdemo\user\._UserActivity.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._drawable src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._layout src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._mipmap-hdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._mipmap-mdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._mipmap-xhdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._mipmap-xxhdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._mipmap-xxxhdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._values src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\._values-w820dp src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\drawable\._selector_button.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\drawable\._selector_list_item.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._act_push.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_code.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_comment.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_file.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_find.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_local_thumbnail.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_main.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_new_file.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._activity_weibo.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._item_list.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._list_item.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\layout\._list_item_weibo.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-hdpi\._ic_launcher.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-mdpi\._ic_launcher.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xhdpi\._ic_launcher.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xxhdpi\._ic_launcher.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\mipmap-xxxhdpi\._ic_launcher.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values-w820dp\._dimens.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\._colors.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\._dimens.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\._strings.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\main\res\values\._styles.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\._java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\java\._cn src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\java\cn\._bmob src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\java\cn\bmob\._sdkdemo src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\app\src\test\java\cn\bmob\sdkdemo\._ExampleUnitTest.java src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\build\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\gradle\._wrapper src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\gradle\wrapper\._gradle-wrapper.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\BmobDemo\gradle\wrapper\._gradle-wrapper.properties src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._arm64-v8a src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._armeabi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._armeabi-v7a src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._mips src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._mips64 src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._okio-1.12.0.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._org.apache.http.legacy.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._rxandroid-1.2.0.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._rxjava-1.1.6.jar src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._x86 src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\._x86_64 src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\arm64-v8a\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\arm64-v8a\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\armeabi-v7a\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\armeabi-v7a\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\armeabi\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\armeabi\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\mips\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\mips\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\mips64\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\mips64\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\x86\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\x86\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\x86_64\._.DS_Store src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\libs\x86_64\._libbmob.so src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\._drawable src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\._drawable-hdpi src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\._layout src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\._values src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_off_focused_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_off_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_off_pressed_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_on_focused_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_on_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_btn_check_on_pressed_holo_light.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_close_bg_normal.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable-hdpi\._bmob_update_close_bg_tap.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_cancel_bg_focused.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_cancel_bg_normal.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_cancel_bg_selector.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_cancel_bg_tap.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_check_selector.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_close_bg_selector.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_ok_bg_focused.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_ok_bg_normal.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_ok_bg_selector.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_button_ok_bg_tap.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_dialog_bg.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\drawable\._bmob_update_wifi_disable.png src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\layout\._bmob_update_dialog.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\values\._bmob_common_strings.xml src\MyApplication\libs\__MACOSX\BmobSDKDemo_v3.6.0\res\values\._bmob_update_string.xml
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
vsquid:S3008"\Rename this field "BMOB_PICTURE_PATH" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(²Ó˜Àûÿÿÿÿ
|
|
||||||
Qsquid:S1444"7Make this "public static BMOB_PICTURE_PATH" field final(²Ó˜Àûÿÿÿÿ
|
|
||||||
ƒ"squid:ClassVariableVisibilityCheck"WMake MyAvatarDir a static final constant or non-public and provide accessors if needed.(š¸°‚
|
|
||||||
Tsquid:S1118":Add a private constructor to hide the implicit public one.(¯¨×¼ýÿÿÿÿ
|
Tsquid:S1118":Add a private constructor to hide the implicit public one.(¯¨×¼ýÿÿÿÿ
|
||||||
Fsquid:S1444"1Make this "public static MyAvatarDir" field final(š¸°‚
|
|
||||||
Gsquid:S1135"2Complete the task associated to this TODO comment.(Üð£Å
|
|
||||||
Ž"squid:ClassVariableVisibilityCheck"]Make BMOB_PICTURE_PATH a static final constant or non-public and provide accessors if needed.(²Ó˜Àûÿÿÿÿ
|
Ž"squid:ClassVariableVisibilityCheck"]Make BMOB_PICTURE_PATH a static final constant or non-public and provide accessors if needed.(²Ó˜Àûÿÿÿÿ
|
||||||
ksquid:S3008"VRename this field "MyAvatarDir" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(š¸°‚
|
psquid:S3008"VRename this field "MyAvatarDir" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ßöÆúÿÿÿÿ
|
||||||
|
Qsquid:S1444"7Make this "public static BMOB_PICTURE_PATH" field final(²Ó˜Àûÿÿÿÿ
|
||||||
|
ˆ"squid:ClassVariableVisibilityCheck"WMake MyAvatarDir a static final constant or non-public and provide accessors if needed.(ßöÆúÿÿÿÿ
|
||||||
|
vsquid:S3008"\Rename this field "BMOB_PICTURE_PATH" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(²Ó˜Àûÿÿÿÿ
|
||||||
|
Ksquid:S1444"1Make this "public static MyAvatarDir" field final(ßöÆúÿÿÿÿ
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
isquid:MaximumInheritanceDepth"=This class has 10 parents which is greater than 5 authorized.(à›“üüÿÿÿÿ
|
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
_squid:HiddenFieldCheck":Rename "drawer" which hides the field declared at line 41.(ÐÍè¨þÿÿÿÿ
|
||||||
|
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(üêÝ/
|
||||||
|
bsquid:CallToDeprecatedMethod"=Remove this use of "setBackgroundDrawable"; it is deprecated.(”›õV
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¡…•æùÿÿÿÿ
|
||||||
|
isquid:MaximumInheritanceDepth"=This class has 10 parents which is greater than 5 authorized.(ù ®Íúÿÿÿÿ
|
||||||
|
qsquid:S1450"WRemove the "baseView" field and declare it as a local variable in the relevant methods.(‘‚¼²þÿÿÿÿ
|
||||||
|
_squid:HiddenFieldCheck":Rename "drawer" which hides the field declared at line 41.(ÐÍè¨þÿÿÿÿ
|
||||||
|
Asquid:S1905",Remove this unnecessary cast to "ImageView".(ÆïË”
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ô侄
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(”“ɉúÿÿÿÿ
|
||||||
|
dsquid:CallToDeprecatedMethod"9Remove this use of "setDrawerListener"; it is deprecated.(ø¶Âßÿÿÿÿÿ
|
||||||
|
ysquid:S1450"_Remove the "noteBookFragment" field and declare it as a local variable in the relevant methods.(Óé«ùÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Û¿’<C2BF>ýÿÿÿÿ
|
||||||
|
ssquid:S1450"YRemove the "isFirstUse" field and declare it as a local variable in the relevant methods.(ÃÑ<C383><C391>ûÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(–“Å<E2809C>ýÿÿÿÿ
|
|
@ -1,24 +1,24 @@
|
||||||
|
|
||||||
‚squid:S1192"hDefine a constant instead of duplicating this literal "好东西è¦<C3A8>与å°<C3A5>伙伴们一起分享" 3 times.(Á…Ï¿úÿÿÿÿ
|
‚squid:S1192"hDefine a constant instead of duplicating this literal "好东西è¦<C3A8>与å°<C3A5>伙伴们一起分享" 3 times.(Á…Ï¿úÿÿÿÿ
|
||||||
Gsquid:S1135"2Complete the task associated to this TODO comment.(ÉÚõÎ
|
|
||||||
;squid:S1170"!Make this final field static too.(¯¶±Ÿýÿÿÿÿ
|
|
||||||
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÿ¨¬j
|
|
||||||
Lsquid:S2589"7Remove this expression which always evaluates to "true"(ÿý†
|
Lsquid:S2589"7Remove this expression which always evaluates to "true"(ÿý†
|
||||||
usquid:S1488"[Immediately return this expression instead of assigning it to the temporary variable "pre".(úš ¡ùÿÿÿÿ
|
|
||||||
lsquid:S00116"VRename this field "BG_PIC_PATH" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¥òûŸ
|
|
||||||
6squid:S1170"!Make this final field static too.(¥òûŸ
|
|
||||||
=squid:S1148"#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÆΰÇ
|
|
||||||
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(àˆüz
|
|
||||||
_squid:S1192"JDefine a constant instead of duplicating this literal "share.jpg" 3 times.(ãî<C3A3>Ö
|
|
||||||
Vsquid:S1126"AReplace this if-then-else statement by a single return statement.(ýðÞ¬
|
|
||||||
esquid:CallToDeprecatedMethod":Remove this use of "MODE_MULTI_PROCESS"; it is deprecated.(Žù›‡ûÿÿÿÿ
|
|
||||||
osquid:S00116"TRename this field "PREF_NAME" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(«ú±ôøÿÿÿÿ
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(†€éˆ
|
|
||||||
=squid:S1148"#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
|
|
||||||
tsquid:S00116"YRename this field "KEY_NOTE_DRAFT" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¯¶±Ÿýÿÿÿÿ
|
|
||||||
esquid:CallToDeprecatedMethod":Remove this use of "MODE_MULTI_PROCESS"; it is deprecated.(Žù›‡ûÿÿÿÿ
|
|
||||||
Lsquid:S1135"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¸¯þŸøÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(<28>Žª´ÿÿÿÿÿ
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(<28>Žª´ÿÿÿÿÿ
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¯Öýã
|
tsquid:S00116"YRename this field "KEY_NOTE_DRAFT" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¯¶±Ÿýÿÿÿÿ
|
||||||
|
=squid:S1148"#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
|
||||||
|
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(àˆüz
|
||||||
|
lsquid:S00116"VRename this field "BG_PIC_PATH" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¥òûŸ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(†€éˆ
|
||||||
|
;squid:S1170"!Make this final field static too.(¯¶±Ÿýÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¯Öýã
|
||||||
|
6squid:S1170"!Make this final field static too.(¥òûŸ
|
||||||
|
Gsquid:S1135"2Complete the task associated to this TODO comment.(ÉÚõÎ
|
||||||
|
Vsquid:S1126"AReplace this if-then-else statement by a single return statement.(ýðÞ¬
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¸¯þŸøÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÆΰÇ
|
||||||
|
_squid:S1192"JDefine a constant instead of duplicating this literal "share.jpg" 3 times.(ãî<C3A3>Ö
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ
|
||||||
|
esquid:CallToDeprecatedMethod":Remove this use of "MODE_MULTI_PROCESS"; it is deprecated.(Žù›‡ûÿÿÿÿ
|
||||||
|
esquid:CallToDeprecatedMethod":Remove this use of "MODE_MULTI_PROCESS"; it is deprecated.(Žù›‡ûÿÿÿÿ
|
||||||
|
usquid:S1488"[Immediately return this expression instead of assigning it to the temporary variable "pre".(úš ¡ùÿÿÿÿ
|
||||||
|
osquid:S00116"TRename this field "PREF_NAME" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(«ú±ôøÿÿÿÿ
|
||||||
|
=squid:S1148"#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
|
||||||
|
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÿ¨¬j
|
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
Fsquid:S1905"1Remove this unnecessary cast to "RelativeLayout".(Þˆ½ð
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(øëîîûÿÿÿÿ
|
||||||
|
lsquid:S00117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ò‡¨æÿÿÿÿÿ
|
||||||
|
csquid:CallToDeprecatedMethod"=Remove this use of "setBackgroundDrawable"; it is deprecated.(õÒþ†
|
||||||
|
lsquid:S00117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(è<>‚Œýÿÿÿÿ
|
||||||
|
Gsquid:S1135"2Complete the task associated to this TODO comment.(÷…¡’
|
||||||
|
msquid:S00116"XRename this field "layout_choose" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(…ϱ
|
||||||
|
|
||||||
|
Qsquid:S1854"<Remove this useless assignment to local variable "filename".(ÉÍÛÏ
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
rsquid:S00116"WRename this field "layout_photo" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(òºûªùÿÿÿÿ
|
||||||
|
Vsquid:CallToDeprecatedMethod"0Remove this use of "getColor"; it is deprecated.(ìÈô®
|
||||||
|
Jsquid:S2209"5Change this instance-reference to a static reference.(¹þ¢Ð
|
||||||
|
Ksquid:S1153"1Directly append the argument of String.valueOf().(¼£Áóúÿÿÿÿ
|
||||||
|
Ksquid:S1905"1Remove this unnecessary cast to "RelativeLayout".(ö… Ûûÿÿÿÿ
|
||||||
|
N"squid:SwitchLastCaseIsDefaultCheck""Add a default case to this switch.(ì¼—û
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(¿ëÏýýÿÿÿÿ
|
||||||
|
dsquid:MaximumInheritanceDepth"=This class has 10 parents which is greater than 5 authorized.(¾ô×
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
Ysquid:CallToDeprecatedMethod"3Remove this use of "getDrawable"; it is deprecated.(õÒþ†
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ê<> •þÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ïðóºÿÿÿÿÿ
|
||||||
|
6squid:S1170"!Make this final field static too.(…Ù“Ý
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
Bsquid:S1481"-Remove this unused "filename" local variable.(ÉÍÛÏ
|
||||||
|
6squid:S1170"!Make this final field static too.(…Ù“Ý
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÎæžÔ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(»»¶¨ýÿÿÿÿ
|
||||||
|
[squid:CallToDeprecatedMethod"0Remove this use of "getColor"; it is deprecated.(<28>±¨äùÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Îí÷îüÿÿÿÿ
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
^squid:CallToDeprecatedMethod"3Remove this use of "getDrawable"; it is deprecated.(Ó“–õûÿÿÿÿ
|
||||||
|
S"squid:SwitchLastCaseIsDefaultCheck""Add a default case to this switch.(ד¾ñùÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ø¦öé
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
rsquid:S00116"\Rename this field "UPDATE_USER_EMAIL" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(…Ù“Ý
|
||||||
|
Fsquid:S1905",Remove this unnecessary cast to "ImageView".(Ыגøÿÿÿÿ
|
||||||
|
asquid:CallToDeprecatedMethod"6Remove this use of "BitmapDrawable"; it is deprecated.(¹›„Ôþÿÿÿÿ
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ߣ¾¨ùÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÌÀç®
|
||||||
|
lsquid:S3776"RRefactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.(ÉÎÍïýÿÿÿÿ
|
||||||
|
Dsquid:S1659"/Declare "UPDATE_USER_EMAIL" on a separate line.(…Ù“Ý
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(‰™ö¿ùÿÿÿÿ
|
||||||
|
6squid:S1170"!Make this final field static too.(…Ù“Ý
|
||||||
|
Esquid:S1481"+Remove this unused "et_pwd" local variable.(ò‡¨æÿÿÿÿÿ
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ƒøüçøÿÿÿÿ
|
||||||
|
_squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÂÚÂ~
|
||||||
|
Ysquid:CallToDeprecatedMethod"3Remove this use of "getDrawable"; it is deprecated.(ü–áÔ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(綸<C2B6>þÿÿÿÿ
|
||||||
|
usquid:S00116"_Rename this field "UPDATE_USER_DIARYPWD" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(…Ù“Ý
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(õõɲúÿÿÿÿ
|
||||||
|
Esquid:S1905"+Remove this unnecessary cast to "EditText".(ó®µøÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(š’¨Å
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ø¦öé
|
||||||
|
Lsquid:S1135"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Æ·ÂÖûÿÿÿÿ
|
||||||
|
Gsquid:S1659"2Declare "UPDATE_USER_NICKNAME" on a separate line.(…Ù“Ý
|
||||||
|
Jsquid:S1068"0Remove this unused "mPopupWindow" private field.(°ëœÊýÿÿÿÿ
|
||||||
|
€"squid:ClassVariableVisibilityCheck"TMake filePath a static final constant or non-public and provide accessors if needed.(•ê£’
|
||||||
|
hsquid:CallToDeprecatedMethod"=Remove this use of "setBackgroundDrawable"; it is deprecated.(Ó“–õûÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(˾æ´
|
||||||
|
Ksquid:S1153"1Directly append the argument of String.valueOf().(<28>áÌÑøÿÿÿÿ
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(£ˆ¾è
|
||||||
|
Esquid:S1068"+Remove this unused "userSex" private field.(Û®¼–úÿÿÿÿ
|
||||||
|
usquid:S00116"_Rename this field "UPDATE_USER_NICKNAME" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(…Ù“Ý
|
|
@ -1,34 +1,34 @@
|
||||||
|
|
||||||
=squid:S1481")Remove this unused "list" local variable.(Ì¿Íh
|
|
||||||
lsquid:S00117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(쇯Úþÿÿÿÿ
|
|
||||||
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(쇯Úþÿÿÿÿ
|
|
||||||
Lsquid:S1854"8Remove this useless assignment to local variable "list".(Ì¿Íh
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(<28>ÄŠæ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ßÕù•ýÿÿÿÿ
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ú°à¬
|
|
||||||
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(¹ó¯™
|
|
||||||
‘squid:S1845"|Rename method "Login" to prevent any misunderstanding/clash with method "login" defined in superclass "cn.bmob.v3.BmobUser".(¹ó¯™
|
|
||||||
hsquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÐÀχ
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(òü€–
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(òü€–
|
||||||
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(·üÏÏúÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(°þíÈÿÿÿÿÿ
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(°þíÈÿÿÿÿÿ
|
||||||
[squid:UnusedPrivateMethod"3Remove this unused private "updateUserHead" method.(¤È‚Ìýÿÿÿÿ
|
|
||||||
hsquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(¹¶Á»
|
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ôˆ«¿
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ôˆ«¿
|
||||||
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.( µâ²
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ßÕù•ýÿÿÿÿ
|
||||||
msquid:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ì¿Íh
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÒäÕ§
|
||||||
`squid:UselessImportCheck">Remove this unused import 'cn.bmob.v3.listener.LogInListener'.(ØÖü³
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ú°à¬
|
||||||
fsquid:UselessImportCheck"?Remove this unused import 'cn.bmob.v3.exception.BmobException'.(Æš…Åùÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(™ØÓ¯ûÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ò£èÄûÿÿÿÿ
|
|
||||||
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(㑨<E28098>úÿÿÿÿ
|
|
||||||
dsquid:S00100"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¹ó¯™
|
dsquid:S00100"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¹ó¯™
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ú°à¬
|
||||||
|
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÆŸßêùÿÿÿÿ
|
||||||
|
`squid:UselessImportCheck">Remove this unused import 'cn.bmob.v3.listener.LogInListener'.(ØÖü³
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(㑨<E28098>úÿÿÿÿ
|
||||||
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(™ØÓ¯ûÿÿÿÿ
|
||||||
|
fsquid:UselessImportCheck"?Remove this unused import 'cn.bmob.v3.exception.BmobException'.(Æš…Åùÿÿÿÿ
|
||||||
|
[squid:UnusedPrivateMethod"3Remove this unused private "updateUserHead" method.(¤È‚Ìýÿÿÿÿ
|
||||||
~squid:UselessImportCheck"\Remove this unused import 'com.nostra13.universalimageloader.core.ImageLoaderConfiguration'.(좣±
|
~squid:UselessImportCheck"\Remove this unused import 'com.nostra13.universalimageloader.core.ImageLoaderConfiguration'.(좣±
|
||||||
|
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÕÓí³þÿÿÿÿ
|
||||||
|
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(·üÏÏúÿÿÿÿ
|
||||||
|
lsquid:S00117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(쇯Úþÿÿÿÿ
|
||||||
|
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.( µâ²
|
||||||
|
=squid:S1481")Remove this unused "list" local variable.(Ì¿Íh
|
||||||
|
hsquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÐÀχ
|
||||||
|
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(“¨ëø
|
||||||
|
‘squid:S1845"|Rename method "Login" to prevent any misunderstanding/clash with method "login" defined in superclass "cn.bmob.v3.BmobUser".(¹ó¯™
|
||||||
|
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(<28>ÄŠæ
|
||||||
|
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(¹ó¯™
|
||||||
|
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(©²ŒÌÿÿÿÿÿ
|
||||||
nsquid:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ÚÒîÊ
|
nsquid:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(ÚÒîÊ
|
||||||
squid:UselessImportCheck"XRemove this unused import 'com.example.administrator.myapplication.app.BaseApplication'.(‘”ÛÓúÿÿÿÿ
|
squid:UselessImportCheck"XRemove this unused import 'com.example.administrator.myapplication.app.BaseApplication'.(‘”ÛÓúÿÿÿÿ
|
||||||
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(©²ŒÌÿÿÿÿÿ
|
esquid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ò£èÄûÿÿÿÿ
|
||||||
–squid:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(“¨ëø
|
Lsquid:S1854"8Remove this useless assignment to local variable "list".(Ì¿Íh
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(ÒäÕ§
|
hsquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(¹¶Á»
|
||||||
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÆŸßêùÿÿÿÿ
|
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(쇯Úþÿÿÿÿ
|
||||||
msquid:ModifiersOrderCheck"EReorder the modifiers to comply with the Java Language Specification.(ÕÓí³þÿÿÿÿ
|
msquid:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(Ì¿Íh
|
||||||
`squid:CommentedOutCodeLine"<This block of commented-out lines of code should be removed.(Ú°à¬
|
|
|
@ -1,27 +1,15 @@
|
||||||
|
|
||||||
<
|
<
|
||||||
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
|
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
|
||||||
|
|
||||||
Oapp\src\main\java\com\example\administrator\myapplication\utils\DialogHelp.java,9\5\954e8115c9434902b13d9840c149e0ff3fe59df2
|
|
||||||
‚
|
|
||||||
Rapp\src\main\java\com\example\administrator\myapplication\utils\HTQAnimations.java,6\5\65764ff37783669e71501692a607a3cea49c4bdc
|
|
||||||
z
|
z
|
||||||
Japp\src\main\java\com\example\administrator\myapplication\entity\User.java,c\5\c5ce6afdb0606af7b3aad034a3799dc44d4d4c5c
|
Japp\src\main\java\com\example\administrator\myapplication\entity\User.java,c\5\c5ce6afdb0606af7b3aad034a3799dc44d4d4c5c
|
||||||
…
|
|
||||||
Uapp\src\main\java\com\example\administrator\myapplication\widget\CircleImageView.java,d\2\d2c92a556e47fd0e9a3fa038dbf835129e2f5090
|
|
||||||
„
|
|
||||||
Tapp\src\main\java\com\example\administrator\myapplication\ui\AlarmAlertActivity.java,6\0\6017e946e5380fbd8e8ec44cf82432536cb0c89d
|
|
||||||
P
|
|
||||||
app\src\main\AndroidManifest.xml,a\c\ac6e0c942798c8a768fab2e3ab7e6a6b69b346f1
|
|
||||||
<EFBFBD>
|
|
||||||
Qapp\src\main\java\com\example\administrator\myapplication\ui\WelcomeActivity.java,f\4\f4db46de912ee15bd8dff2e67791e614cfdc8ae8
|
|
||||||
‚
|
‚
|
||||||
Rapp\src\main\java\com\example\administrator\myapplication\ui\AboutAppFragment.java,2\4\2432e00ff27b3c4e488bc12d8149cc4f0583cb71
|
Rapp\src\main\java\com\example\administrator\myapplication\utils\BmobConstants.java,3\4\342c9edfd27db16bba3e3455e68c749d04c55cbd
|
||||||
‡
|
|
||||||
Wapp\src\main\java\com\example\administrator\myapplication\adapter\BgPicGridAdapter.java,0\3\037b293928bff3f763d72038512124d16aebd627
|
|
||||||
<EFBFBD>
|
|
||||||
Qapp\src\main\java\com\example\administrator\myapplication\ui\SettingFragment.java,9\f\9f49ae81d31735cbb5ea0dec8c22fb85771170ad
|
|
||||||
|
|
||||||
Oapp\src\main\java\com\example\administrator\myapplication\ui\LoginActivity.java,d\9\d9f0b00bd9259256a0cc6a48eb4c59665266c4ea
|
|
||||||
‚
|
‚
|
||||||
Rapp\src\main\java\com\example\administrator\myapplication\ui\RegisterActivity.java,d\5\d5b72c9513d313bcf937771f4e19798894789154
|
Rapp\src\main\java\com\example\administrator\myapplication\ui\UserInfoActivity.java,a\f\af19bd5acf2e10910134fc735da2908d48302bd8
|
||||||
|
‚
|
||||||
|
Rapp\src\main\java\com\example\administrator\myapplication\ui\NoteEditActivity.java,3\9\39949154a1e615e7862369e7bbdbc02d8e85f887
|
||||||
|
€
|
||||||
|
Papp\src\main\java\com\example\administrator\myapplication\utils\SystemUtils.java,6\7\67ee5a70c0947c6377cf1e29856f6a79659f84e7
|
||||||
|
~
|
||||||
|
Napp\src\main\java\com\example\administrator\myapplication\ui\MainActivity.java,6\7\67dcf9378cf673b1d3b665701ca8ab112314a41a
|
|
@ -1,6 +1,9 @@
|
||||||
package com.example.administrator.myapplication.adapter;
|
package com.example.administrator.myapplication.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.provider.CalendarContract;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -88,6 +91,7 @@ public class NotebookAdapter extends BaseAdapter implements HTQDragGridView.Drag
|
||||||
datas.get(position).setIid(position);
|
datas.get(position).setIid(position);
|
||||||
NotebookData data = datas.get(position);
|
NotebookData data = datas.get(position);
|
||||||
|
|
||||||
|
ViewHolder holder = null;
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
v = View.inflate(aty, R.layout.item_notebook, null);
|
v = View.inflate(aty, R.layout.item_notebook, null);
|
||||||
|
@ -104,7 +108,7 @@ public class NotebookAdapter extends BaseAdapter implements HTQDragGridView.Drag
|
||||||
LayoutParams params = (LayoutParams) holder.content
|
LayoutParams params = (LayoutParams) holder.content
|
||||||
.getLayoutParams();
|
.getLayoutParams();
|
||||||
params.width = width;
|
params.width = width;
|
||||||
params.height = params.width - height;
|
params.height = (params.width - height);
|
||||||
holder.content.setLayoutParams(params);
|
holder.content.setLayoutParams(params);
|
||||||
|
|
||||||
holder.titleBar
|
holder.titleBar
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.example.administrator.myapplication.app;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.example.administrator.myapplication.utils.AccountUtils;
|
|
||||||
import com.example.administrator.myapplication.utils.BmobConstants;
|
import com.example.administrator.myapplication.utils.BmobConstants;
|
||||||
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
|
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache;
|
||||||
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
|
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
|
||||||
|
@ -23,7 +22,7 @@ import cn.bmob.v3.Bmob;
|
||||||
public class BaseApplication extends Application {
|
public class BaseApplication extends Application {
|
||||||
|
|
||||||
|
|
||||||
private String ApplicationId="d1ee9b58531115c8f6d57b1efe8b24bf";
|
private String ApplicationId="82cacaa4470ab6b8d61d3f0ce6d6201d";
|
||||||
static public String avatarPath= BmobConstants.MyAvatarDir+"avatarIcon.png";
|
static public String avatarPath= BmobConstants.MyAvatarDir+"avatarIcon.png";
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class NoteDatabase {
|
||||||
StringUtils.getDataTime("dddHHmmss"), 0));
|
StringUtils.getDataTime("dddHHmmss"), 0));
|
||||||
}
|
}
|
||||||
editData.setUnixTime(StringUtils.getDataTime("yyyy-MM-dd HH:mm:ss"));
|
editData.setUnixTime(StringUtils.getDataTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
editData.setContent("欢迎使用颖火虫记事本,赶快记下你此刻的灵感吧!");
|
editData.setContent("欢迎使用嗖藏,赶快记下你此刻的灵感吧!");
|
||||||
editData.setUserId(AccountUtils.getUserId(context));
|
editData.setUserId(AccountUtils.getUserId(context));
|
||||||
save(editData);
|
save(editData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.example.administrator.myapplication.R;
|
import com.example.administrator.myapplication.R;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by htq on 2016/8/9.
|
|
||||||
*/
|
|
||||||
public class NoteEditActivity extends AppCompatActivity {
|
public class NoteEditActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import com.example.administrator.myapplication.entity.User;
|
||||||
import com.example.administrator.myapplication.utils.SPUtils;
|
import com.example.administrator.myapplication.utils.SPUtils;
|
||||||
import com.example.administrator.myapplication.utils.SystemUtils;
|
import com.example.administrator.myapplication.utils.SystemUtils;
|
||||||
|
|
||||||
|
import cn.bmob.v3.Bmob;
|
||||||
import cn.bmob.v3.listener.SaveListener;
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ public class WelcomeActivity extends AppCompatActivity {
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
setContentView(R.layout.activity_welcome);
|
setContentView(R.layout.activity_welcome);
|
||||||
|
Bmob.initialize(this, "82cacaa4470ab6b8d61d3f0ce6d6201d");
|
||||||
//初始化bmob
|
//初始化bmob
|
||||||
// String libName = "bmob";
|
// String libName = "bmob";
|
||||||
// System.loadLibrary(libName );
|
// System.loadLibrary(libName );
|
||||||
|
|
|
@ -4,12 +4,6 @@ import android.annotation.SuppressLint;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName: BmobConstants
|
|
||||||
* @Description: TODO
|
|
||||||
* @author smile
|
|
||||||
* @date 2014-6-19 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>2:48:33
|
|
||||||
*/
|
|
||||||
@SuppressLint("SdCardPath")
|
@SuppressLint("SdCardPath")
|
||||||
public class BmobConstants {
|
public class BmobConstants {
|
||||||
|
|
||||||
|
@ -21,7 +15,7 @@ public class BmobConstants {
|
||||||
/**
|
/**
|
||||||
* <EFBFBD>ҵ<EFBFBD>ͷ<EFBFBD><EFBFBD>Ŀ¼
|
* <EFBFBD>ҵ<EFBFBD>ͷ<EFBFBD><EFBFBD>Ŀ¼
|
||||||
*/
|
*/
|
||||||
public static String MyAvatarDir = "/sdcard/beautynote/avatar/";
|
public static String MyAvatarDir = "/sdcard/soucang/avatar/";
|
||||||
/**
|
/**
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>ջص<EFBFBD>
|
* <EFBFBD><EFBFBD><EFBFBD>ջص<EFBFBD>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,6 +20,8 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by htq on 2016/8/10.
|
* Created by htq on 2016/8/10.
|
||||||
*/
|
*/
|
||||||
|
@ -109,7 +111,6 @@ public boolean isTarn()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存背景皮肤图片的地址
|
* 保存背景皮肤图片的地址
|
||||||
* @author: htq
|
|
||||||
*/
|
*/
|
||||||
public void saveBgPicPath(String path)
|
public void saveBgPicPath(String path)
|
||||||
{
|
{
|
||||||
|
@ -142,13 +143,13 @@ public boolean isTarn()
|
||||||
*/
|
*/
|
||||||
public static void shareApp(Activity mActivity)
|
public static void shareApp(Activity mActivity)
|
||||||
{
|
{
|
||||||
String shareAppContent="各位亲爱的小伙伴们,我发现了一款非常好用且颜值爆表的记事本App,分享给大家,记得关注作者的博客http://blog.csdn.net/htq__,福利多多哦!";
|
String shareAppContent="各位亲爱的小伙伴们,我发现了一款非常好用且颜值爆表的一件收藏App,分享给大家";
|
||||||
|
|
||||||
new File(mActivity.getFilesDir(), "share.jpg").deleteOnExit();
|
new File(mActivity.getFilesDir(), "share.jpg").deleteOnExit();
|
||||||
FileOutputStream fileOutputStream=null;
|
FileOutputStream fileOutputStream=null;
|
||||||
try {
|
try {
|
||||||
fileOutputStream = mActivity.openFileOutput(
|
fileOutputStream = mActivity.openFileOutput(
|
||||||
"share.jpg", 1);
|
"share.jpg", MODE_PRIVATE);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
android:visibility="visible" >
|
android:visibility="visible" >
|
||||||
|
|
||||||
|
|
||||||
<com.htq.baidu.coolnote.widget.HTQDragGridView
|
<com.example.administrator.myapplication.widget.HTQDragGridView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:numColumns="2" />
|
android:numColumns="2" />
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
app:border_color="@color/white"
|
app:border_color="@color/white"
|
||||||
app:border_width="2dip" />
|
app:border_width="2dip" />
|
||||||
|
|
||||||
<com.htq.baidu.coolnote.widget.NoteItemCircleView
|
<com.example.administrator.myapplication.widget.NoteItemCircleView
|
||||||
android:id="@+id/note_detail_img_purple"
|
android:id="@+id/note_detail_img_purple"
|
||||||
style="@style/note_detail_menu_item"
|
style="@style/note_detail_menu_item"
|
||||||
android:layout_alignLeft="@+id/note_detail_img_menu"
|
android:layout_alignLeft="@+id/note_detail_img_menu"
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
app:border_color="@color/white"
|
app:border_color="@color/white"
|
||||||
app:border_width="2dip" />
|
app:border_width="2dip" />
|
||||||
|
|
||||||
<com.htq.baidu.coolnote.widget.NoteItemCircleView
|
<com.example.administrator.myapplication.widget.NoteItemCircleView
|
||||||
android:id="@+id/note_detail_img_yellow"
|
android:id="@+id/note_detail_img_yellow"
|
||||||
style="@style/note_detail_menu_item"
|
style="@style/note_detail_menu_item"
|
||||||
android:layout_alignLeft="@+id/note_detail_img_menu"
|
android:layout_alignLeft="@+id/note_detail_img_menu"
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
app:border_color="@color/white"
|
app:border_color="@color/white"
|
||||||
app:border_width="2dip" />
|
app:border_width="2dip" />
|
||||||
|
|
||||||
<com.htq.baidu.coolnote.widget.NoteItemCircleView
|
<com.example.administrator.myapplication.widget.NoteItemCircleView
|
||||||
android:id="@+id/note_detail_img_red"
|
android:id="@+id/note_detail_img_red"
|
||||||
style="@style/note_detail_menu_item"
|
style="@style/note_detail_menu_item"
|
||||||
android:layout_alignLeft="@+id/note_detail_img_menu"
|
android:layout_alignLeft="@+id/note_detail_img_menu"
|
||||||
|
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 200 KiB |
|
@ -10,10 +10,10 @@
|
||||||
<string name="change_bg">更换皮肤</string>
|
<string name="change_bg">更换皮肤</string>
|
||||||
<string name="share_app">分享应用</string>
|
<string name="share_app">分享应用</string>
|
||||||
<string name="about_app">关于应用</string>
|
<string name="about_app">关于应用</string>
|
||||||
<string name="about_me">作者:@:Curry </string>
|
<string name="about_me">作者:@:天下勇密一家人 </string>
|
||||||
<string name="setting">设置</string>
|
<string name="setting">设置</string>
|
||||||
<string name="home">主页</string>
|
<string name="home">主页</string>
|
||||||
<string name="author">嗖藏 @Curry All rights reserved </string>
|
<string name="author">嗖藏 @天下勇密一家人 All rights reserved </string>
|
||||||
<string name="jia_mi">应用加密</string>
|
<string name="jia_mi">应用加密</string>
|
||||||
<string name="slogan">嗖嗖嗖,世界都是你的</string>
|
<string name="slogan">嗖嗖嗖,世界都是你的</string>
|
||||||
<string name="exit">退出</string>
|
<string name="exit">退出</string>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/libraries
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<resourceExtensions />
|
||||||
|
<wildcardResourcePatterns>
|
||||||
|
<entry name="!?*.java" />
|
||||||
|
<entry name="!?*.form" />
|
||||||
|
<entry name="!?*.class" />
|
||||||
|
<entry name="!?*.groovy" />
|
||||||
|
<entry name="!?*.scala" />
|
||||||
|
<entry name="!?*.flex" />
|
||||||
|
<entry name="!?*.kt" />
|
||||||
|
<entry name="!?*.clj" />
|
||||||
|
<entry name="!?*.aj" />
|
||||||
|
</wildcardResourcePatterns>
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="false">
|
||||||
|
<processorPath useClasspath="true" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="" />
|
||||||
|
</component>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="MarkdownNavigator.ProfileManager">
|
||||||
|
<settings default="" pdf-export="" />
|
||||||
|
</component>
|
|
@ -0,0 +1,162 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<entry_points version="2.0" />
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownProjectSettings">
|
||||||
|
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="true" showSelectionInPreview="true">
|
||||||
|
<PanelProvider>
|
||||||
|
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
|
||||||
|
</PanelProvider>
|
||||||
|
</PreviewSettings>
|
||||||
|
<ParserSettings gitHubSyntaxChange="false">
|
||||||
|
<PegdownExtensions>
|
||||||
|
<option name="ABBREVIATIONS" value="false" />
|
||||||
|
<option name="ANCHORLINKS" value="true" />
|
||||||
|
<option name="ASIDE" value="false" />
|
||||||
|
<option name="ATXHEADERSPACE" value="true" />
|
||||||
|
<option name="AUTOLINKS" value="true" />
|
||||||
|
<option name="DEFINITIONS" value="false" />
|
||||||
|
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
|
||||||
|
<option name="FENCED_CODE_BLOCKS" value="true" />
|
||||||
|
<option name="FOOTNOTES" value="false" />
|
||||||
|
<option name="HARDWRAPS" value="false" />
|
||||||
|
<option name="INSERTED" value="false" />
|
||||||
|
<option name="QUOTES" value="false" />
|
||||||
|
<option name="RELAXEDHRULES" value="true" />
|
||||||
|
<option name="SMARTS" value="false" />
|
||||||
|
<option name="STRIKETHROUGH" value="true" />
|
||||||
|
<option name="SUBSCRIPT" value="false" />
|
||||||
|
<option name="SUPERSCRIPT" value="false" />
|
||||||
|
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
|
||||||
|
<option name="SUPPRESS_INLINE_HTML" value="false" />
|
||||||
|
<option name="TABLES" value="true" />
|
||||||
|
<option name="TASKLISTITEMS" value="true" />
|
||||||
|
<option name="TOC" value="false" />
|
||||||
|
<option name="WIKILINKS" value="true" />
|
||||||
|
</PegdownExtensions>
|
||||||
|
<ParserOptions>
|
||||||
|
<option name="COMMONMARK_LISTS" value="false" />
|
||||||
|
<option name="DUMMY" value="false" />
|
||||||
|
<option name="EMOJI_SHORTCUTS" value="true" />
|
||||||
|
<option name="FLEXMARK_FRONT_MATTER" value="false" />
|
||||||
|
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
|
||||||
|
<option name="GFM_TABLE_RENDERING" value="true" />
|
||||||
|
<option name="GITBOOK_URL_ENCODING" value="false" />
|
||||||
|
<option name="GITHUB_EMOJI_URL" value="false" />
|
||||||
|
<option name="GITHUB_LISTS" value="true" />
|
||||||
|
<option name="GITHUB_WIKI_LINKS" value="true" />
|
||||||
|
<option name="JEKYLL_FRONT_MATTER" value="false" />
|
||||||
|
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
|
||||||
|
</ParserOptions>
|
||||||
|
</ParserSettings>
|
||||||
|
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
|
||||||
|
<GeneratorProvider>
|
||||||
|
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
|
||||||
|
</GeneratorProvider>
|
||||||
|
<headerTop />
|
||||||
|
<headerBottom />
|
||||||
|
<bodyTop />
|
||||||
|
<bodyBottom />
|
||||||
|
</HtmlSettings>
|
||||||
|
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
|
||||||
|
<StylesheetProvider>
|
||||||
|
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
|
||||||
|
</StylesheetProvider>
|
||||||
|
<ScriptProviders />
|
||||||
|
<cssText />
|
||||||
|
</CssSettings>
|
||||||
|
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
|
||||||
|
<LinkMapSettings>
|
||||||
|
<textMaps />
|
||||||
|
</LinkMapSettings>
|
||||||
|
</component>
|
||||||
|
<component name="MavenImportPreferences">
|
||||||
|
<option name="generalSettings">
|
||||||
|
<MavenGeneralSettings>
|
||||||
|
<option name="mavenHome" value="Bundled (Maven 3)" />
|
||||||
|
</MavenGeneralSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="4">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||||
|
<entry key="Project Default">
|
||||||
|
<profile-state>
|
||||||
|
<expanded-state>
|
||||||
|
<State>
|
||||||
|
<id />
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Android Lint</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>General</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Maven</id>
|
||||||
|
</State>
|
||||||
|
</expanded-state>
|
||||||
|
<selected-state>
|
||||||
|
<State>
|
||||||
|
<id>AndroidLintUseCompoundDrawables</id>
|
||||||
|
</State>
|
||||||
|
</selected-state>
|
||||||
|
</profile-state>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
<OptionsSetting value="true" id="Remove" />
|
||||||
|
<OptionsSetting value="true" id="Checkout" />
|
||||||
|
<OptionsSetting value="true" id="Update" />
|
||||||
|
<OptionsSetting value="true" id="Status" />
|
||||||
|
<OptionsSetting value="true" id="Edit" />
|
||||||
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
<component name="masterDetails">
|
||||||
|
<states>
|
||||||
|
<state key="ProjectJDKs.UI">
|
||||||
|
<settings>
|
||||||
|
<last-edited>1.8</last-edited>
|
||||||
|
<splitter-proportions>
|
||||||
|
<option name="proportions">
|
||||||
|
<list>
|
||||||
|
<option value="0.2" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</splitter-proportions>
|
||||||
|
</settings>
|
||||||
|
</state>
|
||||||
|
</states>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/BmobDemo.iml" filepath="$PROJECT_DIR$/BmobDemo.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1 @@
|
||||||
|
/build
|
|
@ -0,0 +1,38 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 24
|
||||||
|
buildToolsVersion "23.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "cn.bmob.sdkdemo"
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 24
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除META-INF信息
|
||||||
|
packagingOptions {
|
||||||
|
exclude 'META-INF/rxjava.properties'
|
||||||
|
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml'
|
||||||
|
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties'
|
||||||
|
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
|
||||||
|
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
|
||||||
|
exclude 'META-INF/maven/com.google.code.gson/gson/pom.xml'
|
||||||
|
exclude 'META-INF/maven/com.google.code.gson/gson/pom.properties'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
compile 'com.android.support:appcompat-v7:24.0.0'
|
||||||
|
//bmob-sdk
|
||||||
|
compile 'cn.bmob.android:bmob-sdk:3.6.0'
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
#
|
||||||
|
# There is insufficient memory for the Java Runtime Environment to continue.
|
||||||
|
# Native memory allocation (malloc) failed to allocate 1048576 bytes for AllocateHeap
|
||||||
|
# Possible reasons:
|
||||||
|
# The system is out of physical RAM or swap space
|
||||||
|
# In 32 bit mode, the process size limit was hit
|
||||||
|
# Possible solutions:
|
||||||
|
# Reduce memory load on the system
|
||||||
|
# Increase physical memory or swap space
|
||||||
|
# Check if swap backing store is full
|
||||||
|
# Use 64 bit Java on a 64 bit OS
|
||||||
|
# Decrease Java heap size (-Xmx/-Xms)
|
||||||
|
# Decrease number of Java threads
|
||||||
|
# Decrease Java thread stack sizes (-Xss)
|
||||||
|
# Set larger code cache with -XX:ReservedCodeCacheSize=
|
||||||
|
# This output file may be truncated or incomplete.
|
||||||
|
#
|
||||||
|
# Out of Memory Error (memory/allocation.inline.hpp:61), pid=14476, tid=0x0000000000000b14
|
||||||
|
#
|
||||||
|
# JRE version: (8.0_76-b03) (build )
|
||||||
|
# Java VM: OpenJDK 64-Bit Server VM (25.76-b03 mixed mode windows-amd64 compressed oops)
|
||||||
|
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
|
||||||
|
#
|
||||||
|
|
||||||
|
--------------- T H R E A D ---------------
|
||||||
|
|
||||||
|
Current thread (0x000000000051e000): JavaThread "Unknown thread" [_thread_in_vm, id=2836, stack(0x0000000002220000,0x0000000002320000)]
|
||||||
|
|
||||||
|
Stack: [0x0000000002220000,0x0000000002320000]
|
||||||
|
[error occurred during error reporting (printing stack bounds), id 0xc0000005]
|
||||||
|
|
||||||
|
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
|
||||||
|
|
||||||
|
|
||||||
|
--------------- P R O C E S S ---------------
|
||||||
|
|
||||||
|
Java Threads: ( => current thread )
|
||||||
|
|
||||||
|
Other Threads:
|
||||||
|
|
||||||
|
=>0x000000000051e000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=2836, stack(0x0000000002220000,0x0000000002320000)]
|
||||||
|
|
||||||
|
VM state:not at safepoint (normal execution)
|
||||||
|
|
||||||
|
VM Mutex/Monitor currently owned by a thread: None
|
||||||
|
|
||||||
|
Heap:
|
||||||
|
PSYoungGen total 56320K, used 972K [0x00000000eab00000, 0x00000000ee980000, 0x0000000100000000)
|
||||||
|
eden space 48640K, 2% used [0x00000000eab00000,0x00000000eabf3340,0x00000000eda80000)
|
||||||
|
from space 7680K, 0% used [0x00000000ee200000,0x00000000ee200000,0x00000000ee980000)
|
||||||
|
to space 7680K, 0% used [0x00000000eda80000,0x00000000eda80000,0x00000000ee200000)
|
||||||
|
ParOldGen total 128512K, used 0K [0x00000000c0000000, 0x00000000c7d80000, 0x00000000eab00000)
|
||||||
|
object space 128512K, 0% used [0x00000000c0000000,0x00000000c0000000,0x00000000c7d80000)
|
||||||
|
Metaspace used 771K, capacity 4480K, committed 4480K, reserved 1056768K
|
||||||
|
class space used 73K, capacity 384K, committed 384K, reserved 1048576K
|
||||||
|
|
||||||
|
Card table byte_map: [0x00000000116e0000,0x00000000118f0000] byte_map_base: 0x00000000110e0000
|
||||||
|
|
||||||
|
Marking Bits: (ParMarkBitMap*) 0x0000000060069d00
|
||||||
|
Begin Bits: [0x0000000012100000, 0x0000000013100000)
|
||||||
|
End Bits: [0x0000000013100000, 0x0000000014100000)
|
||||||
|
|
||||||
|
Polling page: 0x0000000000230000
|
||||||
|
|
||||||
|
CodeCache: size=245760Kb used=328Kb max_used=328Kb free=245431Kb
|
||||||
|
bounds [0x0000000002320000, 0x0000000002590000, 0x0000000011320000]
|
||||||
|
total_blobs=57 nmethods=0 adapters=38
|
||||||
|
compilation: enabled
|
||||||
|
|
||||||
|
Compilation events (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
GC Heap History (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Deoptimization events (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Internal exceptions (0 events):
|
||||||
|
No events
|
||||||
|
|
||||||
|
Events (10 events):
|
||||||
|
Event: 0.031 loading class java/lang/Short
|
||||||
|
Event: 0.031 loading class java/lang/Short done
|
||||||
|
Event: 0.031 loading class java/lang/Integer
|
||||||
|
Event: 0.031 loading class java/lang/Integer done
|
||||||
|
Event: 0.031 loading class java/lang/Long
|
||||||
|
Event: 0.031 loading class java/lang/Long done
|
||||||
|
Event: 0.032 loading class java/lang/NullPointerException
|
||||||
|
Event: 0.032 loading class java/lang/NullPointerException done
|
||||||
|
Event: 0.032 loading class java/lang/ArithmeticException
|
||||||
|
Event: 0.032 loading class java/lang/ArithmeticException done
|
||||||
|
|
||||||
|
|
||||||
|
Dynamic libraries:
|
||||||
|
0x000000013f1c0000 - 0x000000013f1f1000 C:\Program Files\Android\Android Studio\jre\bin\java.exe
|
||||||
|
0x0000000077a80000 - 0x0000000077c2a000 C:\Windows\SYSTEM32\ntdll.dll
|
||||||
|
0x00000000774a0000 - 0x00000000775bf000 C:\Windows\system32\kernel32.dll
|
||||||
|
0x000007fefde60000 - 0x000007fefdecb000 C:\Windows\system32\KERNELBASE.dll
|
||||||
|
0x000007feffbb0000 - 0x000007feffc8b000 C:\Windows\system32\ADVAPI32.dll
|
||||||
|
0x000007fefe540000 - 0x000007fefe5df000 C:\Windows\system32\msvcrt.dll
|
||||||
|
0x000007fefe520000 - 0x000007fefe53f000 C:\Windows\SYSTEM32\sechost.dll
|
||||||
|
0x000007fefe120000 - 0x000007fefe24d000 C:\Windows\system32\RPCRT4.dll
|
||||||
|
0x00000000773a0000 - 0x000000007749a000 C:\Windows\system32\USER32.dll
|
||||||
|
0x000007fefe820000 - 0x000007fefe887000 C:\Windows\system32\GDI32.dll
|
||||||
|
0x000007fefe2b0000 - 0x000007fefe2be000 C:\Windows\system32\LPK.dll
|
||||||
|
0x000007fefe750000 - 0x000007fefe81a000 C:\Windows\system32\USP10.dll
|
||||||
|
0x000007fefc760000 - 0x000007fefc954000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll
|
||||||
|
0x000007fefe890000 - 0x000007fefe901000 C:\Windows\system32\SHLWAPI.dll
|
||||||
|
0x000007feffb80000 - 0x000007feffbae000 C:\Windows\system32\IMM32.DLL
|
||||||
|
0x000007fefe410000 - 0x000007fefe519000 C:\Windows\system32\MSCTF.dll
|
||||||
|
0x0000000073b70000 - 0x0000000073c42000 C:\Program Files\Android\Android Studio\jre\jre\bin\msvcr100.dll
|
||||||
|
0x000000005f8b0000 - 0x00000000600e4000 C:\Program Files\Android\Android Studio\jre\jre\bin\server\jvm.dll
|
||||||
|
0x000007fef9a80000 - 0x000007fef9a89000 C:\Windows\system32\WSOCK32.dll
|
||||||
|
0x000007fefe700000 - 0x000007fefe74d000 C:\Windows\system32\WS2_32.dll
|
||||||
|
0x000007fefeb20000 - 0x000007fefeb28000 C:\Windows\system32\NSI.dll
|
||||||
|
0x000007fefdee0000 - 0x000007fefdf1b000 C:\Windows\system32\WINMM.dll
|
||||||
|
0x000007fefcdf0000 - 0x000007fefcdfc000 C:\Windows\system32\VERSION.dll
|
||||||
|
0x0000000077c50000 - 0x0000000077c57000 C:\Windows\system32\PSAPI.DLL
|
||||||
|
0x000007fef9050000 - 0x000007fef905f000 C:\Program Files\Android\Android Studio\jre\jre\bin\verify.dll
|
||||||
|
0x000007fef7140000 - 0x000007fef7169000 C:\Program Files\Android\Android Studio\jre\jre\bin\java.dll
|
||||||
|
0x000007fef9030000 - 0x000007fef9046000 C:\Program Files\Android\Android Studio\jre\jre\bin\zip.dll
|
||||||
|
|
||||||
|
VM Arguments:
|
||||||
|
jvm_args: -Djava.awt.headless=true -Xmx1024M -Dfile.encoding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant
|
||||||
|
java_command: com.android.dx.command.Main --dex --num-threads=4 --output C:\Users\Administrator\Desktop\v5\BmobDemo\app\build\intermediates\pre-dexed\debug\filechoose_0a559a1ffc7b1556dde8cbfa0e40a71676d9d3fd.jar C:\Users\Administrator\Desktop\v5\BmobDemo\app\libs\filechoose.jar
|
||||||
|
java_class_path (initial): D:\AS_SDK\build-tools\23.0.3\lib\dx.jar
|
||||||
|
Launcher Type: SUN_STANDARD
|
||||||
|
|
||||||
|
Environment Variables:
|
||||||
|
JAVA_HOME=D:\Program Files\Java
|
||||||
|
PATH=C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\python\Scripts;E:\nexus\nexus-3.3.0-01\bin;%CATALINA_HOME%\bin;D:\Program Files\Java\bin;D:\Program Files (x86)\Io\IoLanguage\bin;D:\Program Files (x86)\Ruby23-x64\bin;D:\Program Files (x86)\python;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\AS_SDK\build-tools\22.0.0;D:\AS_SDK\build-tools\23.0.2;D:\gradle\gradle-2.13\bin;C:\Users\Administrator\Desktop\CURL;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\AS_SDK\platform-tools;D:\SDK\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W;D:\groovy-2.4.6\bin;D:\Tomcat\apache-tomcat-8.0.33\bin;D:\apache-maven-3.3.9\bin;D:\Program Files\nodejs\;D:\Program Files (x86)\scala\bin;D:\Go\bin;D:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Users\Administrator\AppData\Local\atom\bin;C:\Users\Administrator\AppData\Roaming\npm
|
||||||
|
USERNAME=Administrator
|
||||||
|
OS=Windows_NT
|
||||||
|
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------- S Y S T E M ---------------
|
||||||
|
|
||||||
|
OS: Windows 7 , 64 bit Build 7601 (6.1.7601.19160)
|
||||||
|
|
||||||
|
CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 60 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, lzcnt, tsc, tscinvbit, bmi1, bmi2
|
||||||
|
|
||||||
|
Memory: 4k page, physical 12272852k(732712k free), swap 16286656k(5328k free)
|
||||||
|
|
||||||
|
vm_info: OpenJDK 64-Bit Server VM (25.76-b03) for windows-amd64 JRE (1.8.0_76-release-b03), built on Jun 29 2016 19:09:20 by "ralucas" with MS VC++ 10.0 (VS2010)
|
||||||
|
|
||||||
|
time: Thu Apr 20 14:58:09 2017
|
||||||
|
elapsed time: 0 seconds (0d 0h 0m 0s)
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in D:\AS_SDK/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.test.ApplicationTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||||
|
*/
|
||||||
|
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||||
|
public ApplicationTest() {
|
||||||
|
super(Application.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="cn.bmob.sdkdemo">
|
||||||
|
|
||||||
|
<!-- BmobSDK权限 -->
|
||||||
|
<!--允许联网 -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<!--获取GSM(2g)、WCDMA(联通3g)等网络状态的信息 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<!--获取wifi网络状态的信息 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
<!--保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<!--获取sd卡写的权限,用于文件上传和下载-->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<!--推送权限-->
|
||||||
|
<!--允许读取手机状态 -->
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<!--允许接收屏幕解锁广播 -->
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||||
|
<!--允许接收开机广播 -->
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<!-- 其他权限 -->
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:name=".BmobApplication"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
<activity android:name=".MainActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".crud.CRUDActivity" />
|
||||||
|
<activity android:name=".crud.QueryActivity" />
|
||||||
|
<activity android:name=".crud.QueryStatisticActivity" />
|
||||||
|
<activity android:name=".crud.QuerySQLActivity" />
|
||||||
|
<activity android:name=".user.UserActivity" />
|
||||||
|
<activity android:name=".BatchActionActivity" />
|
||||||
|
<activity android:name=".location.LocationActivity" />
|
||||||
|
<activity android:name=".acl.ACLActivity" />
|
||||||
|
<activity
|
||||||
|
android:name=".relation.WeiboListActivity"
|
||||||
|
android:windowSoftInputMode="stateHidden" >
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".relation.CommentListActivity"
|
||||||
|
android:windowSoftInputMode="stateHidden" >
|
||||||
|
</activity>
|
||||||
|
<activity android:name=".push.ActBmobPush" />
|
||||||
|
<activity android:name=".file.BmobFileActivity" />
|
||||||
|
<activity android:name=".autoupdate.ActAutoUpdate" />
|
||||||
|
|
||||||
|
<activity android:name=".sms.SMSCodeActivity" />
|
||||||
|
|
||||||
|
<!-- bmob push start -->
|
||||||
|
<service
|
||||||
|
android:name="cn.bmob.push.lib.service.PushService"
|
||||||
|
android:label="PushService"
|
||||||
|
android:exported="true"
|
||||||
|
android:process=":bmobpush" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.bmob.push.lib.service.PushService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<service
|
||||||
|
android:name="cn.bmob.push.lib.service.PushNotifyService"
|
||||||
|
android:process=":bmobpush" >
|
||||||
|
</service>
|
||||||
|
<receiver
|
||||||
|
android:name="cn.bmob.push.PushNotifyReceiver" android:process=":bmobpush" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.bmob.push.action.HEARTBEAT" />
|
||||||
|
<action android:name="cn.bmob.push.action.NOTIFY" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
<receiver android:name="cn.bmob.push.PushReceiver" android:process=":bmobpush">
|
||||||
|
<intent-filter>
|
||||||
|
<!-- 系统启动完成后会调用 -->
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<!-- 解锁完成后会调用 -->
|
||||||
|
<action android:name="android.intent.action.USER_PRESENT" />
|
||||||
|
<!-- 监听网络变化 -->
|
||||||
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
<!-- bmob push end -->
|
||||||
|
|
||||||
|
<!-- Auto Update Start -->
|
||||||
|
<!-- 设置更新渠道,如果没有,则不要添加此行 -->
|
||||||
|
<meta-data android:value="bmob" android:name="BMOB_CHANNEL"/>
|
||||||
|
<activity
|
||||||
|
android:name="cn.bmob.v3.update.UpdateDialogActivity"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
|
||||||
|
</activity>
|
||||||
|
<!-- Auto Update End -->
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,88 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import rx.Subscription;
|
||||||
|
import rx.subscriptions.CompositeSubscription;
|
||||||
|
|
||||||
|
public class BaseActivity extends Activity {
|
||||||
|
|
||||||
|
public static String TAG = "bmob";
|
||||||
|
protected ListView mListview;
|
||||||
|
protected BaseAdapter mAdapter;
|
||||||
|
|
||||||
|
private CompositeSubscription mCompositeSubscription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决Subscription内存泄露问题
|
||||||
|
* @param s
|
||||||
|
*/
|
||||||
|
protected void addSubscription(Subscription s) {
|
||||||
|
if (this.mCompositeSubscription == null) {
|
||||||
|
this.mCompositeSubscription = new CompositeSubscription();
|
||||||
|
}
|
||||||
|
this.mCompositeSubscription.add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toast(String msg){
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast mToast;
|
||||||
|
|
||||||
|
public void showToast(String text) {
|
||||||
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
if (mToast == null) {
|
||||||
|
mToast = Toast.makeText(getApplicationContext(), text,
|
||||||
|
Toast.LENGTH_SHORT);
|
||||||
|
} else {
|
||||||
|
mToast.setText(text);
|
||||||
|
}
|
||||||
|
mToast.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showToast(int resId) {
|
||||||
|
if (mToast == null) {
|
||||||
|
mToast = Toast.makeText(getApplicationContext(), resId,
|
||||||
|
Toast.LENGTH_SHORT);
|
||||||
|
} else {
|
||||||
|
mToast.setText(resId);
|
||||||
|
}
|
||||||
|
mToast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void log(String msg) {
|
||||||
|
Log.i(TAG,"===============================================================================");
|
||||||
|
Log.i(TAG, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loge(Throwable e) {
|
||||||
|
Log.i(TAG,"===============================================================================");
|
||||||
|
if(e instanceof BmobException){
|
||||||
|
Log.e(TAG, "错误码:"+((BmobException)e).getErrorCode()+",错误描述:"+((BmobException)e).getMessage());
|
||||||
|
}else{
|
||||||
|
Log.e(TAG, "错误描述:"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (this.mCompositeSubscription != null) {
|
||||||
|
this.mCompositeSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,271 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.bean.BankCard;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.v3.BmobBatch;
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.datatype.BatchResult;
|
||||||
|
import cn.bmob.v3.datatype.BmobDate;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.QueryListListener;
|
||||||
|
|
||||||
|
public class BatchActionActivity extends BaseActivity {
|
||||||
|
|
||||||
|
ListView mListview;
|
||||||
|
BaseAdapter mAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.batch_action_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBatch(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBatch(int pos){
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
// 批量添加
|
||||||
|
batchInsert();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 批量更新
|
||||||
|
batchUpdate();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 批量删除
|
||||||
|
batchDelete();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
//批量添加、删除、更新的同步提交batch();
|
||||||
|
batch();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加
|
||||||
|
*/
|
||||||
|
private void batchInsert(){
|
||||||
|
List<BmobObject> persons = new ArrayList<BmobObject>();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
Person person = new Person();
|
||||||
|
person.setName("张三 "+i);
|
||||||
|
person.setAddress("上海朝阳路"+i+"号");
|
||||||
|
person.setGpsAdd(new BmobGeoPoint(112.934755, 24.52065));
|
||||||
|
person.setUploadTime(new BmobDate(new Date()));
|
||||||
|
List<String> hobbys = new ArrayList<String>();
|
||||||
|
hobbys.add("阅读");
|
||||||
|
hobbys.add("篮球");
|
||||||
|
hobbys.add("唱歌");
|
||||||
|
person.setHobby(hobbys);
|
||||||
|
person.setBankCard(new BankCard("中国银行", "176672673687545097"+i));
|
||||||
|
//可批量添加带Poniter类型的数据,例如
|
||||||
|
person.setAuthor(BmobUser.getCurrentUser(MyUser.class));
|
||||||
|
persons.add(person);
|
||||||
|
}
|
||||||
|
new BmobBatch().insertBatch(persons).doBatch(new QueryListListener<BatchResult>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
for(int i=0;i<o.size();i++){
|
||||||
|
BatchResult result = o.get(i);
|
||||||
|
BmobException ex =result.getError();
|
||||||
|
if(ex==null){
|
||||||
|
log("第"+i+"个数据批量添加成功:"+result.getCreatedAt()+","+result.getObjectId()+","+result.getUpdatedAt());
|
||||||
|
}else{
|
||||||
|
log("第"+i+"个数据批量添加失败:"+ex.getMessage()+","+ex.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新
|
||||||
|
*/
|
||||||
|
private void batchUpdate(){
|
||||||
|
List<BmobObject> persons = new ArrayList<BmobObject>();
|
||||||
|
Person p1 = new Person();
|
||||||
|
p1.setObjectId("0197d1cf66");
|
||||||
|
p1.setAge(105);
|
||||||
|
Person p2 = new Person();
|
||||||
|
p2.setObjectId("32440c8b15");
|
||||||
|
p2.setAge(106);
|
||||||
|
p2.setGender(false);
|
||||||
|
Person p3 = new Person();
|
||||||
|
p3.setObjectId("967292cbef");
|
||||||
|
p3.setAge(107);
|
||||||
|
|
||||||
|
persons.add(p1);
|
||||||
|
persons.add(p2);
|
||||||
|
persons.add(p3);
|
||||||
|
|
||||||
|
new BmobBatch().updateBatch(persons).doBatch(new QueryListListener<BatchResult>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
for(int i=0;i<o.size();i++){
|
||||||
|
BatchResult result = o.get(i);
|
||||||
|
BmobException ex =result.getError();
|
||||||
|
if(ex==null){
|
||||||
|
log("第"+i+"个数据批量更新成功:"+result.getUpdatedAt());
|
||||||
|
}else{
|
||||||
|
log("第"+i+"个数据批量更新失败:"+ex.getMessage()+","+ex.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
private void batchDelete(){
|
||||||
|
List<BmobObject> persons = new ArrayList<BmobObject>();
|
||||||
|
Person p1 = new Person();
|
||||||
|
p1.setObjectId("d542eaa667");
|
||||||
|
Person p2 = new Person();
|
||||||
|
p2.setObjectId("8c88c5d849");
|
||||||
|
Person p3 = new Person();
|
||||||
|
p3.setObjectId("e003224592");
|
||||||
|
|
||||||
|
persons.add(p1);
|
||||||
|
persons.add(p2);
|
||||||
|
persons.add(p3);
|
||||||
|
|
||||||
|
new BmobBatch().deleteBatch(persons).doBatch(new QueryListListener<BatchResult>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
for(int i=0;i<o.size();i++){
|
||||||
|
BatchResult result = o.get(i);
|
||||||
|
BmobException ex =result.getError();
|
||||||
|
if(ex==null){
|
||||||
|
log("第"+i+"个数据批量删除成功");
|
||||||
|
}else{
|
||||||
|
log("第"+i+"个数据批量删除失败:"+ex.getMessage()+","+ex.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步执行多种批量操作
|
||||||
|
*/
|
||||||
|
public void batch(){
|
||||||
|
BmobBatch batch =new BmobBatch();
|
||||||
|
//批量添加
|
||||||
|
List<BmobObject> persons = new ArrayList<BmobObject>();
|
||||||
|
Person person = new Person();
|
||||||
|
person.setName("张三 ");
|
||||||
|
person.setAddress("上海朝阳路0号");
|
||||||
|
person.setGpsAdd(new BmobGeoPoint(112.934755, 24.52065));
|
||||||
|
person.setUploadTime(new BmobDate(new Date()));
|
||||||
|
List<String> hobbys = new ArrayList<String>();
|
||||||
|
hobbys.add("阅读");
|
||||||
|
hobbys.add("篮球");
|
||||||
|
hobbys.add("唱歌");
|
||||||
|
person.setHobby(hobbys);
|
||||||
|
person.setBankCard(new BankCard("中国银行", "176672673687545097"));
|
||||||
|
//可批量添加带Poniter类型的数据,例如
|
||||||
|
person.setAuthor(BmobUser.getCurrentUser(MyUser.class));
|
||||||
|
persons.add(person);
|
||||||
|
batch.insertBatch(persons);
|
||||||
|
|
||||||
|
//批量更新
|
||||||
|
List<BmobObject> persons1=new ArrayList<BmobObject>();
|
||||||
|
Person p1 = new Person();
|
||||||
|
p1.setObjectId("3388eb6caf");
|
||||||
|
p1.setAge(35);
|
||||||
|
persons1.add(p1);
|
||||||
|
batch.updateBatch(persons1);
|
||||||
|
|
||||||
|
//批量删除
|
||||||
|
List<BmobObject> persons2 = new ArrayList<BmobObject>();
|
||||||
|
Person p2 = new Person();
|
||||||
|
p2.setObjectId("9af452ebd");
|
||||||
|
persons2.add(p2);
|
||||||
|
batch.deleteBatch(persons2);
|
||||||
|
//执行批量操作
|
||||||
|
batch.doBatch(new QueryListListener<BatchResult>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> results, BmobException ex) {
|
||||||
|
if(ex==null){
|
||||||
|
//返回结果的results和上面提交的顺序是一样的,请一一对应
|
||||||
|
// {//批量添加
|
||||||
|
// "success": {
|
||||||
|
// "createdAt": "2016-06-07 10:27:45",
|
||||||
|
// "objectId": "a2b30a0b64"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// {//批量更新
|
||||||
|
// "success": {
|
||||||
|
// "updatedAt": "2016-06-07 10:27:45"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// {//批量删除
|
||||||
|
// "error": {
|
||||||
|
// "code": 101,
|
||||||
|
// "error": "object not found for 9af452eb4."
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
for(int i=0;i<results.size();i++){
|
||||||
|
BatchResult result= results.get(i);
|
||||||
|
if(result.isSuccess()){//只有批量添加才返回objectId
|
||||||
|
log("第"+i+"个成功:"+result.getObjectId()+","+result.getUpdatedAt());
|
||||||
|
}else{
|
||||||
|
BmobException error= result.getError();
|
||||||
|
log("第"+i+"个失败:"+error.getErrorCode()+","+error.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
import android.app.Application;
|
||||||
|
import cn.bmob.v3.Bmob;
|
||||||
|
|
||||||
|
public class BmobApplication extends Application {
|
||||||
|
/**
|
||||||
|
* SDK初始化也可以放到Application中
|
||||||
|
*/
|
||||||
|
public static String APPID = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
//提供以下两种方式进行初始化操作:
|
||||||
|
// //第一:设置BmobConfig,允许设置请求超时时间、文件分片上传时每片的大小、文件的过期时间(单位为秒)
|
||||||
|
// BmobConfig config =new BmobConfig.Builder(this)
|
||||||
|
// //设置appkey
|
||||||
|
// .setApplicationId(APPID)
|
||||||
|
// //请求超时时间(单位为秒):默认15s
|
||||||
|
// .setConnectTimeout(30)
|
||||||
|
// //文件分片上传时每片的大小(单位字节),默认512*1024
|
||||||
|
// .setUploadBlockSize(1024*1024)
|
||||||
|
// //文件的过期时间(单位为秒):默认1800s
|
||||||
|
// .setFileExpiration(5500)
|
||||||
|
// .build();
|
||||||
|
// Bmob.initialize(config);
|
||||||
|
//第二:默认初始化
|
||||||
|
Bmob.initialize(this, APPID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,266 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.acl.ACLActivity;
|
||||||
|
import cn.bmob.sdkdemo.autoupdate.ActAutoUpdate;
|
||||||
|
import cn.bmob.sdkdemo.crud.CRUDActivity;
|
||||||
|
import cn.bmob.sdkdemo.crud.QuerySQLActivity;
|
||||||
|
import cn.bmob.sdkdemo.crud.QueryStatisticActivity;
|
||||||
|
import cn.bmob.sdkdemo.file.BmobFileActivity;
|
||||||
|
import cn.bmob.sdkdemo.location.LocationActivity;
|
||||||
|
import cn.bmob.sdkdemo.push.ActBmobPush;
|
||||||
|
import cn.bmob.sdkdemo.relation.WeiboListActivity;
|
||||||
|
import cn.bmob.sdkdemo.sms.SMSCodeActivity;
|
||||||
|
import cn.bmob.sdkdemo.user.UserActivity;
|
||||||
|
import cn.bmob.v3.AsyncCustomEndpoints;
|
||||||
|
import cn.bmob.v3.Bmob;
|
||||||
|
import cn.bmob.v3.BmobRealTimeData;
|
||||||
|
import cn.bmob.v3.datatype.BmobTableSchema;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.CloudCodeListener;
|
||||||
|
import cn.bmob.v3.listener.QueryListListener;
|
||||||
|
import cn.bmob.v3.listener.QueryListener;
|
||||||
|
import cn.bmob.v3.listener.ValueEventListener;
|
||||||
|
|
||||||
|
public class MainActivity extends BaseActivity {
|
||||||
|
|
||||||
|
protected ListView mListview;
|
||||||
|
protected BaseAdapter mAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
Toast.makeText(this, "请记得将BmobApplication当中的APPID替换为你的appid", Toast.LENGTH_LONG).show();
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.tv_item, getResources().getStringArray(R.array.bmob_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
startActivity(new Intent(this, UserActivity.class));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
startActivity(new Intent(this, CRUDActivity.class));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 关联数据
|
||||||
|
startActivity(new Intent(this, WeiboListActivity.class));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// 批量操作
|
||||||
|
startActivity(new Intent(this, BatchActionActivity.class));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
startActivity(new Intent(this, ACLActivity.class));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
startActivity(new Intent(this, BmobFileActivity.class));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
cloudCode();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
realTime();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
// 客户端之间的推送服务
|
||||||
|
startActivity(new Intent(this, ActBmobPush.class));
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
// 应用自动更新
|
||||||
|
startActivity(new Intent(this, ActAutoUpdate.class));
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
// 地理位置
|
||||||
|
startActivity(new Intent(this, LocationActivity.class));
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
getServerTime();
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
//统计查询
|
||||||
|
startActivity(new Intent(this, QueryStatisticActivity.class));
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
//SQL查询
|
||||||
|
startActivity(new Intent(this, QuerySQLActivity.class));
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
startActivity(new Intent(this, SMSCodeActivity.class));
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
//表结构
|
||||||
|
// getAllTableSchema();
|
||||||
|
getTableSchema();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务器时间
|
||||||
|
*/
|
||||||
|
private void getServerTime() {
|
||||||
|
Bmob.getServerTime(new QueryListener<Long>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Long time, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat(
|
||||||
|
"yyyy-MM-dd HH:mm");
|
||||||
|
String times = formatter.format(new Date(time * 1000L));
|
||||||
|
toast("当前服务器时间为:" + times);
|
||||||
|
}else{
|
||||||
|
toast("获取服务器时间失败:" + e.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云端代码
|
||||||
|
*/
|
||||||
|
private void cloudCode() {
|
||||||
|
// 后台的云端代码:
|
||||||
|
// function onRequest(request, response, modules) {
|
||||||
|
// //获取SDK客户端上传的name参数
|
||||||
|
// var name = request.body.inputData;
|
||||||
|
// var json = JSON.parse(name);
|
||||||
|
// response.end(json.Type);
|
||||||
|
// }
|
||||||
|
//测试json请求参数
|
||||||
|
AsyncCustomEndpoints ace = new AsyncCustomEndpoints();
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
JSONObject o= new JSONObject();
|
||||||
|
o.put("Type", "SignUp");
|
||||||
|
o.put("Phone", "111");
|
||||||
|
obj.put("inputData", o);
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
ace.callEndpoint("t", obj, new CloudCodeListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Object object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
String result = object.toString();
|
||||||
|
log("云端usertest方法返回:"+result);
|
||||||
|
toast("云端usertest方法返回:" + result);
|
||||||
|
}else{
|
||||||
|
toast("访问云端usertest方法失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// //不带请求的云端代码
|
||||||
|
// ace.callEndpoint("testJSONObject", new CloudCodeListener() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(Object object, BmobException e) {
|
||||||
|
// if(e==null){
|
||||||
|
// toast("云端usertest方法返回:" + object.toString());
|
||||||
|
// String json = object.toString();
|
||||||
|
// try {
|
||||||
|
// JSONObject obj = new JSONObject(json);
|
||||||
|
// String ud = obj.getString("ud");
|
||||||
|
// toast("云端usertest方法返回ud:" + ud);
|
||||||
|
// } catch (Exception e1) {
|
||||||
|
// toast("云端usertest方法返回错误:" + e1.getMessage());
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// toast("访问云端usertest方法失败:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void realTime(){
|
||||||
|
final BmobRealTimeData rtd = new BmobRealTimeData();
|
||||||
|
rtd.start(new ValueEventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataChange(JSONObject data) {
|
||||||
|
log("onDataChange:data = "+data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectCompleted(Exception ex) {
|
||||||
|
log("连接成功:"+rtd.isConnected());
|
||||||
|
if(rtd.isConnected()){
|
||||||
|
// 监听表更新
|
||||||
|
rtd.subTableUpdate("Person");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**获取指定账户下的所有表的表结构信息
|
||||||
|
* @method getAllTableSchema
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void getAllTableSchema(){
|
||||||
|
Bmob.getAllTableSchema(new QueryListListener<BmobTableSchema>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<BmobTableSchema> schemas, BmobException ex) {
|
||||||
|
if(ex==null && schemas!=null && schemas.size()>0){
|
||||||
|
log(""+schemas.get(0).getClassName()+"---"+schemas.get(0).getFields().toString());
|
||||||
|
}else{
|
||||||
|
toast("获取所有表的表结构信息失败:" + ex.getLocalizedMessage()+"("+ex.getErrorCode()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取指定表的表结构信息
|
||||||
|
* @method getTableSchema
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
public void getTableSchema(){
|
||||||
|
Bmob.getTableSchema("_User", new QueryListener<BmobTableSchema>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobTableSchema schema, BmobException ex) {
|
||||||
|
if(ex==null){
|
||||||
|
log(""+schema.getClassName()+"---"+schema.getFields().toString());
|
||||||
|
}else{
|
||||||
|
toast("获取用户表的表结构信息失败:" + ex.getLocalizedMessage()+"("+ex.getErrorCode()+")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed() {
|
||||||
|
finish();
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,163 @@
|
||||||
|
package cn.bmob.sdkdemo.acl;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.v3.BmobACL;
|
||||||
|
import cn.bmob.v3.BmobRole;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
|
||||||
|
public class ACLActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_acl_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
// 创建数据时添加ACL
|
||||||
|
createACLData();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// 创建角色
|
||||||
|
createRole();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 更新角色
|
||||||
|
updateRole();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// 更新角色(删除角色中的用户)
|
||||||
|
removeRole();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建数据时添加ACL
|
||||||
|
*/
|
||||||
|
private void createACLData(){
|
||||||
|
Person person = new Person();
|
||||||
|
person.setName("职员");
|
||||||
|
person.setAddress("广州市");
|
||||||
|
//添加ACL权限控制
|
||||||
|
BmobACL aCL = new BmobACL();
|
||||||
|
aCL.setPublicReadAccess(true);//设置所有人可读的权限
|
||||||
|
aCL.setPublicWriteAccess(true);//设置所有人可写的权限
|
||||||
|
aCL.setWriteAccess(BmobUser.getCurrentUser(), true);//设置当前用户可写的权限
|
||||||
|
// aCL.setReadAccess("用户的objectId", false);//指定特定用户不可读
|
||||||
|
// aCL.setWriteAccess("用户的objectId", true);//指定特定用户可写
|
||||||
|
BmobRole hr = new BmobRole("hr");
|
||||||
|
aCL.setRoleReadAccess(hr, true);//指定hr类的人可读
|
||||||
|
aCL.setRoleWriteAccess("hr", true);//指定hr类的人可写
|
||||||
|
person.setACL(aCL);
|
||||||
|
person.save(new SaveListener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("创建成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**创建角色
|
||||||
|
* @method createRole
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void createRole(){
|
||||||
|
BmobRole hr_role = new BmobRole("hr");//为当前用户分配角色
|
||||||
|
hr_role.getUsers().add(BmobUser.getCurrentUser());
|
||||||
|
hr_role.save(new SaveListener<String>() {
|
||||||
|
@Override
|
||||||
|
public void done(String o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("创建成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新角色
|
||||||
|
*/
|
||||||
|
private void updateRole() {
|
||||||
|
BmobRole role = new BmobRole("hr");
|
||||||
|
role.setObjectId("6f35f87f3a");
|
||||||
|
role.getUsers().add(BmobUser.getCurrentUser());
|
||||||
|
role.update(new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("更新成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**删除角色
|
||||||
|
* @method removeRole
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void removeRole(){
|
||||||
|
BmobRole role = new BmobRole("hr");
|
||||||
|
role.setObjectId("6f35f87f3a");
|
||||||
|
role.getUsers().remove(BmobUser.getCurrentUser());
|
||||||
|
role.update(new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("更新成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package cn.bmob.sdkdemo.autoupdate;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.BmobDialogButtonListener;
|
||||||
|
import cn.bmob.v3.listener.BmobUpdateListener;
|
||||||
|
import cn.bmob.v3.update.BmobUpdateAgent;
|
||||||
|
import cn.bmob.v3.update.UpdateResponse;
|
||||||
|
import cn.bmob.v3.update.UpdateStatus;
|
||||||
|
|
||||||
|
public class ActAutoUpdate extends BaseActivity {
|
||||||
|
|
||||||
|
String[] arr = {"自动更新","手动更新","静默下载更新","删除文件"};
|
||||||
|
UpdateResponse ur;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.tv_item, arr);
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
mListview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
testAutoUpdate(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 在你需要调用自动更新功能之前先进行初始化建表操作
|
||||||
|
// 此方法适合开发者调试自动更新功能时使用,一旦AppVersion表在后台创建成功,建议屏蔽或删除此方法,否则会造成生成多行记录。
|
||||||
|
BmobUpdateAgent.initAppVersion();
|
||||||
|
|
||||||
|
//利用如下方式计算apk的target_size大小:
|
||||||
|
log("应用的target_size的大小 = "+new File("sdcard/BmobExample.apk").length());
|
||||||
|
//允许在非wifi环境下检测应用更新
|
||||||
|
BmobUpdateAgent.setUpdateOnlyWifi(false);
|
||||||
|
//更新监听器
|
||||||
|
BmobUpdateAgent.setUpdateListener(new BmobUpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
|
||||||
|
//V3.4.4版本开始,增加版本更新错误提示,可通过此方法获取到错误信息
|
||||||
|
BmobException e = updateInfo.getException();
|
||||||
|
if(e!=null){
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "检测更新返回:"+e.getMessage()+"("+e.getErrorCode()+")", Toast.LENGTH_SHORT).show();
|
||||||
|
}else{
|
||||||
|
ur = updateInfo;
|
||||||
|
}
|
||||||
|
//以下适用于V3.4.4之前版本
|
||||||
|
// if (updateStatus == UpdateStatus.Yes) {
|
||||||
|
// ur = updateInfo;
|
||||||
|
// }else if(updateStatus == UpdateStatus.No){
|
||||||
|
// Toast.makeText(ActAutoUpdate.this, "版本无更新", Toast.LENGTH_SHORT).show();
|
||||||
|
// }else if(updateStatus==UpdateStatus.EmptyField){//此提示只是提醒开发者关注那些必填项,测试成功后,无需对用户提示
|
||||||
|
// Toast.makeText(ActAutoUpdate.this, "请检查你AppVersion表的必填项,1、target_size(文件大小)是否填写;2、path或者android_url两者必填其中一项。", Toast.LENGTH_SHORT).show();
|
||||||
|
// }else if(updateStatus==UpdateStatus.IGNORED){
|
||||||
|
// Toast.makeText(ActAutoUpdate.this, "该版本已被忽略更新", Toast.LENGTH_SHORT).show();
|
||||||
|
// }else if(updateStatus==UpdateStatus.ErrorSizeFormat){
|
||||||
|
// Toast.makeText(ActAutoUpdate.this, "请检查target_size填写的格式,请使用file.length()方法获取apk大小。", Toast.LENGTH_SHORT).show();
|
||||||
|
// }else if(updateStatus==UpdateStatus.TimeOut){
|
||||||
|
// Toast.makeText(ActAutoUpdate.this, "查询出错或查询超时", Toast.LENGTH_SHORT).show();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 设置对对话框按钮的点击事件的监听
|
||||||
|
BmobUpdateAgent.setDialogListener(new BmobDialogButtonListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(int status) {
|
||||||
|
switch (status) {
|
||||||
|
case UpdateStatus.Update:
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "点击了立即更新按钮" , Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case UpdateStatus.NotNow:
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "点击了以后再说按钮" , Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
case UpdateStatus.Close://只有在强制更新状态下才会在更新对话框的右上方出现close按钮,如果用户不点击”立即更新“按钮,这时候开发者可做些操作,比如直接退出应用等
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "点击了对话框关闭按钮" , Toast.LENGTH_SHORT).show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testAutoUpdate(int pos){
|
||||||
|
switch (pos) {
|
||||||
|
case 1://自动更新
|
||||||
|
BmobUpdateAgent.update(this);
|
||||||
|
break;
|
||||||
|
case 2://手动更新
|
||||||
|
BmobUpdateAgent.forceUpdate(this);
|
||||||
|
break;
|
||||||
|
case 3://静默下载
|
||||||
|
BmobUpdateAgent.silentUpdate(this);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if(ur != null){
|
||||||
|
File file = new File(Environment.getExternalStorageDirectory(), ur.path_md5 + ".apk");
|
||||||
|
if (file != null && file.exists()) {
|
||||||
|
if (file.delete()) {
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "删除完成",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "删除失败",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "删除完成", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toast.makeText(ActAutoUpdate.this, "删除失败", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.bmob.sdkdemo.bean;
|
||||||
|
|
||||||
|
public class BankCard{
|
||||||
|
|
||||||
|
private String cardNumber;
|
||||||
|
private String bankName;
|
||||||
|
|
||||||
|
public BankCard(String bankName, String cardNumber){
|
||||||
|
this.bankName = bankName;
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardNumber() {
|
||||||
|
return cardNumber;
|
||||||
|
}
|
||||||
|
public void setCardNumber(String cardNumber) {
|
||||||
|
this.cardNumber = cardNumber;
|
||||||
|
}
|
||||||
|
public String getBankName() {
|
||||||
|
return bankName;
|
||||||
|
}
|
||||||
|
public void setBankName(String bankName) {
|
||||||
|
this.bankName = bankName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package cn.bmob.sdkdemo.bean;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
|
||||||
|
public class GameScore extends BmobObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public GameScore(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameScore(String tableName){
|
||||||
|
super(tableName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家
|
||||||
|
*/
|
||||||
|
private MyUser player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家昵称--对应User表的用户名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 游戏得分
|
||||||
|
*/
|
||||||
|
private Integer playScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到得分
|
||||||
|
*/
|
||||||
|
private Integer signScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏(玩家所玩的游戏)
|
||||||
|
*/
|
||||||
|
private String game;
|
||||||
|
|
||||||
|
private BmobGeoPoint gps;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BmobGeoPoint getGps() {
|
||||||
|
return gps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGps(BmobGeoPoint gps) {
|
||||||
|
this.gps = gps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyUser getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayer(MyUser player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGame() {
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGame(String game) {
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPlayScore() {
|
||||||
|
return playScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayScore(Integer playScore) {
|
||||||
|
this.playScore = playScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSignScore() {
|
||||||
|
return signScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignScore(Integer signScore) {
|
||||||
|
this.signScore = signScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package cn.bmob.sdkdemo.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
|
||||||
|
public class MyUser extends BmobUser {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Integer age;
|
||||||
|
private Integer num;
|
||||||
|
private Boolean sex;
|
||||||
|
|
||||||
|
private List<String> hobby; // 对应服务端Array类型:String类型的集合
|
||||||
|
private List<BankCard> cards; // 对应服务端Array类型:Object类型的集合
|
||||||
|
|
||||||
|
private BankCard mainCard; //主卡
|
||||||
|
private Person banker; //银行工作人员
|
||||||
|
|
||||||
|
public Boolean getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
public void setSex(Boolean sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
public List<String> getHobby() {
|
||||||
|
return hobby;
|
||||||
|
}
|
||||||
|
public void setHobby(List<String> hobby) {
|
||||||
|
this.hobby = hobby;
|
||||||
|
}
|
||||||
|
public List<BankCard> getCards() {
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
public void setCards(List<BankCard> cards) {
|
||||||
|
this.cards = cards;
|
||||||
|
}
|
||||||
|
public Integer getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
public void setNum(Integer num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
public Integer getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(Integer age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
public BankCard getMainCard() {
|
||||||
|
return mainCard;
|
||||||
|
}
|
||||||
|
public void setMainCard(BankCard mainCard) {
|
||||||
|
this.mainCard = mainCard;
|
||||||
|
}
|
||||||
|
public Person getBanker() {
|
||||||
|
return banker;
|
||||||
|
}
|
||||||
|
public void setBanker(Person banker) {
|
||||||
|
this.banker = banker;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getUsername()+"\n"+getObjectId()+"\n"+age+"\n"+num+"\n"+getSessionToken()+"\n"+getEmailVerified();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package cn.bmob.sdkdemo.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BmobDate;
|
||||||
|
import cn.bmob.v3.datatype.BmobFile;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
|
||||||
|
public class Person extends BmobObject {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String name;
|
||||||
|
private Integer age;
|
||||||
|
private Boolean gender;
|
||||||
|
private String address;
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private BankCard bankCard; // 对应服务端的Object类型
|
||||||
|
private List<String> hobby; // 对应服务端Array类型:String类型的集合
|
||||||
|
private List<BankCard> cards; // 对应服务端Array类型:Object类型的集合
|
||||||
|
|
||||||
|
private BmobFile pic;
|
||||||
|
private BmobGeoPoint gpsAdd;
|
||||||
|
private BmobDate uploadTime;
|
||||||
|
private MyUser author;
|
||||||
|
|
||||||
|
public MyUser getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
public void setAuthor(MyUser author) {
|
||||||
|
this.author = author;
|
||||||
|
}
|
||||||
|
public Boolean getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public Integer getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
public void setAge(Integer age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
public Boolean isGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
public void setGender(Boolean gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
public BmobFile getPic() {
|
||||||
|
return pic;
|
||||||
|
}
|
||||||
|
public void setPic(BmobFile pic) {
|
||||||
|
this.pic = pic;
|
||||||
|
}
|
||||||
|
public BmobGeoPoint getGpsAdd() {
|
||||||
|
return gpsAdd;
|
||||||
|
}
|
||||||
|
public void setGpsAdd(BmobGeoPoint gpsAdd) {
|
||||||
|
this.gpsAdd = gpsAdd;
|
||||||
|
}
|
||||||
|
public BmobDate getUploadTime() {
|
||||||
|
return uploadTime;
|
||||||
|
}
|
||||||
|
public void setUploadTime(BmobDate uploadTime) {
|
||||||
|
this.uploadTime = uploadTime;
|
||||||
|
}
|
||||||
|
public BankCard getBankCard() {
|
||||||
|
return bankCard;
|
||||||
|
}
|
||||||
|
public void setBankCard(BankCard bankCard) {
|
||||||
|
this.bankCard = bankCard;
|
||||||
|
}
|
||||||
|
public List<String> getHobby() {
|
||||||
|
return hobby;
|
||||||
|
}
|
||||||
|
public void setHobby(List<String> hobby) {
|
||||||
|
this.hobby = hobby;
|
||||||
|
}
|
||||||
|
public List<BankCard> getCards() {
|
||||||
|
return cards;
|
||||||
|
}
|
||||||
|
public void setCards(List<BankCard> cards) {
|
||||||
|
this.cards = cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,170 @@
|
||||||
|
package cn.bmob.sdkdemo.crud;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.BankCard;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.v3.datatype.BmobDate;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增删改查
|
||||||
|
*/
|
||||||
|
public class CRUDActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_crud_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
testinsertObject();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
testUpdateObjet();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
testDeleteObject();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
startActivity(new Intent(this, QueryActivity.class));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String objectId="";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入对象
|
||||||
|
*/
|
||||||
|
private void testinsertObject() {
|
||||||
|
final Person p2 = new Person();
|
||||||
|
p2.setName("lucky");
|
||||||
|
p2.setAddress("北京市海淀区");
|
||||||
|
p2.setAge(25);
|
||||||
|
//添加Object类型
|
||||||
|
p2.setBankCard(new BankCard("哈哈", "111"));
|
||||||
|
//添加Object类型的数组
|
||||||
|
List<BankCard> cards =new ArrayList<BankCard>();
|
||||||
|
for(int i=0;i<2;i++){
|
||||||
|
cards.add(new BankCard("建行", "111"+i));
|
||||||
|
}
|
||||||
|
p2.addAll("cards", cards);
|
||||||
|
//添加String类型的数组
|
||||||
|
p2.addAll("hobby", Arrays.asList("游泳", "看书")); // 一次添加多个值到hobby字段中
|
||||||
|
// p2.add("cards",new BankCard("建行", "111"));//一次添加单个值
|
||||||
|
p2.setGpsAdd(new BmobGeoPoint(112.934755, 24.52065));
|
||||||
|
p2.setUploadTime(new BmobDate(new Date()));
|
||||||
|
p2.save(new SaveListener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
objectId = p2.getObjectId();
|
||||||
|
toast("创建数据成功:" + p2.getObjectId());
|
||||||
|
Log.d("bmob", "objectId = " + p2.getObjectId());
|
||||||
|
Log.d("bmob", "name =" + p2.getName());
|
||||||
|
Log.d("bmob", "age =" + p2.getAge());
|
||||||
|
Log.d("bmob", "address =" + p2.getAddress());
|
||||||
|
Log.d("bmob", "gender =" + p2.isGender());
|
||||||
|
Log.d("bmob", "createAt = " + p2.getCreatedAt());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新对象
|
||||||
|
*/
|
||||||
|
private void testUpdateObjet() {
|
||||||
|
final Person p2 = new Person();
|
||||||
|
//更新数组中的某个位置的对象值
|
||||||
|
p2.setValue("cards.0", new BankCard("cards.0", "cards.0的值"));
|
||||||
|
//更新对象数组中指定对象的指定字段的值
|
||||||
|
// p2.setValue("cards.0.bankName", "银行卡");
|
||||||
|
// p2.setValue("cards.0.cardNumber", "卡号");
|
||||||
|
// p2.setValue("cards.1.bankName", "银行卡");
|
||||||
|
//更新BmobObject的值
|
||||||
|
// p2.setValue("author", BmobUser.getCurrentUser(this, MyUser.class));
|
||||||
|
//更新Object类型的数组
|
||||||
|
// List<BankCard> cards =new ArrayList<BankCard>();
|
||||||
|
// for(int i=0;i<2;i++){
|
||||||
|
// cards.add(new BankCard("叫姐姐"+i, "111"+i));
|
||||||
|
// }
|
||||||
|
// p2.setValue("cards",cards);
|
||||||
|
//更新Object对象
|
||||||
|
p2.setValue("bankCard",new BankCard("bankCard", "bankCard的值"));
|
||||||
|
//更新Object对象的值
|
||||||
|
// p2.setValue("bankCard.bankName","你妹");
|
||||||
|
//更新Integer类型
|
||||||
|
// p2.setValue("age",11);
|
||||||
|
// p2.setValue("gender", true);
|
||||||
|
p2.update(objectId, new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("更新成功:" + p2.getUpdatedAt());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除对象
|
||||||
|
*/
|
||||||
|
private void testDeleteObject() {
|
||||||
|
Person p2 = new Person();
|
||||||
|
p2.removeAll("cards", Arrays.asList(new BankCard("建行", "111")));
|
||||||
|
p2.setObjectId(objectId);
|
||||||
|
p2.update(new UpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("删除成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,367 @@
|
||||||
|
package cn.bmob.sdkdemo.crud;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.sdkdemo.file.Movie;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobQuery.CachePolicy;
|
||||||
|
import cn.bmob.v3.datatype.BmobDate;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.CountListener;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
import cn.bmob.v3.listener.QueryListener;
|
||||||
|
import rx.Subscriber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public class QueryActivity extends BaseActivity {
|
||||||
|
|
||||||
|
protected ListView mListview;
|
||||||
|
protected BaseAdapter mAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_find);
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_findtest_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
testFind(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testFind(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
queryOne();
|
||||||
|
// queryOneByTable();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
queryObjects();
|
||||||
|
// queryObjectsByTable();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
countObjects();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
compositeAndQuery();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
compositeOrQuery();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
queryArrays();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据表名查询多条数据
|
||||||
|
*/
|
||||||
|
public void queryObjectsByTable(){
|
||||||
|
BmobQuery query =new BmobQuery("Person");
|
||||||
|
query.addWhereEqualTo("age", 25);
|
||||||
|
query.setLimit(2);
|
||||||
|
query.order("createdAt");
|
||||||
|
query.findObjectsByTable(new QueryListener<JSONArray>() {
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log(ary.toString());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void queryObjects(){
|
||||||
|
final BmobQuery<Person> bmobQuery = new BmobQuery<Person>();
|
||||||
|
bmobQuery.addWhereEqualTo("age", 25);
|
||||||
|
bmobQuery.setLimit(2);
|
||||||
|
bmobQuery.order("createdAt");
|
||||||
|
//先判断是否有缓存
|
||||||
|
boolean isCache = bmobQuery.hasCachedResult(Person.class);
|
||||||
|
if(isCache){
|
||||||
|
bmobQuery.setCachePolicy(CachePolicy.CACHE_ELSE_NETWORK); // 先从缓存取数据,如果没有的话,再从网络取。
|
||||||
|
}else{
|
||||||
|
bmobQuery.setCachePolicy(CachePolicy.NETWORK_ELSE_CACHE); // 如果没有缓存的话,则先从网络中取
|
||||||
|
}
|
||||||
|
// observable形式
|
||||||
|
bmobQuery.findObjectsObservable(Person.class)
|
||||||
|
.subscribe(new Subscriber<List<Person>>() {
|
||||||
|
@Override
|
||||||
|
public void onCompleted() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(List<Person> persons) {
|
||||||
|
log("查询成功:共"+persons.size()+"条数据。");
|
||||||
|
toast("查询成功:共"+persons.size()+"条数据。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// bmobQuery.findObjects(new FindListener<Person>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(List<Person> object, BmobException e) {
|
||||||
|
// if(e==null){
|
||||||
|
// toast("查询成功:共"+object.size()+"条数据。");
|
||||||
|
// for (Person person : object) {
|
||||||
|
// Log.d(TAG, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
|
||||||
|
// Log.d(TAG, "ObjectId = "+person.getObjectId());
|
||||||
|
// Log.d(TAG, "Name = "+person.getName());
|
||||||
|
// Log.d(TAG, "Age = "+person.getAge());
|
||||||
|
// Log.d(TAG, "Address = "+person.getAddress());
|
||||||
|
// Log.d(TAG, "Gender = "+person.isGender());
|
||||||
|
// Log.d(TAG, "CreatedAt = "+person.getCreatedAt());
|
||||||
|
// Log.d(TAG, "UpdatedAt = "+person.getUpdatedAt());
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// loge(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据表名查询单条数据
|
||||||
|
*/
|
||||||
|
public void queryOneByTable(){
|
||||||
|
BmobQuery query =new BmobQuery("Movie");
|
||||||
|
query.getObjectByTable("5f1042e183", new QueryListener<JSONObject>() {
|
||||||
|
@Override
|
||||||
|
public void done(JSONObject jsonObject, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log(jsonObject.toString());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void queryOne(){
|
||||||
|
BmobQuery<Movie> query = new BmobQuery();
|
||||||
|
query.getObject("caa86e4ab8", new QueryListener<Movie>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Movie movie, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log(movie.getFile().getFileUrl()+","+movie.getName());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**查询2015-05-01当天的Person数据
|
||||||
|
* @method queryObject
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
public void queryDate(){
|
||||||
|
BmobQuery<Person> bmobQuery = new BmobQuery<Person>();
|
||||||
|
//查询2015-05-01当天的Person数据
|
||||||
|
List<BmobQuery<Person>> and = new ArrayList<BmobQuery<Person>>();
|
||||||
|
BmobQuery<Person> q1 = new BmobQuery<Person>();
|
||||||
|
String start = "2016-03-23 00:00:00";
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
date = sdf.parse(start);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
q1.addWhereGreaterThanOrEqualTo("createdAt",new BmobDate(date));
|
||||||
|
and.add(q1);
|
||||||
|
|
||||||
|
BmobQuery<Person> q2 = new BmobQuery<Person>();
|
||||||
|
String end = "2016-03-23 15:55:00";
|
||||||
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date date1 = null;
|
||||||
|
try {
|
||||||
|
date1 = sdf1.parse(end);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
q2.addWhereLessThanOrEqualTo("createdAt",new BmobDate(date1));
|
||||||
|
and.add(q2);
|
||||||
|
bmobQuery.and(and);
|
||||||
|
bmobQuery.setLimit(10);
|
||||||
|
bmobQuery.order("-createdAt");
|
||||||
|
boolean cache = bmobQuery.hasCachedResult(Person.class);
|
||||||
|
toast("是否有缓存:"+cache);
|
||||||
|
bmobQuery.setCachePolicy(CachePolicy.CACHE_ELSE_NETWORK); // 先从缓存取数据,如果没有的话,再从网络取。
|
||||||
|
bmobQuery.findObjects(new FindListener<Person>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> objects, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(objects!=null && objects.size()>0){
|
||||||
|
toast("查询成功:"+objects.size()+"个");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void countObjects(){
|
||||||
|
BmobQuery<Person> bmobQuery = new BmobQuery<Person>();
|
||||||
|
bmobQuery.count(Person.class, new CountListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Integer count, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("count对象个数为:"+count);
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 复合与查询:查询年龄6-29岁之间,且姓名以"y"或者"e"结尾的人
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void compositeAndQuery(){
|
||||||
|
//查询年龄6-29岁之间的人,每一个查询条件都需要new一个BmobQuery对象
|
||||||
|
//--and条件1
|
||||||
|
BmobQuery<Person> eq1 = new BmobQuery<Person>();
|
||||||
|
eq1.addWhereLessThanOrEqualTo("age", 29);//年龄<=29
|
||||||
|
//--and条件2
|
||||||
|
BmobQuery<Person> eq2 = new BmobQuery<Person>();
|
||||||
|
eq2.addWhereGreaterThanOrEqualTo("age", 6);//年龄>=6
|
||||||
|
|
||||||
|
//查询姓名以"y"或者"e"结尾的人--这个需要使用到or查询
|
||||||
|
//--and条件3
|
||||||
|
BmobQuery<Person> eq3 = new BmobQuery<Person>();
|
||||||
|
eq3.addWhereEndsWith("name", "y");
|
||||||
|
BmobQuery<Person> eq4 = new BmobQuery<Person>();
|
||||||
|
eq4.addWhereEndsWith("name", "e");
|
||||||
|
List<BmobQuery<Person>> queries = new ArrayList<BmobQuery<Person>>();
|
||||||
|
queries.add(eq3);
|
||||||
|
queries.add(eq4);
|
||||||
|
BmobQuery<Person> mainQuery = new BmobQuery<Person>();
|
||||||
|
BmobQuery<Person> or = mainQuery.or(queries);
|
||||||
|
|
||||||
|
//最后组装完整的and条件
|
||||||
|
List<BmobQuery<Person>> andQuerys = new ArrayList<BmobQuery<Person>>();
|
||||||
|
andQuerys.add(eq1);
|
||||||
|
andQuerys.add(eq2);
|
||||||
|
andQuerys.add(or);
|
||||||
|
//查询符合整个and条件的人
|
||||||
|
BmobQuery<Person> query = new BmobQuery<Person>();
|
||||||
|
query.and(andQuerys);
|
||||||
|
query.findObjects(new FindListener<Person>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("查询年龄6-29岁之间,姓名以'y'或者'e'结尾的人个数:"+object.size());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 复合或查询:查询name字段有值且不为"",查询age 等于 29 或者 age 等于 6 的人
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void compositeOrQuery(){
|
||||||
|
// BmobQuery<Person> and1 = new BmobQuery<Person>();
|
||||||
|
// and1.addWhereExists("name");
|
||||||
|
// BmobQuery<Person> and2 = new BmobQuery<Person>();
|
||||||
|
// and2.addWhereNotEqualTo("name", "");
|
||||||
|
// List<BmobQuery<Person>> ands = new ArrayList<BmobQuery<Person>>();
|
||||||
|
// ands.add(and1);
|
||||||
|
// ands.add(and2);
|
||||||
|
BmobQuery<Person> or1 = new BmobQuery<Person>();
|
||||||
|
or1.addWhereMatches("name", "luck");
|
||||||
|
BmobQuery<Person> or2 = new BmobQuery<Person>();
|
||||||
|
or2.addWhereMatches("address", "北京");
|
||||||
|
List<BmobQuery<Person>> ors = new ArrayList<BmobQuery<Person>>();
|
||||||
|
ors.add(or1);
|
||||||
|
ors.add(or2);
|
||||||
|
BmobQuery<Person> mainQuery = new BmobQuery<Person>();
|
||||||
|
// mainQuery.order("-createdAt");
|
||||||
|
// mainQuery.and(ands);
|
||||||
|
mainQuery.or(ors);
|
||||||
|
mainQuery.findObjects(new FindListener<Person>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("年龄为29或者6岁人的个数:"+object.size());
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数组查询
|
||||||
|
*/
|
||||||
|
public void queryArrays(){
|
||||||
|
BmobQuery<Person> query = new BmobQuery<Person>();
|
||||||
|
//查询喜欢看书的人
|
||||||
|
String[] hobby = {"看书"};
|
||||||
|
query.addWhereContainsAll("hobby", Arrays.asList(hobby));
|
||||||
|
query.findObjects(new FindListener<Person>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("查询成功:共" + object.size() + "条数据。");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,367 @@
|
||||||
|
package cn.bmob.sdkdemo.crud;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.GameScore;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobQuery.CachePolicy;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.datatype.BmobQueryResult;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.QueryListener;
|
||||||
|
import cn.bmob.v3.listener.SQLQueryListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @class QuerySQLActivity
|
||||||
|
* @author smile
|
||||||
|
*/
|
||||||
|
public class QuerySQLActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.tv_item, getResources().getStringArray(R.array.bmob_sql_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
querySql();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
queryCountSql();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
queryStatisticSql();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
queryStatmentSql();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void querySql(){
|
||||||
|
//------------查询所有数据-------------------------------------------
|
||||||
|
// String sql = "select * from GameScore";//查询所有的游戏得分记录
|
||||||
|
|
||||||
|
//------------比较查询:相等、不等、大于、小于、大于等于、小于等于...-------------
|
||||||
|
// String sql = "select * from GameScore where playScore<10";//查询玩家得分在10以下的信息
|
||||||
|
// String sql = "select * from GameScore where game='地铁跑酷'";//查询所有玩地铁跑酷这个游戏的游戏记录
|
||||||
|
// String sql = "select * from GameScore where game!='地铁跑酷'";//查询除地铁跑酷这个游戏以外的游戏记录
|
||||||
|
|
||||||
|
//------------值是否存在查询------------------------------------------
|
||||||
|
// String sql = "select * from GameScore where gps is not exists";//查询GameScore表中没有地理位置的所有信息(值是否存在的界定就是你没有为这个字段设置初始值,空字符串代表有值)
|
||||||
|
|
||||||
|
//------------模糊查询------------------------------------------------
|
||||||
|
// String sql = "select * from GameScore where game like 地铁%";//查询GameScore表中游戏名以地铁开头的信息
|
||||||
|
// String sql = "select * from GameScore where game not like 地铁%";//查询GameScore表中游戏名不以地铁开头的信息
|
||||||
|
// String sql = "select * from GameScore where game regexp 地铁.*";//查询GameScore表中游戏名以地铁开头的信息
|
||||||
|
|
||||||
|
//------------数组查询------------------------------------------------
|
||||||
|
//查询有游泳爱好的人(注意hobby是Person表中表示爱好的一个数组类型的字段)
|
||||||
|
// String sql = "select * from Person where hobby ='游泳'";//
|
||||||
|
//查询既爱好游泳也爱好看书的人
|
||||||
|
// String sql = "select * from Person where hobby all ('游泳','看书')";//
|
||||||
|
// new BmobQuery<Person>().doSQLQuery(sql, new SQLQueryListener<Person>(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(BmobQueryResult<Person> result, BmobException e) {
|
||||||
|
// if(e ==null){
|
||||||
|
// List<Person> list = (List<Person>) result.getResults();
|
||||||
|
// if(list!=null && list.size()>0){
|
||||||
|
// for(int i=0;i<list.size();i++){
|
||||||
|
// Person p = list.get(i);
|
||||||
|
// Log.i("smile", ""+p.getName()+"-"+p.getAddress()+"-"+p.getAge());
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "查询成功,无数据返回");
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
//内置函数:
|
||||||
|
//------------Date查询------------------------------------------------
|
||||||
|
// String dateString = "2015-05-12";
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
// Date date = null;
|
||||||
|
// try {
|
||||||
|
// date = sdf.parse(dateString);
|
||||||
|
// } catch (ParseException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// String sql = "select * from GameScore where createdAt < date('"+new BmobDate(date).getDate()+"')";//查询2015年5月12日之前的数据
|
||||||
|
//上面的sql等同于下面的写法
|
||||||
|
// String sql = "select * from GameScore where createdAt < {'__type': 'Date','iso': '"+new BmobDate(date).getDate()+"'}";//查询2015年5月12日之前的数据
|
||||||
|
|
||||||
|
//------------pointer查询------------------------------------------------
|
||||||
|
//查询当前用户的游戏记录
|
||||||
|
// MyUser user = BmobUser.getCurrentUser(this, MyUser.class);
|
||||||
|
// //第一种写法:
|
||||||
|
// String sql = "select * from GameScore where player = pointer('_User', "+"'"+user.getObjectId()+"')";
|
||||||
|
// //第二种写法:
|
||||||
|
// String d = "{'__type':'Pointer','className':'_User','objectId':'"+user.getObjectId()+"'}";
|
||||||
|
// String sql = "select * from GameScore where player = "+d;
|
||||||
|
|
||||||
|
//------------地理位置查询-----------------------------------------------------
|
||||||
|
//1、查询指定地理位置
|
||||||
|
//第一种写法
|
||||||
|
// String sql = "select * from GameScore where gps = geopoint(112.934755,24.52065)";//查询在指定地理位置的游戏记录
|
||||||
|
//第二种写法
|
||||||
|
// String sql = "select * from GameScore where gps = {'__type':'GeoPoint','latitude':24.52065,'longitude':112.934755}";
|
||||||
|
|
||||||
|
//2、查询指定地理位置附近的信息(类似搜索附近的人)
|
||||||
|
// String sql = "select * from GameScore where gps near geopoint(112.934755,24.52065)";//查询在指定地理位置附近的游戏记录(由近及远的排列)
|
||||||
|
// String sql = "select * from GameScore where gps near [112.934755,24.52065]";//查询在指定地理位置附近的游戏记录
|
||||||
|
//
|
||||||
|
// //3、为附近的人限定最大搜索距离
|
||||||
|
// String sql = "select * from GameScore where gps near [112.934755,24.52065] max 1 km";//查询在指定地理位置附近1km以内的游戏记录
|
||||||
|
//
|
||||||
|
// //4、查询矩形范围内
|
||||||
|
// String sql = "select * from GameScore where gps within [102.934755,24.52065] and [112.934755,24.52065]";
|
||||||
|
|
||||||
|
//------------include查询:------------------------------------------------
|
||||||
|
//比如你想将游戏玩家的信息也查询出来
|
||||||
|
// String sql = "select include player,* from GameScore limit 5";
|
||||||
|
|
||||||
|
//------------子查询--------------------------------------使用in来做子查询
|
||||||
|
//1、in后面可以是个列表,比如查询游戏名为地铁跑酷、部落冲突的游戏记录:
|
||||||
|
// String sql = "select * from GameScore where game in ('地铁跑酷','部落冲突')";
|
||||||
|
//2、in后面也可以是个子查询
|
||||||
|
//比如要查询游戏得分大于10的用户数据,这里需要username的值必须要在子查询产生的数组中,因此我在GameScore表中新建了一个name字段来表示玩家的姓名
|
||||||
|
// String sql="select * from _User where username in (select name from GameScore where playScore>10)";
|
||||||
|
//查询年龄大于20的玩家的游戏信息
|
||||||
|
// String sql="select * from GameScore where name in (select username from _User where age>20)";
|
||||||
|
// 比如 要查询带有图片的微博的评论列表:
|
||||||
|
|
||||||
|
//------------关系查询------------------------------------------------------------
|
||||||
|
//查询某条微博的所有评论信息-这里只是举个例子,具体可查看该工程中CommentListActivity类
|
||||||
|
//Weibo下面有个Relation类型的字段叫comment,存储了这条微博所有的评论信息,你可以查询到这些评论信息,因为他们都关联到了同一条微博
|
||||||
|
// String sql="select include author,* from Comment where related comment to pointer('Weibo','15e67b68ce')";
|
||||||
|
|
||||||
|
//------------复合查询------------------------------------------------------------
|
||||||
|
//1、复合与查询:查询游戏得分在10-15之间的数据
|
||||||
|
// String sql ="select * from GameScore where playScore>10 and playScore<=15";
|
||||||
|
//2、复合或查询:再加个条件,游戏得分为5
|
||||||
|
// String sql ="select * from GameScore where playScore>10 and playScore<=15 or playScore=5";
|
||||||
|
//等价于下面的语句
|
||||||
|
// String sql ="select * from GameScore where (playScore>10 and playScore<=15) or playScore=5";
|
||||||
|
|
||||||
|
//------------分页查询------------------------------------------------------------
|
||||||
|
// String sql = "select * from GameScore limit 10,10";//比如从第 10 条开始向后查找 10 条GameScore数据
|
||||||
|
|
||||||
|
//------------结果排序------------------------------------------------------------
|
||||||
|
String sql = "select * from GameScore order by playScore,signScore desc";//根据得分(playScore)升序排序,当playScore相同情况下再根据signScore降序排列
|
||||||
|
//------------缓存查询------------------------------------------------------------
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.setSQL(sql);
|
||||||
|
boolean isCache = query.hasCachedResult(GameScore.class);
|
||||||
|
toast("是否有缓存:"+isCache);
|
||||||
|
if(isCache){
|
||||||
|
query.setCachePolicy(CachePolicy.CACHE_ELSE_NETWORK); // 先从缓存取数据,如果没有的话,再从网络取。
|
||||||
|
}else{
|
||||||
|
query.setCachePolicy(CachePolicy.NETWORK_ELSE_CACHE); // 如果没有缓存的话,则先从网络中取
|
||||||
|
}
|
||||||
|
//执行SQL查询操作
|
||||||
|
query.doSQLQuery(sql, new SQLQueryListener<GameScore>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobQueryResult<GameScore> result, BmobException e) {
|
||||||
|
if(e ==null){
|
||||||
|
List<GameScore> list = (List<GameScore>) result.getResults();
|
||||||
|
if(list!=null && list.size()>0){
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
GameScore p = list.get(i);
|
||||||
|
log(""+p.getPlayer()+"-"+p.getGame()+"-"+p.getPlayScore()+"-"+p.getSignScore());
|
||||||
|
}
|
||||||
|
toast("查询成功:"+list.size());
|
||||||
|
}else{
|
||||||
|
toast("查询成功,无数据返回");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
toast("错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void queryCountSql(){
|
||||||
|
// String sql = "select count(*) from GameScore";//查询GameScore表中的总记录数
|
||||||
|
String sql = "select count(objectId) from GameScore";//查询GameScore表中的总记录数
|
||||||
|
// String sql = "select count(*),* from GameScore";//查询GameScore表中总记录数并返回所有记录信息
|
||||||
|
// String sql = "select count(*),game from GameScore";//查询GameScore表中的总数并返回每条记录的游戏名(允许返回特定字段)
|
||||||
|
// String sql = "select count(*) from GameScore where playScore>10 and where playScore<20";//查询总的记录数并返回得分在10-20之间的信息
|
||||||
|
new BmobQuery<GameScore>().doSQLQuery(sql, new SQLQueryListener<GameScore>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobQueryResult<GameScore> result, BmobException e) {
|
||||||
|
if(e ==null){
|
||||||
|
int count = result.getCount();
|
||||||
|
log("个数:"+count);
|
||||||
|
List<GameScore> list = (List<GameScore>) result.getResults();
|
||||||
|
if(list.size()>0){
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
GameScore p = list.get(i);
|
||||||
|
log(""+p.getPlayer()+"-"+p.getGame()+"-"+p.getPlayScore()+"-"+p.getSignScore());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log("错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**统计查询
|
||||||
|
* @method queryStatisticql
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryStatisticSql(){
|
||||||
|
String bql = "select sum(playScore) from GameScore group by name order by -createdAt";//求和,按照玩家名进行分组并按照时间降序排列
|
||||||
|
new BmobQuery<GameScore>().doStatisticQuery(bql,new QueryListener<JSONArray>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e ==null){
|
||||||
|
if(ary!=null){//
|
||||||
|
try {
|
||||||
|
JSONObject obj = ary.getJSONObject(0);
|
||||||
|
int sum = obj.getInt("_sumPlayScore");
|
||||||
|
String name = obj.getString("name");
|
||||||
|
showToast("游戏总得分:" + sum+",name:"+name);
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**占位符查询
|
||||||
|
* @method queryStatmentSql
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryStatmentSql(){
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
if(user==null){
|
||||||
|
toast("请先登录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//查询当前用户在2015年5月12日之前,在特定地理位置附近的游戏记录
|
||||||
|
String sql = "select * from GameScore where createdAt > date(?) and player = pointer(?,?) and gps near geopoint(?,?)";
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.setSQL(sql);
|
||||||
|
query.setPreparedParams(new Object[]{"2015-05-12 00:00:00","_User",user.getObjectId(),112.934755,24.52065});
|
||||||
|
boolean isCache = query.hasCachedResult(GameScore.class);
|
||||||
|
log("isCache = "+isCache);
|
||||||
|
if(isCache){
|
||||||
|
query.setCachePolicy(CachePolicy.CACHE_ELSE_NETWORK); // 先从缓存取数据,如果没有的话,再从网络取。
|
||||||
|
}else{
|
||||||
|
query.setCachePolicy(CachePolicy.NETWORK_ELSE_CACHE); // 如果没有缓存的话,则先从网络中取
|
||||||
|
}
|
||||||
|
query.doSQLQuery(new SQLQueryListener<GameScore>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobQueryResult<GameScore> result, BmobException e) {
|
||||||
|
if(e ==null){
|
||||||
|
List<GameScore> list = (List<GameScore>) result.getResults();
|
||||||
|
if(list!=null && list.size()>0){
|
||||||
|
for(int i=0;i<list.size();i++){
|
||||||
|
GameScore p = list.get(i);
|
||||||
|
log(""+p.getPlayer()+"-"+p.getGame()+"-"+p.getPlayScore()+"-"+p.getSignScore());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log("查询成功,无数据返回");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//等同于下面的查询方法
|
||||||
|
// new BmobQuery<GameScore>().doSQLQuery(sql,new SQLQueryListener<GameScore>(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(BmobQueryResult<GameScore> result, BmobException e) {
|
||||||
|
// if(e ==null){
|
||||||
|
// List<GameScore> list = (List<GameScore>) result.getResults();
|
||||||
|
// if(list!=null && list.size()>0){
|
||||||
|
// for(int i=0;i<list.size();i++){
|
||||||
|
// GameScore p = list.get(i);
|
||||||
|
// log( ""+p.getPlayer()+"-"+p.getGame()+"-"+p.getPlayScore()+"-"+p.getSignScore());
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// log( "查询成功,无数据返回");
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// loge(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },"2015-05-12 00:00:00","_User",user.getObjectId(),112.934755,24.52065);
|
||||||
|
|
||||||
|
//有关统计查询的占位符功能
|
||||||
|
// String bql = "select sum(playScore),count(*) from GameScore group by game having _sumPlayScore>200";//按照游戏进行分组并获取总分组大于10的统计信息
|
||||||
|
// new BmobQuery<GameScore>().doStatisticQuery(bql,new StatisticQueryListener(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(Object result, BmobException e) {
|
||||||
|
// if(e ==null){
|
||||||
|
// JSONArray ary = (JSONArray) result;
|
||||||
|
// if(ary!=null){//
|
||||||
|
// try {
|
||||||
|
// JSONObject obj = ary.getJSONObject(0);
|
||||||
|
// int sum = obj.getInt("_sumPlayScore");
|
||||||
|
// showToast("游戏总得分:" + sum);
|
||||||
|
// } catch (JSONException e1) {
|
||||||
|
// e1.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// showToast("查询成功,无数据");
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// loge(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,415 @@
|
||||||
|
package cn.bmob.sdkdemo.crud;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.GameScore;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobBatch;
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.datatype.BatchResult;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.QueryListListener;
|
||||||
|
import cn.bmob.v3.listener.QueryListener;
|
||||||
|
|
||||||
|
|
||||||
|
public class QueryStatisticActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_statistic_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
createGameScores();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createGameScores() {
|
||||||
|
List<BmobObject> scores = new ArrayList<BmobObject>();
|
||||||
|
//添加测试数据
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
GameScore score = new GameScore();
|
||||||
|
score.setGps(new BmobGeoPoint(112.934755,24.52065));
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
score.setName(user.getUsername());
|
||||||
|
score.setPlayer(user);
|
||||||
|
score.setGame("地铁跑酷");
|
||||||
|
score.setPlayScore(5 + i);
|
||||||
|
score.setSignScore(i);
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
GameScore score = new GameScore();
|
||||||
|
score.setGps(new BmobGeoPoint(111.934755,25.52065));
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);//为了测试pointer类型,因此需要用户登陆
|
||||||
|
score.setName(user.getUsername());
|
||||||
|
score.setPlayer(user);
|
||||||
|
score.setGame("部落冲突");
|
||||||
|
score.setPlayScore(10 + i);
|
||||||
|
score.setSignScore(5+i);
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
BmobBatch batch = new BmobBatch();
|
||||||
|
batch.insertBatch(scores);
|
||||||
|
batch.doBatch(new QueryListListener<BatchResult>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> results, BmobException ex) {
|
||||||
|
if(ex==null){//这个ex只是代表此次请求正常返回-至于返回的是正确的还是错误的,需要查看BatchResult里面的数据
|
||||||
|
for(int i=0;i<results.size();i++){
|
||||||
|
BatchResult result= results.get(i);
|
||||||
|
if(result.isSuccess()){//只有批量添加才返回objectId
|
||||||
|
log(result.getObjectId());
|
||||||
|
}else{
|
||||||
|
BmobException error= result.getError();
|
||||||
|
log(error.getErrorCode()+","+error.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:// 计算单个列的总和
|
||||||
|
querySum();
|
||||||
|
break;
|
||||||
|
case 2:// 分组计算总和
|
||||||
|
querySumByGroup();
|
||||||
|
break;
|
||||||
|
case 3:// 多个分组并计算多个列的总和
|
||||||
|
querySumsByGroups();
|
||||||
|
break;
|
||||||
|
case 4:// 分组计算总和并返回满足过滤条件的
|
||||||
|
querySumByHaving();
|
||||||
|
break;
|
||||||
|
case 5:// 分组计算总和并返回每个分组的记录数
|
||||||
|
querySumByGroupCount();
|
||||||
|
break;
|
||||||
|
case 6:// 获取不重复的列值
|
||||||
|
queryScores();
|
||||||
|
break;
|
||||||
|
case 7:// 其他(平均值、最大、最小值)
|
||||||
|
queryOthers();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询游戏总分
|
||||||
|
*
|
||||||
|
* @method querySum
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySum() {
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.sum(new String[] { "playScore" });
|
||||||
|
query.findStatistics(GameScore.class,new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(ary!=null){//
|
||||||
|
try {
|
||||||
|
JSONObject obj = ary.getJSONObject(0);
|
||||||
|
int sum = obj.getInt("_sumPlayScore");
|
||||||
|
showToast("游戏总得分:" + sum);
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组计算总和
|
||||||
|
*
|
||||||
|
* @method queryGroupSum
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySumByGroup() {
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.sum(new String[] { "playScore" });//计算得分总和
|
||||||
|
query.groupby(new String[] { "createdAt" });//按照时间进行分组
|
||||||
|
query.order("-createdAt");// 降序排列
|
||||||
|
query.setLimit(1000);
|
||||||
|
query.findStatistics(GameScore.class,new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(ary!=null){//
|
||||||
|
int length = ary.length();
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
JSONObject obj = ary.getJSONObject(i);
|
||||||
|
int playscore = obj.getInt("_sumPlayScore");
|
||||||
|
String createDate = obj.getString("createdAt");
|
||||||
|
showToast("游戏总得分:" + playscore + ",时间:"
|
||||||
|
+ createDate);
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多个分组并计算多个总和
|
||||||
|
* @method queryGroupSum
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySumsByGroups() {
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.sum(new String[] { "playScore", "signScore" });//求多个列的总和
|
||||||
|
query.groupby(new String[] { "createdAt", "game" });//按照时间和游戏进行分组
|
||||||
|
query.order("-createdAt");//降序排列
|
||||||
|
query.setLimit(100);
|
||||||
|
query.findStatistics(GameScore.class,new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(ary!=null){
|
||||||
|
int length = ary.length();
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
JSONObject obj = ary.getJSONObject(i);
|
||||||
|
int playscore = obj.getInt("_sumPlayScore");
|
||||||
|
int signscore = obj.getInt("_sumSignScore");
|
||||||
|
String createDate = obj.getString("createdAt");
|
||||||
|
String game = obj.getString("game");
|
||||||
|
showToast("游戏总得分:" + playscore + ",签到得分:"
|
||||||
|
+ signscore + ",时间:" + createDate+",game:"+game);
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组计算总和并只返回满足条件的部分值
|
||||||
|
* @method queryGroupSum
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySumByHaving() {
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.sum(new String[] {"playScore"});//计算总得分数
|
||||||
|
query.groupby(new String[] {"game"});//分组条件:按游戏名进行分组
|
||||||
|
query.order("-createdAt");// 降序排列
|
||||||
|
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||||
|
JSONObject js = new JSONObject();
|
||||||
|
try {
|
||||||
|
js.put("$gt", 150);
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
}
|
||||||
|
map.put("_sumPlayScore", js);//过滤条件:总得分数大于150,只能过滤(sum等的查询条件)
|
||||||
|
query.having(map);
|
||||||
|
query.addWhereGreaterThan("playScore", 10);//增加where查询条件,得分数大于10的
|
||||||
|
query.setLimit(100);
|
||||||
|
query.findStatistics(GameScore.class,new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(ary!=null){
|
||||||
|
int length = ary.length();
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
JSONObject obj = ary.getJSONObject(i);
|
||||||
|
int playscore = obj.getInt("_sumPlayScore");//过滤条件的key是什么,返回的数据中就有什么
|
||||||
|
String game = obj.getString("game");
|
||||||
|
showToast("游戏得分:" + playscore + ",游戏名 = "+ game);
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组计算总和并返回每个分组的记录数
|
||||||
|
* @method queryGroupSum
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySumByGroupCount() {
|
||||||
|
// 查询创建时间按天统计所有玩家的得分和每一天有多少条玩家的得分记录,并按时间降序:
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.sum(new String[] { "playScore" });// 统计总得分
|
||||||
|
query.groupby(new String[] { "createdAt" });// 按照时间分组
|
||||||
|
query.order("-createdAt");// 降序排列
|
||||||
|
query.setHasGroupCount(true);// 统计每一天有多少玩家的得分记录,默认不返回分组个数
|
||||||
|
query.findStatistics(GameScore.class,new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if (ary!=null) {
|
||||||
|
int length = ary.length();
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
JSONObject obj = ary.getJSONObject(i);
|
||||||
|
int playscore = obj.getInt("_sumPlayScore");
|
||||||
|
String createDate = obj.getString("createdAt");
|
||||||
|
int count = obj.getInt("_count");
|
||||||
|
showToast("游戏总得分:" + playscore + ",总共统计了"
|
||||||
|
+ count + "条记录,统计时间 = "+ createDate);
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**查询所有的得分
|
||||||
|
* @method queryScore
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryScores(){
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.groupby(new String[]{"playScore"});
|
||||||
|
query.order("-createdAt");
|
||||||
|
query.findStatistics(GameScore.class, new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if (ary!=null) {
|
||||||
|
int length = ary.length();
|
||||||
|
try {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
JSONObject obj = ary.getJSONObject(i);
|
||||||
|
String score = obj.getString("playScore");
|
||||||
|
log("游戏分数:" + score);
|
||||||
|
}
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**查询其他
|
||||||
|
* @method queryOthers
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryOthers(){
|
||||||
|
BmobQuery<GameScore> query = new BmobQuery<GameScore>();
|
||||||
|
query.average(new String[]{"playScore"});//查询某列的平均值
|
||||||
|
// query.min(new String[]{"playScore"});//查询最小值
|
||||||
|
// query.max(new String[]{"playScore"});//查询最大值
|
||||||
|
query.groupby(new String[]{"createdAt"});
|
||||||
|
query.findStatistics(GameScore.class, new QueryListener<JSONArray>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(JSONArray ary, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if (ary!=null) {
|
||||||
|
try {
|
||||||
|
JSONObject obj = ary.getJSONObject(0);
|
||||||
|
double playscore = obj.getDouble("_avgPlayScore");
|
||||||
|
// int minscore = obj.getInt("_minPlayScore");
|
||||||
|
// int maxscore = obj.getInt("_maxPlayScore");
|
||||||
|
String createDate = obj.getString("createdAt");
|
||||||
|
showToast("avgscore = " + playscore+ ",统计时间 = "+ createDate);
|
||||||
|
} catch (JSONException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showToast("查询成功,无数据");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,511 @@
|
||||||
|
package cn.bmob.sdkdemo.file;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.smile.filechoose.api.ChooserType;
|
||||||
|
import com.smile.filechoose.api.ChosenFile;
|
||||||
|
import com.smile.filechoose.api.FileChooserListener;
|
||||||
|
import com.smile.filechoose.api.FileChooserManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.v3.BmobBatch;
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BatchResult;
|
||||||
|
import cn.bmob.v3.datatype.BmobFile;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.DeleteBatchListener;
|
||||||
|
import cn.bmob.v3.listener.DownloadFileListener;
|
||||||
|
import cn.bmob.v3.listener.ProgressCallback;
|
||||||
|
import cn.bmob.v3.listener.QueryListListener;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
import cn.bmob.v3.listener.UploadBatchListener;
|
||||||
|
import rx.Observable;
|
||||||
|
import rx.Subscriber;
|
||||||
|
import rx.functions.Action1;
|
||||||
|
import rx.functions.Func1;
|
||||||
|
|
||||||
|
/** 文件上传+批量更新数据
|
||||||
|
* @ClassName: BmobFileActivity
|
||||||
|
* @author smile
|
||||||
|
* @date 2014-5-22 下午7:58:58
|
||||||
|
*
|
||||||
|
* 文件上传包含以下四种形式:(单一文件上传或文件批量上传)
|
||||||
|
* 1、插入单条数据(该数据只有一个BmobFile列)
|
||||||
|
* 2、批量插入多条数据-且每条数据都存在一个BmobFile列
|
||||||
|
* 3、插入单条数据(多个BmobFile列)
|
||||||
|
* 4、批量插入多条数据-且每条数据都存在多个BmobFile列
|
||||||
|
*/
|
||||||
|
@SuppressLint("SdCardPath")
|
||||||
|
public class BmobFileActivity extends BaseActivity implements OnClickListener, FileChooserListener {
|
||||||
|
|
||||||
|
Button tv_one_one;
|
||||||
|
Button tv_one_many;
|
||||||
|
Button tv_many_one;
|
||||||
|
Button tv_many_many;
|
||||||
|
Button btn_delete;
|
||||||
|
Button btn_delete_batch;
|
||||||
|
|
||||||
|
private FileChooserManager fm;
|
||||||
|
|
||||||
|
TextView tv_path;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_file);
|
||||||
|
initViews();
|
||||||
|
initListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initViews() {
|
||||||
|
tv_one_one = (Button) findViewById(R.id.tv_one_one);
|
||||||
|
tv_one_many = (Button) findViewById(R.id.tv_one_many);
|
||||||
|
tv_many_one = (Button) findViewById(R.id.tv_many_one);
|
||||||
|
tv_many_many = (Button) findViewById(R.id.tv_many_many);
|
||||||
|
btn_delete = (Button) findViewById(R.id.btn_delete);
|
||||||
|
btn_delete_batch = (Button) findViewById(R.id.btn_delete_batch);
|
||||||
|
tv_path = (TextView)findViewById(R.id.tv_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initListeners() {
|
||||||
|
tv_one_one.setOnClickListener(this);
|
||||||
|
tv_one_many.setOnClickListener(this);
|
||||||
|
tv_many_one.setOnClickListener(this);
|
||||||
|
tv_many_many.setOnClickListener(this);
|
||||||
|
btn_delete.setOnClickListener(this);
|
||||||
|
btn_delete_batch.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pickFile() {
|
||||||
|
fm = new FileChooserManager(this);
|
||||||
|
fm.setFileChooserListener(this);
|
||||||
|
try {
|
||||||
|
fm.choose();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String arg0) {
|
||||||
|
showToast(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ChosenFile choosedFile;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFileChosen(final ChosenFile file) {
|
||||||
|
choosedFile = file;
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.i("life", choosedFile.getFilePath());
|
||||||
|
showFileDetails(file);
|
||||||
|
File mp3 = new File(choosedFile.getFilePath());
|
||||||
|
uploadMovoieFile(mp3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFileDetails(ChosenFile file) {
|
||||||
|
StringBuffer text = new StringBuffer();
|
||||||
|
text.append("File name: " + file.getFileName() + "\n");
|
||||||
|
text.append("File path: " + file.getFilePath() + "\n");
|
||||||
|
text.append("File size: " + file.getFileSize() );
|
||||||
|
tv_path.setText(text.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == ChooserType.REQUEST_PICK_FILE && resultCode == RESULT_OK) {
|
||||||
|
if (fm == null) {
|
||||||
|
fm = new FileChooserManager(this);
|
||||||
|
fm.setFileChooserListener(this);
|
||||||
|
}
|
||||||
|
Log.i(TAG, "Probable file size: " + fm.queryProbableFileSize(data.getData(), this));
|
||||||
|
fm.submit(requestCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.tv_one_one://插入单条数据(一个BmobFile列)
|
||||||
|
insertDataWithOne();
|
||||||
|
break;
|
||||||
|
case R.id.tv_one_many://插入单条数据(多个BmobFile列)
|
||||||
|
insertDataWithMany();
|
||||||
|
break;
|
||||||
|
case R.id.tv_many_one://批量插入多条数据-且每条数据都存在一个BmobFile列
|
||||||
|
insertBatchDatasWithOne();
|
||||||
|
break;
|
||||||
|
case R.id.tv_many_many://批量插入多条数据-且每条数据都存在多个BmobFile列
|
||||||
|
insertBatchDatasWithMany();
|
||||||
|
break;
|
||||||
|
case R.id.btn_delete://
|
||||||
|
deleteFile();
|
||||||
|
break;
|
||||||
|
case R.id.btn_delete_batch://批量删除
|
||||||
|
deleteBatchFile();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteFile(){
|
||||||
|
BmobFile file = new BmobFile();
|
||||||
|
file.setUrl(url);
|
||||||
|
file.delete(new UpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
showToast("文件删除成功");
|
||||||
|
}else{
|
||||||
|
showToast("文件删除失败:"+e.getErrorCode()+",msg = "+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文件
|
||||||
|
*/
|
||||||
|
private void deleteBatchFile(){
|
||||||
|
if(TextUtils.isEmpty(url)){
|
||||||
|
toast("url为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] urls =new String[]{url};
|
||||||
|
BmobFile.deleteBatch(urls, new DeleteBatchListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String[] failUrls, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("全部删除成功");
|
||||||
|
}else{
|
||||||
|
if(failUrls!=null){
|
||||||
|
toast("删除失败个数:"+failUrls.length+","+e.toString());
|
||||||
|
}else{
|
||||||
|
toast("全部文件删除失败:"+e.getErrorCode()+","+e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//======================单个BmobFile列=======================================
|
||||||
|
|
||||||
|
/** 插入单条数据(单个BmobFile列)
|
||||||
|
* 例如:插入单条电影
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void insertDataWithOne(){
|
||||||
|
if(choosedFile ==null){
|
||||||
|
showToast("请先选择文件");
|
||||||
|
pickFile();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String url="";
|
||||||
|
|
||||||
|
ProgressDialog dialog =null;
|
||||||
|
|
||||||
|
/** 上传指定路径下的电影文件
|
||||||
|
* @param file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private void uploadMovoieFile(File file) {
|
||||||
|
dialog = new ProgressDialog(this);
|
||||||
|
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||||
|
dialog.setTitle("上传中...");
|
||||||
|
dialog.setIndeterminate(false);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
dialog.show();
|
||||||
|
final BmobFile bmobFile = new BmobFile(file);
|
||||||
|
bmobFile.uploadObservable(new ProgressCallback() {//上传文件操作
|
||||||
|
@Override
|
||||||
|
public void onProgress(Integer value, long total) {
|
||||||
|
log("uploadMovoieFile-->onProgress:"+value);
|
||||||
|
dialog.setProgress(value);
|
||||||
|
}
|
||||||
|
}).doOnNext(new Action1<Void>() {
|
||||||
|
@Override
|
||||||
|
public void call(Void aVoid) {
|
||||||
|
url = bmobFile.getUrl();
|
||||||
|
log("上传成功:"+url+","+bmobFile.getFilename());
|
||||||
|
}
|
||||||
|
}).concatMap(new Func1<Void, Observable<String>>() {//将bmobFile保存到movie表中
|
||||||
|
@Override
|
||||||
|
public Observable<String> call(Void aVoid) {
|
||||||
|
return saveObservable(new Movie("冰封:重生之门",bmobFile));
|
||||||
|
}
|
||||||
|
}).concatMap(new Func1<String, Observable<String>>() {//下载文件
|
||||||
|
@Override
|
||||||
|
public Observable<String> call(String s) {
|
||||||
|
return bmobFile.downloadObservable(new ProgressCallback() {
|
||||||
|
@Override
|
||||||
|
public void onProgress(Integer value, long total) {
|
||||||
|
log("download-->onProgress:"+value+","+total);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).subscribe(new Subscriber<String>() {
|
||||||
|
@Override
|
||||||
|
public void onCompleted() {
|
||||||
|
log("--onCompleted--");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
log("--onError--:"+e.getMessage());
|
||||||
|
dialog.dismiss();
|
||||||
|
choosedFile=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
dialog.dismiss();
|
||||||
|
choosedFile=null;
|
||||||
|
log("download的文件地址:"+s);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//============================================
|
||||||
|
/**
|
||||||
|
* 注:以下的测试文件路径仅供测试所用,程序若完整运行,请自行替换成sd卡内部文件路径
|
||||||
|
*/
|
||||||
|
List<BmobObject> movies = new ArrayList<BmobObject>();
|
||||||
|
String filePath_mp3 = "/storage/emulated/0/bimagechooser/IMG_20160301_182149.jpg";
|
||||||
|
String filePath_lrc = "/storage/emulated/0/bimagechooser/IMG_20160301_182149.jpg";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此方法适用于批量更新数据且每条数据只有一个BmobFile字段
|
||||||
|
* 例如:批量上传电影Movies
|
||||||
|
* @Title: insertBatchDatasWithOne
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
public void insertBatchDatasWithOne(){
|
||||||
|
String[] filePaths = new String[2];
|
||||||
|
filePaths[0] = filePath_mp3;
|
||||||
|
filePaths[1] = filePath_lrc;
|
||||||
|
//批量上传是会依次上传文件夹里面的文件
|
||||||
|
BmobFile.uploadBatch(filePaths, new UploadBatchListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BmobFile> files, List<String> urls) {
|
||||||
|
Log.i("life","insertBatchDatasWithOne -onSuccess :"+urls.size()+"-----"+files+"----"+urls);
|
||||||
|
if(urls.size()==1){//如果第一个文件上传完成
|
||||||
|
Movie movie =new Movie("哈利波特1",files.get(0));
|
||||||
|
movies.add(movie);
|
||||||
|
}else if(urls.size()==2){//第二个文件上传成功
|
||||||
|
Movie movie1 =new Movie("哈利波特2",files.get(1));
|
||||||
|
movies.add(movie1);
|
||||||
|
insertBatch(movies);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int statuscode, String errormsg) {
|
||||||
|
showToast("错误码:"+statuscode +",错误描述:"+errormsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(int curIndex, int curPercent, int total,int totalPercent) {
|
||||||
|
log("insertBatchDatasWithOne -onProgress :"+curIndex+"---"+curPercent+"---"+total+"----"+totalPercent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* save的Observable
|
||||||
|
* @param obj
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Observable<String> saveObservable(BmobObject obj){
|
||||||
|
return obj.saveObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 创建操作
|
||||||
|
* insertObject
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void insertObject(final BmobObject obj){
|
||||||
|
obj.save(new SaveListener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String s, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
showToast("-->创建数据成功:" + s);
|
||||||
|
}else{
|
||||||
|
showToast("-->创建数据失败:" + e.getErrorCode()+",msg = "+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//======================多个BmobFile列=======================================
|
||||||
|
|
||||||
|
List<BmobObject> songs = new ArrayList<BmobObject>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入单条数据(多个BmobFile列--以两个为例)
|
||||||
|
* 例:上传MP3文件和歌词lrc文件到一条Song数据中
|
||||||
|
*/
|
||||||
|
private void insertDataWithMany() {
|
||||||
|
String[] filePaths = new String[2];
|
||||||
|
filePaths[0] = filePath_mp3;
|
||||||
|
filePaths[1] = filePath_lrc;
|
||||||
|
BmobFile.uploadBatch(filePaths, new UploadBatchListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BmobFile> files, List<String> urls) {
|
||||||
|
log("insertDataWithMany -onSuccess :"+urls.size()+"-----"+files+"----"+urls);
|
||||||
|
if(urls.size()==2){//如果全部上传完,则更新该条记录
|
||||||
|
Song song =new Song("汪峰0","北京北京0",files.get(0),files.get(1));
|
||||||
|
insertObject(song);
|
||||||
|
}else{
|
||||||
|
//有可能上传不完整,中间可能会存在未上传成功的情况,你可以自行处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onError(int statuscode, String errormsg) {
|
||||||
|
showToast("错误码"+statuscode +",错误描述:"+errormsg);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onProgress(int curIndex, int curPercent, int total,int totalPercent) {
|
||||||
|
log("insertDataWithMany -onProgress :"+curIndex+"---"+curPercent+"---"+total+"----"+totalPercent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此方法适用于批量更新数据且每条数据都有多个BmobFile字段:
|
||||||
|
* 例如:批量上传歌曲songs
|
||||||
|
* @Title: insertBatchDatasWithOne
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void insertBatchDatasWithMany() {
|
||||||
|
File ff = new File("/mnt/sdcard/testbmob/");
|
||||||
|
File[] fs = ff.listFiles();
|
||||||
|
if(fs==null || fs.length==0){
|
||||||
|
toast("请选择文件并上传");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] filePaths = new String[fs.length];
|
||||||
|
if(fs!=null && fs.length>0){
|
||||||
|
final int len = fs.length;
|
||||||
|
for(int i=0;i<len;i++){
|
||||||
|
filePaths[i] = fs[i].getAbsolutePath();
|
||||||
|
}
|
||||||
|
BmobFile.uploadBatch(filePaths, new UploadBatchListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<BmobFile> files, List<String> urls) {
|
||||||
|
log("insertBatchDatasWithMany -onSuccess :"+urls.size()+"-----"+files+"----"+urls);
|
||||||
|
if(urls.size()==len){//如果全部上传完,则批量更新
|
||||||
|
//因为我的文件夹下面有四种图片每两个插入到一条数据中
|
||||||
|
Song song =new Song("汪峰0","太阳的后裔",files.get(0),files.get(1));
|
||||||
|
songs.add(song);
|
||||||
|
Song song1 =new Song("汪峰1","北京北京1",files.get(2),files.get(3));
|
||||||
|
songs.add(song1);
|
||||||
|
//批量插入操作
|
||||||
|
insertBatch(songs);
|
||||||
|
}else{
|
||||||
|
//有可能上传不完整,中间可能会存在未上传成功的情况,你可以自行处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int statuscode, String errormsg) {
|
||||||
|
showToast("错误码"+statuscode +",错误描述:"+errormsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(int curIndex, int curPercent, int total,int totalPercent) {
|
||||||
|
log("insertBatchDatasWithMany -onProgress :"+curIndex+"---"+curPercent+"---"+total+"----"+totalPercent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 批量插入操作
|
||||||
|
* insertBatch
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
public void insertBatch(List<BmobObject> files){
|
||||||
|
new BmobBatch().insertBatch(files).doBatch(new QueryListListener<BatchResult>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<BatchResult> o, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
for(int i=0;i<o.size();i++){
|
||||||
|
BatchResult result = o.get(i);
|
||||||
|
BmobException ex =result.getError();
|
||||||
|
if(ex==null){
|
||||||
|
log("第"+i+"个数据批量添加成功:"+result.getCreatedAt()+","+result.getObjectId()+","+result.getUpdatedAt());
|
||||||
|
}else{
|
||||||
|
log("第"+i+"个数据批量添加失败:"+ex.getMessage()+","+ex.getErrorCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**新增文件下载方法
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
|
private void downloadFile(BmobFile file){
|
||||||
|
// if(file==null){
|
||||||
|
// file = new BmobFile("haha", "", "http://bmob-cdn-4.b0.upaiyun.com/png/11bf594aad96493e99a3c866eceb8184.png");
|
||||||
|
// }
|
||||||
|
File saveFile = new File(Environment.getExternalStorageDirectory(), file.getFilename());
|
||||||
|
file.download(saveFile, new DownloadFileListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
toast("开始下载...");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String s, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("下载成功,保存路径:"+s);
|
||||||
|
}else{
|
||||||
|
toast("下载失败:"+e.getErrorCode()+","+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(Integer value, long newworkSpeed) {
|
||||||
|
log("下载进度:"+value+","+newworkSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package cn.bmob.sdkdemo.file;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BmobFile;
|
||||||
|
|
||||||
|
public class Movie extends BmobObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String name;
|
||||||
|
private BmobFile file;
|
||||||
|
|
||||||
|
public Movie(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Movie(String name, BmobFile file){
|
||||||
|
this.name =name;
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BmobFile getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFile(BmobFile file) {
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package cn.bmob.sdkdemo.file;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BmobFile;
|
||||||
|
|
||||||
|
public class Song extends BmobObject {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String name;
|
||||||
|
private String artist;
|
||||||
|
|
||||||
|
private BmobFile mp3;
|
||||||
|
private BmobFile lrc;
|
||||||
|
|
||||||
|
public Song(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public Song(String name, String artist, BmobFile mp3, BmobFile lrc){
|
||||||
|
this.name =name;
|
||||||
|
this.artist =artist;
|
||||||
|
this.mp3 =mp3;
|
||||||
|
this.lrc = lrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
public String getArtist() {
|
||||||
|
return artist;
|
||||||
|
}
|
||||||
|
public void setArtist(String artist) {
|
||||||
|
this.artist = artist;
|
||||||
|
}
|
||||||
|
public BmobFile getMp3() {
|
||||||
|
return mp3;
|
||||||
|
}
|
||||||
|
public void setMp3(BmobFile mp3) {
|
||||||
|
this.mp3 = mp3;
|
||||||
|
}
|
||||||
|
public BmobFile getLrc() {
|
||||||
|
return lrc;
|
||||||
|
}
|
||||||
|
public void setLrc(BmobFile lrc) {
|
||||||
|
this.lrc = lrc;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
package cn.bmob.sdkdemo.location;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地理位置
|
||||||
|
* @class LocationActivity
|
||||||
|
* @author smile
|
||||||
|
* @date 2015-4-13 上午11:31:47
|
||||||
|
*/
|
||||||
|
public class LocationActivity extends BaseActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_location_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
queryNear();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
queryKiloMeters();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
queryBox();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**查询最接近某个坐标的用户
|
||||||
|
* @method queryNear
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryNear(){
|
||||||
|
BmobQuery<Person> query =new BmobQuery<Person>();
|
||||||
|
BmobGeoPoint location = new BmobGeoPoint(112.934755,24.52065);
|
||||||
|
query.addWhereNear("gpsAdd", location);
|
||||||
|
query.findObjects(new FindListener<Person>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("查询成功:共" + object.size() + "条数据。");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询指定距离范围内的用户
|
||||||
|
* @method queryKiloMeters
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryKiloMeters(){
|
||||||
|
BmobQuery<Person> query =new BmobQuery<Person>();
|
||||||
|
BmobGeoPoint southwestOfSF = new BmobGeoPoint(112.934755,24.52065);
|
||||||
|
//查询指定坐标指定半径内的用户
|
||||||
|
query.addWhereWithinRadians("gpsAdd", southwestOfSF, 10.0);
|
||||||
|
//查询指定坐标指定公里范围内的用户
|
||||||
|
// query.addWhereWithinKilometers("gpsAdd", southwestOfSF, 10);
|
||||||
|
//查询指定坐标指定英里范围内的用户
|
||||||
|
query.addWhereWithinMiles("gpsAdd", southwestOfSF, 10.0);
|
||||||
|
query.findObjects( new FindListener<Person>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("查询成功:共" + object.size() + "条数据。");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询矩形范围内的用户
|
||||||
|
* @method queryBox
|
||||||
|
* @params
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void queryBox(){
|
||||||
|
BmobQuery<Person> query =new BmobQuery<Person>();
|
||||||
|
BmobGeoPoint southwestOfSF = new BmobGeoPoint(112.934755,24.52065);
|
||||||
|
BmobGeoPoint northeastOfSF = new BmobGeoPoint(116.627623, 40.143687);
|
||||||
|
query.addWhereWithinGeoBox("gpsAdd", southwestOfSF, northeastOfSF);
|
||||||
|
query.findObjects(new FindListener<Person>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<Person> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("查询成功:共" + object.size() + "条数据。");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package cn.bmob.sdkdemo.permission;
|
||||||
|
|
||||||
|
/**权限监听器
|
||||||
|
* @class PermissionListener
|
||||||
|
* @author
|
||||||
|
* @date 2016-3-28-下午2:42:05
|
||||||
|
*/
|
||||||
|
public interface PermissionListener {
|
||||||
|
/**
|
||||||
|
* 用户授权后调用
|
||||||
|
*/
|
||||||
|
public void onGranted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户禁止后调用
|
||||||
|
*/
|
||||||
|
public void onDenied();
|
||||||
|
|
||||||
|
/**是否显示阐述性说明
|
||||||
|
* @param permissions 返回需要显示说明的权限数组
|
||||||
|
*/
|
||||||
|
public void onShowRationale(String[] permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
package cn.bmob.sdkdemo.permission;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限管理
|
||||||
|
* @author
|
||||||
|
* @class PermissionManager
|
||||||
|
* @date 2016-3-25 下午3:54:14
|
||||||
|
*/
|
||||||
|
public class PermissionManager {
|
||||||
|
|
||||||
|
private Object mObject;
|
||||||
|
private String[] mPermissions;
|
||||||
|
private int mRequestCode;
|
||||||
|
private PermissionListener mListener;
|
||||||
|
// 用户是否确认了解释框的
|
||||||
|
private boolean mIsPositive = false;
|
||||||
|
|
||||||
|
public static PermissionManager with(Activity activity) {
|
||||||
|
return new PermissionManager(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PermissionManager with(Fragment fragment) {
|
||||||
|
return new PermissionManager(fragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PermissionManager permissions(String... permissions) {
|
||||||
|
this.mPermissions = permissions;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PermissionManager addRequestCode(int requestCode) {
|
||||||
|
this.mRequestCode = requestCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PermissionManager setPermissionsListener(PermissionListener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PermissionManager(Object object) {
|
||||||
|
this.mObject = object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**请求权限
|
||||||
|
* @return PermissionManager
|
||||||
|
*/
|
||||||
|
public PermissionManager request() {
|
||||||
|
request(mObject, mPermissions, mRequestCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void request(Object object, String[] permissions, int requestCode) {
|
||||||
|
// 根据权限集合去查找是否已经授权过
|
||||||
|
Map<String, List<String>> map = findDeniedPermissions(getActivity(object), permissions);
|
||||||
|
List<String> deniedPermissions = map.get("deny");
|
||||||
|
List<String> rationales = map.get("rationale");
|
||||||
|
if (deniedPermissions.size() > 0) {
|
||||||
|
// 第一次点击deny才调用,mIsPositive是为了防止点确认解释框后调request()递归调onShowRationale
|
||||||
|
if (rationales.size() > 0 && mIsPositive == false) {
|
||||||
|
if (mListener != null ) {
|
||||||
|
mListener.onShowRationale(rationales.toArray(new String[rationales.size()]));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (object instanceof Activity) {
|
||||||
|
ActivityCompat.requestPermissions((Activity) object, deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode);
|
||||||
|
} else if (object instanceof Fragment) {
|
||||||
|
((Fragment) object).requestPermissions(deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(object.getClass().getName() + " is not supported");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onGranted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**根据requestCode处理响应的权限
|
||||||
|
* @param permissions
|
||||||
|
* @param results
|
||||||
|
*/
|
||||||
|
public void onPermissionResult(String[] permissions, int[] results) {
|
||||||
|
List<String> deniedPermissions = new ArrayList<String>();
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
if (results[i] != PackageManager.PERMISSION_GRANTED) {//未授权
|
||||||
|
deniedPermissions.add(permissions[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (deniedPermissions.size() > 0) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onDenied();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onGranted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, List<String>> findDeniedPermissions(Activity activity, String... permissions) {
|
||||||
|
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||||||
|
List<String> denyList = new ArrayList<String>();//未授权的权限
|
||||||
|
List<String> rationaleList = new ArrayList<String>();//需要显示提示框的权限
|
||||||
|
for (String value : permissions) {
|
||||||
|
if (ContextCompat.checkSelfPermission(activity, value) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
denyList.add(value);
|
||||||
|
if (shouldShowRequestPermissionRationale(value)) {
|
||||||
|
rationaleList.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("deny", denyList);
|
||||||
|
map.put("rationale", rationaleList);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Activity getActivity(Object object) {
|
||||||
|
if (object instanceof Fragment) {
|
||||||
|
return ((Fragment) object).getActivity();
|
||||||
|
} else if (object instanceof Activity) {
|
||||||
|
return (Activity) object;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当用户拒绝某权限时并点击就不再提醒的按钮时,下次应用再请求该权限时,需要给出合适的响应(比如给个展示对话框)
|
||||||
|
* @param permission
|
||||||
|
*/
|
||||||
|
private boolean shouldShowRequestPermissionRationale(String permission) {
|
||||||
|
if (mObject instanceof Activity) {
|
||||||
|
return ActivityCompat.shouldShowRequestPermissionRationale((Activity) mObject, permission);
|
||||||
|
} else if (mObject instanceof Fragment) {
|
||||||
|
return ((Fragment) mObject).shouldShowRequestPermissionRationale(permission);
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(mObject.getClass().getName() + " is not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsPositive(boolean isPositive) {
|
||||||
|
this.mIsPositive = isPositive;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,303 @@
|
||||||
|
package cn.bmob.sdkdemo.push;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.push.BmobPush;
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.v3.BmobInstallation;
|
||||||
|
import cn.bmob.v3.BmobPushManager;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.datatype.BmobDate;
|
||||||
|
import cn.bmob.v3.datatype.BmobGeoPoint;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
import cn.bmob.v3.listener.PushListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 由于对推送相关类的修改,请移步推送文档看具体Demo
|
||||||
|
* @see http://doc.bmob.cn/push/android/index.html
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class ActBmobPush extends BaseActivity {
|
||||||
|
|
||||||
|
BmobPushManager<BmobInstallation> bmobPush;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.act_push);
|
||||||
|
//开启debug服务后,可知晓push服务是否正常启动和运行
|
||||||
|
BmobPush.setDebugMode(true);
|
||||||
|
//开启推送服务
|
||||||
|
BmobPush.startWork(this);
|
||||||
|
//其他
|
||||||
|
bmobPush = new BmobPushManager<BmobInstallation>();
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(
|
||||||
|
R.array.bmob_push_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// BmobInstallation.getCurrentInstallation().save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**更新自定义的BmobInstallation字段
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
public void updateBmobInstallation(){
|
||||||
|
BmobQuery<MyBmobInstallation> query = new BmobQuery<MyBmobInstallation>();
|
||||||
|
//query.addWhereEqualTo("installationId", BmobInstallation.getInstallationId(this));
|
||||||
|
query.findObjects(new FindListener<MyBmobInstallation>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<MyBmobInstallation> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
if(object.size() > 0){
|
||||||
|
MyBmobInstallation mbi = object.get(0);
|
||||||
|
mbi.setUid("uid");
|
||||||
|
mbi.update(new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
Log.i("bmob", "更新成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
//BmobInstallation installation = BmobInstallation.getCurrentInstallation();
|
||||||
|
//installation.subscribe("aaa");
|
||||||
|
//installation.subscribe("bbb");
|
||||||
|
//installation.save();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
//BmobInstallation installation2 = BmobInstallation.getCurrentInstallation();
|
||||||
|
//installation2.unsubscribe("bbb");
|
||||||
|
//installation2.save();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// 给所有终端推送
|
||||||
|
pushMessage("这是给所有终端推送的一条消息");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// 给某个Android终端推送
|
||||||
|
pushAndroidMessage("这是给指定Android终端推送的一条消息", "E54053E1D3A74C86B61809AA8D1AEF46");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
// 给某个IOS终端推送
|
||||||
|
pushIOSMessage("这是给指定IOS终端推送的一条消息", "e2d4869619f61e0266561ce956e5d3cda153fef844242c6bf3f2c52d48fe98d4");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
// 给某某渠道推送
|
||||||
|
pushChannelMessage("这是给指定渠道推送的一条消息", "aaa");
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
// 给不活跃用户推送消息
|
||||||
|
pushToInactive("给不活跃用户推送的消息");
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
pushToAndroid("给Android平台推送的消息");
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
pushToIOS("给IOS平台推送的消息");
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
pushToGeoPoint("根据地理信息位置推送的消息");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给所有人推送消息
|
||||||
|
*/
|
||||||
|
private void pushMessage(String message){
|
||||||
|
// bmobPush.pushMessage(message);
|
||||||
|
bmobPush.pushMessageAll(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给指定Android用户推送消息
|
||||||
|
* @param message
|
||||||
|
* @param installId
|
||||||
|
*/
|
||||||
|
private void pushAndroidMessage(String message, String installId){
|
||||||
|
// bmobPush.pushMessage(message, installId);
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereEqualTo("installationId", installId);
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给指定IOS用户推送
|
||||||
|
* @param message
|
||||||
|
* @param deviceToken
|
||||||
|
*/
|
||||||
|
private void pushIOSMessage(String message, String deviceToken){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereEqualTo("deviceToken", deviceToken);
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给指定渠道推送消息
|
||||||
|
* @param message
|
||||||
|
* @param channel
|
||||||
|
*/
|
||||||
|
private void pushChannelMessage(String message, String channel){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
List<String> channels = new ArrayList<String>();
|
||||||
|
channels.add(channel);
|
||||||
|
query.addWhereContainedIn("channels", channels);
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给不活跃用户推送消息
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void pushToInactive(String message){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereLessThan("updatedAt", new BmobDate(new Date()));
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给android平台终端推送
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void pushToAndroid(String message){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereEqualTo("deviceType", "android");
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给ios平台终端推送
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void pushToIOS(String message){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereEqualTo("deviceType", "ios");
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据地理信息位置做推送
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
private void pushToGeoPoint(String message){
|
||||||
|
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
|
||||||
|
query.addWhereWithinRadians("location", new BmobGeoPoint(112.5186,24.5656), 1.0);
|
||||||
|
bmobPush.setQuery(query);
|
||||||
|
bmobPush.pushMessage(message, new PushListener() {
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
log("推送成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.bmob.sdkdemo.push;
|
||||||
|
|
||||||
|
import cn.bmob.v3.BmobInstallation;
|
||||||
|
|
||||||
|
public class MyBmobInstallation extends BmobInstallation {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 用户id-这样可以将设备与用户之间进行绑定
|
||||||
|
*/
|
||||||
|
private String uid;
|
||||||
|
|
||||||
|
public MyBmobInstallation() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(String uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package cn.bmob.sdkdemo.relation;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: Comment
|
||||||
|
* @Description: 评论实体
|
||||||
|
* @author smile
|
||||||
|
* @date 2014年4月17日 上午11:29:41
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Comment extends BmobObject {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论的用户
|
||||||
|
*/
|
||||||
|
private MyUser user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所评论的帖子
|
||||||
|
*/
|
||||||
|
private Post post; //一个评论只能属于一个微博
|
||||||
|
|
||||||
|
public Post getPost() {
|
||||||
|
return post;
|
||||||
|
}
|
||||||
|
public void setPost(Post post) {
|
||||||
|
this.post = post;
|
||||||
|
}
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
public MyUser getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
public void setUser(MyUser user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
package cn.bmob.sdkdemo.relation;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.datatype.BmobPointer;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
|
||||||
|
public class CommentListActivity extends BaseActivity {
|
||||||
|
|
||||||
|
ListView listView;
|
||||||
|
EditText et_content;
|
||||||
|
Button btn_publish;
|
||||||
|
|
||||||
|
static List<Comment> comments = new ArrayList<Comment>();
|
||||||
|
MyAdapter adapter;
|
||||||
|
Post weibo = new Post();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_comment);
|
||||||
|
setTitle("评论列表");
|
||||||
|
|
||||||
|
weibo.setObjectId(getIntent().getStringExtra("objectId"));
|
||||||
|
|
||||||
|
adapter = new MyAdapter(this);
|
||||||
|
et_content = (EditText) findViewById(R.id.et_content);
|
||||||
|
btn_publish = (Button) findViewById(R.id.btn_publish);
|
||||||
|
listView = (ListView) findViewById(R.id.listview);
|
||||||
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
|
btn_publish.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
publishComment(et_content.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
findComments();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findComments(){
|
||||||
|
BmobQuery<Comment> query = new BmobQuery<Comment>();
|
||||||
|
query.addWhereEqualTo("post",new BmobPointer(weibo));
|
||||||
|
query.include("user,post.author");
|
||||||
|
query.findObjects(new FindListener<Comment>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<Comment> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
comments = object;
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
et_content.setText("");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// //Weibo下面有个Relation类型的字段叫comment,存储了这条微博所有的评论信息,你可以查询到这些评论信息,因为他们都关联到了同一条微博
|
||||||
|
// String sql="select include user,* from Comment where related comment to pointer('Weibo', "+"'"+weibo.getObjectId()+"')";
|
||||||
|
// new BmobQuery<Comment>().doSQLQuery(sql, new SQLQueryListener<Comment>(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(BmobQueryResult<Comment> result, BmobException e) {
|
||||||
|
// if(e ==null){
|
||||||
|
// List<Comment> list = (List<Comment>) result.getResults();
|
||||||
|
// if(list!=null && list.size()>0){
|
||||||
|
// comments = list;
|
||||||
|
// adapter.notifyDataSetChanged();
|
||||||
|
// et_content.setText("");
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "查询成功,无数据返回");
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void publishComment(String content){
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
if(user == null){
|
||||||
|
toast("发表评论前请先登陆");
|
||||||
|
return;
|
||||||
|
}else if(TextUtils.isEmpty(content)){
|
||||||
|
toast("发表评论不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Comment comment = new Comment();
|
||||||
|
comment.setContent(content);
|
||||||
|
comment.setPost(weibo);
|
||||||
|
comment.setUser(user);
|
||||||
|
comment.save(new SaveListener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String s, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
findComments();
|
||||||
|
et_content.setText("");
|
||||||
|
toast("评论成功");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class MyAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
public MyAdapter(Context context) {
|
||||||
|
mInflater = LayoutInflater.from(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder {
|
||||||
|
TextView tv_content;
|
||||||
|
TextView tv_author;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return comments.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
final ViewHolder holder;
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = mInflater.inflate(R.layout.list_item_weibo, null);
|
||||||
|
|
||||||
|
holder = new ViewHolder();
|
||||||
|
holder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
|
||||||
|
holder.tv_author = (TextView) convertView.findViewById(R.id.tv_author);
|
||||||
|
|
||||||
|
convertView.setTag(holder);
|
||||||
|
} else {
|
||||||
|
holder = (ViewHolder) convertView.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Comment comment = comments.get(position);
|
||||||
|
|
||||||
|
if(comment.getUser() != null){
|
||||||
|
holder.tv_author.setText("评论人:"+comment.getUser().getUsername());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String str = comment.getContent();
|
||||||
|
|
||||||
|
holder.tv_content.setText(str);
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package cn.bmob.sdkdemo.relation;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobObject;
|
||||||
|
import cn.bmob.v3.datatype.BmobFile;
|
||||||
|
import cn.bmob.v3.datatype.BmobRelation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: 帖子
|
||||||
|
* @Description: 帖子实体
|
||||||
|
* @author smile
|
||||||
|
* @date 2014年4月17日 上午11:10:44
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Post extends BmobObject {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帖子标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帖子内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微博发布者
|
||||||
|
*/
|
||||||
|
private MyUser author;
|
||||||
|
/**
|
||||||
|
* 微博图片
|
||||||
|
*/
|
||||||
|
private BmobFile image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一对多关系:用于存储喜欢该帖子的所有用户
|
||||||
|
*/
|
||||||
|
private BmobRelation likes;
|
||||||
|
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
public BmobRelation getLikes() {
|
||||||
|
return likes;
|
||||||
|
}
|
||||||
|
public void setLikes(BmobRelation likes) {
|
||||||
|
this.likes = likes;
|
||||||
|
}
|
||||||
|
public BmobFile getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
public void setImage(BmobFile image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
public MyUser getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
public void setAuthor(MyUser author) {
|
||||||
|
this.author = author;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 微博的评论,一条微博是对应多条评论的,像这种一对多的情形,请使用BmobRelation类型
|
||||||
|
// */
|
||||||
|
// private BmobRelation comment;
|
||||||
|
|
||||||
|
// public BmobRelation getComment() {
|
||||||
|
// return comment;
|
||||||
|
// }
|
||||||
|
// public void setComment(BmobRelation comment) {
|
||||||
|
// this.comment = comment;
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,205 @@
|
||||||
|
package cn.bmob.sdkdemo.relation;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
|
||||||
|
|
||||||
|
public class WeiboListActivity extends BaseActivity {
|
||||||
|
|
||||||
|
ListView listView;
|
||||||
|
EditText et_content;
|
||||||
|
Button btn_publish;
|
||||||
|
|
||||||
|
static List<Post> weibos = new ArrayList<Post>();
|
||||||
|
MyAdapter adapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_weibo);
|
||||||
|
setTitle("微博列表");
|
||||||
|
|
||||||
|
adapter = new MyAdapter(this);
|
||||||
|
et_content = (EditText) findViewById(R.id.et_content);
|
||||||
|
btn_publish = (Button) findViewById(R.id.btn_publish);
|
||||||
|
listView = (ListView) findViewById(R.id.listview);
|
||||||
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
|
btn_publish.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
publishWeibo(et_content.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
findWeibos();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微博
|
||||||
|
*/
|
||||||
|
private void findWeibos(){
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
BmobQuery<Post> query = new BmobQuery<Post>();
|
||||||
|
query.addWhereEqualTo("author", user); // 查询当前用户的所有微博
|
||||||
|
query.order("-updatedAt");
|
||||||
|
query.include("author");// 希望在查询微博信息的同时也把发布人的信息查询出来,可以使用include方法
|
||||||
|
query.findObjects(new FindListener<Post>() {
|
||||||
|
@Override
|
||||||
|
public void done(List<Post> object, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
weibos = object;
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
et_content.setText("");
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//等价于下面的sql语句查询
|
||||||
|
// String sql = "select include author,* from Post where author = pointer('_User', "+"'"+user.getObjectId()+"')";
|
||||||
|
// new BmobQuery<Post>().doSQLQuery(sql, new SQLQueryListener<Post>(){
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(BmobQueryResult<Post> result, BmobException e) {
|
||||||
|
// if(e ==null){
|
||||||
|
// List<Post> list = (List<Post>) result.getResults();
|
||||||
|
// if(list!=null && list.size()>0){
|
||||||
|
// weibos = list;
|
||||||
|
// adapter.notifyDataSetChanged();
|
||||||
|
// et_content.setText("");
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "查询成功,无数据返回");
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// Log.i("smile", "错误码:"+e.getErrorCode()+",错误描述:"+e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布微博,发表微博时关联了用户类型,是一对一的体现
|
||||||
|
*/
|
||||||
|
private void publishWeibo(String content){
|
||||||
|
MyUser user = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
if(user == null){
|
||||||
|
toast("发布微博前请先登陆");
|
||||||
|
return;
|
||||||
|
}else if(TextUtils.isEmpty(content)){
|
||||||
|
toast("发布内容不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 创建微博信息
|
||||||
|
Post weibo = new Post();
|
||||||
|
weibo.setContent(content);
|
||||||
|
weibo.setAuthor(user);
|
||||||
|
weibo.save(new SaveListener<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(String s, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast("发布成功");
|
||||||
|
findWeibos();
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class MyAdapter extends BaseAdapter {
|
||||||
|
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public MyAdapter(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
mInflater = LayoutInflater.from(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder {
|
||||||
|
TextView tv_content;
|
||||||
|
TextView tv_author;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return weibos.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
final ViewHolder holder;
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = mInflater.inflate(R.layout.list_item_weibo, null);
|
||||||
|
|
||||||
|
holder = new ViewHolder();
|
||||||
|
holder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);
|
||||||
|
holder.tv_author = (TextView) convertView.findViewById(R.id.tv_author);
|
||||||
|
|
||||||
|
convertView.setTag(holder);
|
||||||
|
} else {
|
||||||
|
holder = (ViewHolder) convertView.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind the data efficiently with the holder.
|
||||||
|
final Post weibo = weibos.get(position);
|
||||||
|
MyUser user = weibo.getAuthor();
|
||||||
|
holder.tv_author.setText("发布人:"+(user==null?"":user.getUsername()));
|
||||||
|
|
||||||
|
final String str = weibo.getContent();
|
||||||
|
|
||||||
|
holder.tv_content.setText(str);
|
||||||
|
|
||||||
|
convertView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(mContext, CommentListActivity.class);
|
||||||
|
intent.putExtra("objectId", weibo.getObjectId());
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,167 @@
|
||||||
|
package cn.bmob.sdkdemo.sms;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.v3.BmobSMS;
|
||||||
|
import cn.bmob.v3.datatype.BmobSmsState;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.QueryListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信验证码
|
||||||
|
* @class SMSCodeActivity
|
||||||
|
* @author smile
|
||||||
|
* @date 2015-6-4 上午9:48:50
|
||||||
|
*/
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
|
public class SMSCodeActivity extends BaseActivity {
|
||||||
|
|
||||||
|
EditText et_number,et_code;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_code);
|
||||||
|
et_number = (EditText) findViewById(R.id.et_number);
|
||||||
|
et_code = (EditText) findViewById(R.id.et_code);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.tv_item, getResources().getStringArray(R.array.bmob_code_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
requestSmsCode();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
verifySmsCode();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
querySmsState();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
requestSms();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 自定义发送短信内容
|
||||||
|
* @method requestSmsCode
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void requestSms(){
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
if(!TextUtils.isEmpty(number)){
|
||||||
|
SimpleDateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String sendTime = format.format(new Date());
|
||||||
|
BmobSMS.requestSMS(number, "您的验证码为123456,请及时验证!",sendTime,new QueryListener<Integer>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Integer smsId, BmobException ex) {
|
||||||
|
if(ex==null){//验证码发送成功
|
||||||
|
toast("验证码发送成功,短信id:"+smsId);//用于查询本次短信发送详情
|
||||||
|
}else{
|
||||||
|
toast("errorCode = "+ex.getErrorCode()+",errorMsg = "+ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
toast("请输入手机号码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 请求短信验证码
|
||||||
|
* @method requestSmsCode
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void requestSmsCode(){
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
if(!TextUtils.isEmpty(number)){
|
||||||
|
BmobSMS.requestSMSCode(number, "注册模板",new QueryListener<Integer>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(Integer smsId, BmobException ex) {
|
||||||
|
if(ex==null){//验证码发送成功
|
||||||
|
toast("验证码发送成功,短信id:"+smsId);//用于查询本次短信发送详情
|
||||||
|
}else{
|
||||||
|
toast("errorCode = "+ex.getErrorCode()+",errorMsg = "+ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
toast("请输入手机号码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 验证短信验证码
|
||||||
|
* @method requestSmsCode
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void verifySmsCode(){
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
String code = et_code.getText().toString();
|
||||||
|
if(!TextUtils.isEmpty(number)&&!TextUtils.isEmpty(code)){
|
||||||
|
BmobSMS.verifySmsCode(number,code, new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException ex) {
|
||||||
|
if(ex==null){//短信验证码已验证成功
|
||||||
|
toast("验证通过");
|
||||||
|
}else{
|
||||||
|
toast("验证失败:code ="+ex.getErrorCode()+",msg = "+ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
toast("请输入手机号和验证码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 查询短信状态
|
||||||
|
* @method querySmsState
|
||||||
|
* @return void
|
||||||
|
* @exception
|
||||||
|
*/
|
||||||
|
private void querySmsState(){
|
||||||
|
BmobSMS.querySmsState(39086233, new QueryListener<BmobSmsState>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobSmsState state, BmobException ex) {
|
||||||
|
if(ex==null){
|
||||||
|
toast("短信状态:"+state.getSmsState()+",验证状态:"+state.getVerifyState());
|
||||||
|
}else{
|
||||||
|
toast("errorCode = "+ex.getErrorCode()+",errorMsg = "+ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,523 @@
|
||||||
|
package cn.bmob.sdkdemo.user;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.bmob.sdkdemo.BaseActivity;
|
||||||
|
import cn.bmob.sdkdemo.R;
|
||||||
|
import cn.bmob.sdkdemo.bean.BankCard;
|
||||||
|
import cn.bmob.sdkdemo.bean.MyUser;
|
||||||
|
import cn.bmob.sdkdemo.bean.Person;
|
||||||
|
import cn.bmob.v3.BmobQuery;
|
||||||
|
import cn.bmob.v3.BmobUser;
|
||||||
|
import cn.bmob.v3.exception.BmobException;
|
||||||
|
import cn.bmob.v3.listener.FetchUserInfoListener;
|
||||||
|
import cn.bmob.v3.listener.FindListener;
|
||||||
|
import cn.bmob.v3.listener.LogInListener;
|
||||||
|
import cn.bmob.v3.listener.SaveListener;
|
||||||
|
import cn.bmob.v3.listener.UpdateListener;
|
||||||
|
import rx.Subscriber;
|
||||||
|
|
||||||
|
public class UserActivity extends BaseActivity {
|
||||||
|
|
||||||
|
EditText et_number, et_code;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_code);
|
||||||
|
et_number = (EditText) findViewById(R.id.et_number);
|
||||||
|
et_code = (EditText) findViewById(R.id.et_code);
|
||||||
|
|
||||||
|
mListview = (ListView) findViewById(R.id.listview);
|
||||||
|
mAdapter = new ArrayAdapter<String>(this, R.layout.list_item,
|
||||||
|
R.id.tv_item, getResources().getStringArray(R.array.bmob_user_list));
|
||||||
|
mListview.setAdapter(mAdapter);
|
||||||
|
mListview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view,
|
||||||
|
int position, long id) {
|
||||||
|
testBmob(position + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBmob(int pos) {
|
||||||
|
switch (pos) {
|
||||||
|
case 1:
|
||||||
|
testSignUp();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
testLogin();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
testGetCurrentUser();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
fetchUserInfo();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
testLogOut();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
updateUser();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
checkPassword();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
testResetPasswrod();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
emailVerify();
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
testFindBmobUser();
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
loginByEmailPwd();
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
loginByPhonePwd();
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
loginByPhoneCode();
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
signOrLogin();
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
resetPasswordBySMS();
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
updateCurrentUserPwd();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("UseValueOf")
|
||||||
|
private void testSignUp() {
|
||||||
|
final MyUser myUser = new MyUser();
|
||||||
|
myUser.setUsername("0704");
|
||||||
|
myUser.setPassword("123456");
|
||||||
|
myUser.setAge(18);
|
||||||
|
addSubscription(myUser.signUp(new SaveListener<MyUser>() {
|
||||||
|
@Override
|
||||||
|
public void done(MyUser s, BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("注册成功:" + s.toString());
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注意下如果返回206错误 一般是多设备登录导致
|
||||||
|
*/
|
||||||
|
private void testLogin() {
|
||||||
|
final BmobUser user = new BmobUser();
|
||||||
|
user.setUsername("0704");
|
||||||
|
user.setPassword("123456");
|
||||||
|
//login回调
|
||||||
|
/*user.login(new SaveListener<BmobUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobUser bmobUser, BmobException e) {
|
||||||
|
if(e==null){
|
||||||
|
toast(user.getUsername() + "登陆成功");
|
||||||
|
testGetCurrentUser();
|
||||||
|
}else{
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
//v3.5.0开始新增加的rx风格的Api
|
||||||
|
user.loginObservable(BmobUser.class).subscribe(new Subscriber<BmobUser>() {
|
||||||
|
@Override
|
||||||
|
public void onCompleted() {
|
||||||
|
log("----onCompleted----");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
loge(new BmobException(e));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(BmobUser bmobUser) {
|
||||||
|
toast(bmobUser.getUsername() + "登陆成功");
|
||||||
|
testGetCurrentUser();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取本地用户
|
||||||
|
*/
|
||||||
|
private void testGetCurrentUser() {
|
||||||
|
// MyUser myUser = BmobUser.getCurrentUser(this, MyUser.class);
|
||||||
|
// if (myUser != null) {
|
||||||
|
// log("本地用户信息:objectId = " + myUser.getObjectId() + ",name = " + myUser.getUsername()
|
||||||
|
// + ",age = "+ myUser.getAge());
|
||||||
|
// } else {
|
||||||
|
// toast("本地用户为null,请登录。");
|
||||||
|
// }
|
||||||
|
//V3.4.5版本新增加getObjectByKey方法获取本地用户对象中某一列的值
|
||||||
|
String username = (String) BmobUser.getObjectByKey("username");
|
||||||
|
Integer age = (Integer) BmobUser.getObjectByKey("age");
|
||||||
|
Boolean sex = (Boolean) BmobUser.getObjectByKey("sex");
|
||||||
|
JSONArray hobby = (JSONArray) BmobUser.getObjectByKey("hobby");
|
||||||
|
JSONArray cards = (JSONArray) BmobUser.getObjectByKey("cards");
|
||||||
|
JSONObject banker = (JSONObject) BmobUser.getObjectByKey("banker");
|
||||||
|
JSONObject mainCard = (JSONObject) BmobUser.getObjectByKey("mainCard");
|
||||||
|
log("username:" + username + ",\nage:" + age + ",\nsex:" + sex);
|
||||||
|
log("hobby:" + (hobby != null ? hobby.toString() : "为null") + "\ncards:" + (cards != null ? cards.toString() : "为null"));
|
||||||
|
log("banker:" + (banker != null ? banker.toString() : "为null") + "\nmainCard:" + (mainCard != null ? mainCard.toString() : "为null"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除本地用户
|
||||||
|
*/
|
||||||
|
private void testLogOut() {
|
||||||
|
BmobUser.logOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户操作并同步更新本地的用户信息
|
||||||
|
*/
|
||||||
|
private void updateUser() {
|
||||||
|
final MyUser bmobUser = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
if (bmobUser != null) {
|
||||||
|
final MyUser newUser = new MyUser();
|
||||||
|
//-----------------------普通setter操作-------------------------------
|
||||||
|
//number类型
|
||||||
|
newUser.setAge(25);
|
||||||
|
newUser.setSex(false);
|
||||||
|
//object类型
|
||||||
|
// newUser.setMainCard(new BankCard("工行", "10086"));
|
||||||
|
//BmobObject类型
|
||||||
|
Person person = new Person();
|
||||||
|
person.setObjectId("721fe0cdf2");
|
||||||
|
newUser.setBanker(person);
|
||||||
|
//---------------------数组操作(add、addAll、addUnique、addAllUnique)---------------------------------------
|
||||||
|
//添加Object类型的数组,Object数组调用addAllUnique、addUnique方法后本地用户信息未支持去重
|
||||||
|
List<BankCard> cards = new ArrayList<BankCard>();
|
||||||
|
cards.add(new BankCard("建行", "111"));
|
||||||
|
newUser.addAll("cards", cards);
|
||||||
|
// 添加String类型的数组--String数组支持去重
|
||||||
|
newUser.addAllUnique("hobby", Arrays.asList("游泳"));
|
||||||
|
//----------------------自增操作---------------------------------------
|
||||||
|
// newUser.increment("num",-2);
|
||||||
|
// //----------------------setValue方式更新用户信息(必须先保证更新的列存在,否则会报internal error)----------------------------
|
||||||
|
// //更新number
|
||||||
|
// newUser.setValue("age",25);
|
||||||
|
// //更新整个Object
|
||||||
|
// newUser.setValue("banker",person);
|
||||||
|
// //更新String数组
|
||||||
|
// newUser.setValue("hobby",Arrays.asList("看书","游泳"));
|
||||||
|
//// //更新某个Object的值
|
||||||
|
// newUser.setValue("mainCard.cardNumber","10011");
|
||||||
|
// //更新数组中某个Object
|
||||||
|
// newUser.setValue("cards.0", new BankCard("工行", "10086"));
|
||||||
|
//更新数组中某个Object的某个字段的值
|
||||||
|
// newUser.setValue("cards.0.bankName", "中行");
|
||||||
|
addSubscription(newUser.update(bmobUser.getObjectId(), new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
testGetCurrentUser();
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
toast("本地用户为null,请登录。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证旧密码是否正确
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private void checkPassword() {
|
||||||
|
BmobQuery<MyUser> query = new BmobQuery<MyUser>();
|
||||||
|
final MyUser bmobUser = BmobUser.getCurrentUser(MyUser.class);
|
||||||
|
// 如果你传的密码是正确的,那么arg0.size()的大小是1,这个就代表你输入的旧密码是正确的,否则是失败的
|
||||||
|
query.addWhereEqualTo("password", "123456");
|
||||||
|
query.addWhereEqualTo("username", bmobUser.getUsername());
|
||||||
|
addSubscription(query.findObjects(new FindListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<MyUser> object, BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("查询密码成功:" + object.size());
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*/
|
||||||
|
private void testResetPasswrod() {
|
||||||
|
final String email = "123456789@qq.com";
|
||||||
|
addSubscription(BmobUser.resetPasswordByEmail(email, new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("重置密码请求成功,请到" + email + "邮箱进行密码重置操作");
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户
|
||||||
|
*/
|
||||||
|
private void testFindBmobUser() {
|
||||||
|
BmobQuery<MyUser> query = new BmobQuery<MyUser>();
|
||||||
|
query.addWhereEqualTo("username", "lucky");
|
||||||
|
addSubscription(query.findObjects(new FindListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(List<MyUser> object, BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("查询用户成功:" + object.size());
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证邮件
|
||||||
|
*/
|
||||||
|
private void emailVerify() {
|
||||||
|
final String email = "75727433@qq.com";
|
||||||
|
addSubscription(BmobUser.requestEmailVerify(email, new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("请求验证邮件成功,请到" + email + "邮箱中进行激活账户。");
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loginByEmailPwd() {
|
||||||
|
addSubscription(BmobUser.loginByAccount("123456@163.com", "123456", new LogInListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(MyUser user, BmobException e) {
|
||||||
|
if (user != null) {
|
||||||
|
log(user.getUsername() + "-" + user.getAge() + "-" + user.getObjectId() + "-" + user.getEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loginByPhonePwd() {
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
addSubscription(BmobUser.loginByAccount(number, "123456", new LogInListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(MyUser user, BmobException e) {
|
||||||
|
if (user != null) {
|
||||||
|
toast("登录成功");
|
||||||
|
log(user.getUsername() + "-" + user.getAge() + "-" + user.getObjectId() + "-" + user.getEmail());
|
||||||
|
} else {
|
||||||
|
toast("错误码:" + e.getErrorCode() + ",错误原因:" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loginByPhoneCode() {
|
||||||
|
//1、调用请求验证码接口
|
||||||
|
// BmobSMS.requestSMSCode("手机号码", "模板名称",new QueryListener<Integer>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(Integer smsId,BmobException ex) {
|
||||||
|
// if(ex==null){//验证码发送成功
|
||||||
|
// log("短信id:"+smsId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
String code = et_code.getText().toString();
|
||||||
|
//2、使用验证码进行登陆
|
||||||
|
addSubscription(BmobUser.loginBySMSCode(number, code, new LogInListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(MyUser user, BmobException e) {
|
||||||
|
if (user != null) {
|
||||||
|
toast("登录成功");
|
||||||
|
log("" + user.getUsername() + "-" + user.getAge() + "-" + user.getObjectId() + "-" + user.getEmail());
|
||||||
|
} else {
|
||||||
|
toast("错误码:" + e.getErrorCode() + ",错误原因:" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一键注册登录
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
* @method signOrLogin
|
||||||
|
*/
|
||||||
|
private void signOrLogin() {
|
||||||
|
//1、调用请求验证码接口
|
||||||
|
// BmobSMS.requestSMSCode("18312662735", "模板名称",new QueryListener<Integer>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(Integer smsId,BmobException ex) {
|
||||||
|
// if(ex==null){//验证码发送成功
|
||||||
|
// log("smile", "短信id:"+smsId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
String number = et_number.getText().toString();
|
||||||
|
String code = et_code.getText().toString();
|
||||||
|
//2、使用手机号和短信验证码进行一键注册登录,这步有两种方式可以选择
|
||||||
|
// //第一种:
|
||||||
|
// BmobUser.signOrLoginByMobilePhone(number, code,new LogInListener<MyUser>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(MyUser user, BmobException e) {
|
||||||
|
// if(user!=null){
|
||||||
|
// toast("登录成功");
|
||||||
|
// log(""+user.getUsername()+"-"+user.getAge()+"-"+user.getObjectId()+"-"+user.getEmail());
|
||||||
|
// }else{
|
||||||
|
// toast("错误码:"+e.getErrorCode()+",错误原因:"+e.getLocalizedMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//第二种:这种方式比较灵活,可以在注册或登录的同时设置保存多个字段值
|
||||||
|
final MyUser user = new MyUser();
|
||||||
|
user.setPassword("123456");
|
||||||
|
user.setMobilePhoneNumber("15018879340");
|
||||||
|
addSubscription(user.signOrLogin(code, new SaveListener<MyUser>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(MyUser myUser, BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("登录成功");
|
||||||
|
log("" + myUser.getAge() + "-" + myUser.getObjectId() + "-" + myUser.getEmail());
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过短信验证码来重置用户密码
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* 注:整体流程是先调用请求验证码的接口获取短信验证码,随后调用短信验证码重置密码接口来重置该手机号对应的用户的密码
|
||||||
|
* @method requestSmsCode
|
||||||
|
*/
|
||||||
|
private void resetPasswordBySMS() {
|
||||||
|
//1、请求短信验证码
|
||||||
|
// BmobSMS.requestSMSCode("手机号码", "模板名称",new QueryListener<Integer>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void done(Integer smsId,BmobException ex) {
|
||||||
|
// if(ex==null){//验证码发送成功
|
||||||
|
// log("短信id:"+smsId);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
String code = et_code.getText().toString();
|
||||||
|
//2、重置的是绑定了该手机号的账户的密码
|
||||||
|
addSubscription(BmobUser.resetPasswordBySMSCode(code, "1234567", new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("密码重置成功");
|
||||||
|
} else {
|
||||||
|
toast("错误码:" + e.getErrorCode() + ",错误原因:" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改当前用户密码
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws
|
||||||
|
*/
|
||||||
|
private void updateCurrentUserPwd() {
|
||||||
|
addSubscription(BmobUser.updateCurrentUserPassword("旧密码", "新密码", new UpdateListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void done(BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
toast("密码修改成功,可以用新密码进行登录");
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新本地用户信息
|
||||||
|
* 适用场景:登录后若web端的用户信息有更新 可以通过该方法拉取最新的用户信息并写到本地缓存(SharedPreferences)中<p>
|
||||||
|
*/
|
||||||
|
private void fetchUserInfo() {
|
||||||
|
BmobUser.fetchUserInfo(new FetchUserInfoListener<MyUser>() {
|
||||||
|
@Override
|
||||||
|
public void done(MyUser user, BmobException e) {
|
||||||
|
if (e == null) {
|
||||||
|
log(user.toString());
|
||||||
|
} else {
|
||||||
|
loge(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true"><shape>
|
||||||
|
<stroke android:width="1px" android:color="@color/border" />
|
||||||
|
|
||||||
|
<solid android:color="@color/button_press" />
|
||||||
|
</shape></item>
|
||||||
|
<item android:state_enabled="false"><shape>
|
||||||
|
<stroke android:width="1px" android:color="@color/border" />
|
||||||
|
|
||||||
|
<solid android:color="@color/button_disable" />
|
||||||
|
</shape></item>
|
||||||
|
<item><shape>
|
||||||
|
<stroke android:width="1px" android:color="@color/border" />
|
||||||
|
|
||||||
|
<solid android:color="@color/button" />
|
||||||
|
</shape></item>
|
||||||
|
<!--
|
||||||
|
<item android:state_pressed="false"><shape>
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
|
||||||
|
<stroke android:width="1px" android:color="@color/border" />
|
||||||
|
|
||||||
|
<solid android:color="@color/button" />
|
||||||
|
</shape></item>
|
||||||
|
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
|
||||||
|
<stroke android:width="1px" android:color="@color/border" />
|
||||||
|
|
||||||
|
<solid android:color="@color/button" />
|
||||||
|
</shape>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</selector>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:state_pressed="true"><shape>
|
||||||
|
<solid android:color="@color/button_press" />
|
||||||
|
</shape></item>
|
||||||
|
<item><shape>
|
||||||
|
<solid android:color="@color/button" />
|
||||||
|
</shape></item>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context=".BmobFileActivity" >
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_number"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="请输入手机号码"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_below="@id/et_number"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="请输入验证码"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_below="@id/et_code"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<EditText
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:id="@+id/et_content"/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/comment"
|
||||||
|
android:id="@+id/btn_publish"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="10dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_path"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FF0000"
|
||||||
|
android:textSize="18sp"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/tv_one_one"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_1" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/tv_one_many"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_2" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/tv_many_one"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_3" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/tv_many_many"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_4" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_delete"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_5"
|
||||||
|
></Button>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_delete_batch"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_file_6"
|
||||||
|
></Button>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="10dp" >
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_local_id" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_ratio"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="@string/string_local_width" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_width"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="@string/string_local_height" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_height"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp" />
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="@string/string_local_quality" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_quality"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp" />
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_thumbnail"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_local_set" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_thumbnail1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_local_set1" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_thumbnail2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/string_local_set2" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context=".BmobFileActivity" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
tools:context=".NewBmobFileActivity" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
></ListView>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:cacheColorHint="#00000000"
|
||||||
|
android:listSelector="@drawable/selector_list_item" >
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<EditText
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:id="@+id/et_content"
|
||||||
|
android:hint="@string/share"/>
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/publish"
|
||||||
|
android:id="@+id/btn_publish"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/tv_item"
|
||||||
|
android:minHeight="56dp"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
</TextView>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/tv_item"
|
||||||
|
android:minHeight="56dp"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
</TextView>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/tv_content"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/tv_author"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,6 @@
|
||||||
|
<resources>
|
||||||
|
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||||
|
(such as screen margins) for screens with more than 820dp of available width. This
|
||||||
|
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||||
|
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||||
|
</resources>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="colorPrimary">#3F51B5</color>
|
||||||
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
|
<color name="colorAccent">#FF4081</color>
|
||||||
|
<color name="transparent">#00000000</color>
|
||||||
|
<color name="border_bkg">#FFFFFF</color>
|
||||||
|
<color name="border">#000000</color>
|
||||||
|
<color name="text">#000000</color>
|
||||||
|
<color name="main_bkg">#E3DBCF</color>
|
||||||
|
<color name="button">#FFFFFF</color>
|
||||||
|
<color name="button_disable">#9C8E8E</color>
|
||||||
|
<color name="button_press">#F1F1F1</color>
|
||||||
|
<color name="button_text">#000000</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<resources>
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
</resources>
|
|
@ -0,0 +1,152 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">BmobExample</string>
|
||||||
|
<string name="action_settings">Settings</string>
|
||||||
|
<string name="hello_world">Hello world!</string>
|
||||||
|
<string name="title_changelog">Bmob更新日志</string>
|
||||||
|
<string name="close">关闭</string>
|
||||||
|
|
||||||
|
<string-array name="bmob_list">
|
||||||
|
<item>1. 用户管理</item>
|
||||||
|
<item>2. 数据增删改查 </item>
|
||||||
|
<item>3. 数据关联</item>
|
||||||
|
<item>4. 批量操作</item>
|
||||||
|
<item>5. ACL和角色</item>
|
||||||
|
<item>6. 文件管理</item>
|
||||||
|
<item>7. 云端代码</item>
|
||||||
|
<item>8. 数据实时同步</item>
|
||||||
|
<item>9. 客户端间的推送</item>
|
||||||
|
<item>10. 应用自动更新</item>
|
||||||
|
<item>11. 地理位置</item>
|
||||||
|
<item>12. 获取服务器时间</item>
|
||||||
|
<item>13. 统计查询</item>
|
||||||
|
<item>14. SQL语句查询</item>
|
||||||
|
<item>15. 短信服务</item>
|
||||||
|
<item>16. 表结构</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_crud_list">
|
||||||
|
<item>1. 创建数据</item>
|
||||||
|
<item>2. 更新数据</item>
|
||||||
|
<item>3. 删除数据</item>
|
||||||
|
<item>4. 查询数据</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_acl_list">
|
||||||
|
<item>1.添加ACL</item>
|
||||||
|
<item>2.创建角色</item>
|
||||||
|
<item>3.更新角色</item>
|
||||||
|
<item>4.删除角色</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_user_list">
|
||||||
|
<item>1. 注册用户</item>
|
||||||
|
<item>2. 登陆用户</item>
|
||||||
|
<item>3. 获取本地用户</item>
|
||||||
|
<item>4. 更新本地用户信息</item>
|
||||||
|
<item>5. 退出登陆</item>
|
||||||
|
<item>6. 更新用户</item>
|
||||||
|
<item>7. 重置密码</item>
|
||||||
|
<item>8. 验证旧密码</item>
|
||||||
|
<item>9. 验证邮件</item>
|
||||||
|
<item>10. 查询用户</item>
|
||||||
|
<item>11.通过邮箱和密码登陆</item>
|
||||||
|
<item>12.通过手机号码和密码登陆</item>
|
||||||
|
<item>13.通过手机号码和短信验证码登陆</item>
|
||||||
|
<item>14.手机号码一键注册登录</item>
|
||||||
|
<item>15.通过手机验证码重置密码</item>
|
||||||
|
<item>16.修改当前用户密码</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_findtest_list">
|
||||||
|
<item>1. 查询单个对象</item>
|
||||||
|
<item>2. 查询多个对象</item>
|
||||||
|
<item>3. count对象个数</item>
|
||||||
|
<item>4. 复合与查询</item>
|
||||||
|
<item>5. 复合或查询</item>
|
||||||
|
<item>6. 数组查询</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="batch_action_list">
|
||||||
|
<item>1. 批量添加</item>
|
||||||
|
<item>2. 批量更新</item>
|
||||||
|
<item>3. 批量删除</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_location_list">
|
||||||
|
<item>1. 查询最接近某个坐标的数据</item>
|
||||||
|
<item>2. 查询指定距离范围内的数据</item>
|
||||||
|
<item>3. 查询指定矩形范围内的数据</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_statistic_list">
|
||||||
|
<item>1. 计算总和</item>
|
||||||
|
<item>2. 分组计算总和</item>
|
||||||
|
<item>3. 多个分组并计算多个列的总和</item>
|
||||||
|
<item>4. 分组计算总和并只返回满足条件的部分值</item>
|
||||||
|
<item>5. 分组计算总和并返回每个分组的记录数</item>
|
||||||
|
<item>6. 获取不重复的列值</item>
|
||||||
|
<item>7. 其他(平均值、最大值、最小值)</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_sql_list">
|
||||||
|
<item>1. 基本sql查询</item>
|
||||||
|
<item>2. 查询个数sql</item>
|
||||||
|
<item>3. 统计查询sql</item>
|
||||||
|
<item>4. 占位符查询</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string name="publish">发布</string>
|
||||||
|
<string name="share">随时随地分享…</string>
|
||||||
|
<string name="comment">评论</string>
|
||||||
|
|
||||||
|
<string-array name="bmob_push_list">
|
||||||
|
<item>1. 订阅渠道</item>
|
||||||
|
<item>2. 取消订阅</item>
|
||||||
|
<item>3. 给所有人推送</item>
|
||||||
|
<item>4. 给指定Android用户推送</item>
|
||||||
|
<item>5. 给指定IOS用户推送</item>
|
||||||
|
<item>6. 给指定渠道用户推送</item>
|
||||||
|
<item>7. 给不活跃用户推送消息</item>
|
||||||
|
<item>8. 给Android平台推送</item>
|
||||||
|
<item>9. 给IOS平台推送</item>
|
||||||
|
<item>10. 根据地理位置信息推送</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string name="string_pick">选择文件(用于单条数据,一个BmobFile列)</string>
|
||||||
|
|
||||||
|
<string name="string_file_1">1、单条数据,一个BmobFile列</string>
|
||||||
|
<string name="string_file_2">2、单条数据,多个BmobFile列</string>
|
||||||
|
<string name="string_file_3">3、多条数据,每条数据一个BmobFile列</string>
|
||||||
|
<string name="string_file_4">4、多条数据,每条数据多个BmobFile列</string>
|
||||||
|
<string name="string_file_5">5、删除文件</string>
|
||||||
|
<string name="string_file_6">6、批量删除文件</string>
|
||||||
|
|
||||||
|
<string-array name="bmob_newfile_arrays">
|
||||||
|
<item>1. 单一上传</item>
|
||||||
|
<item>2. 批量上传</item>
|
||||||
|
<item>3. 下载文件</item>
|
||||||
|
<item>4. 清除缓存</item>
|
||||||
|
<item>5. 获取当前缓存大小</item>
|
||||||
|
<item>6. 文件下载本地路径</item>
|
||||||
|
<item>7. 请求服务器生成缩略图任务</item>
|
||||||
|
<item>8. 本地生成缩略图</item>
|
||||||
|
<item>9. 获取文件的可访问地址</item>
|
||||||
|
<item>10. 删除文件</item>
|
||||||
|
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="bmob_code_list">
|
||||||
|
<item>1. 请求短信验证码</item>
|
||||||
|
<item>2. 验证短信验证码是否有效</item>
|
||||||
|
<item>3. 查询短信验证码状态</item>
|
||||||
|
<item>4. 自定义发送短信内容</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string name="string_local_id">规格ID:</string>
|
||||||
|
<string name="string_local_width">宽度:</string>
|
||||||
|
<string name="string_local_height">高度:</string>
|
||||||
|
<string name="string_local_quality">压缩质量:</string>
|
||||||
|
<string name="string_local_set">指定规格ID</string>
|
||||||
|
<string name="string_local_set1">指定规格ID、宽、高</string>
|
||||||
|
<string name="string_local_set2">指定规格ID、宽、高、压缩质量</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cn.bmob.sdkdemo;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To work on unit tests, switch the Test Artifact in the Build Variants view.
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() throws Exception {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
//Bmob的maven仓库地址,必须填写
|
||||||
|
maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
BIN
src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
src/MyApplication/libs/BmobSDKDemo_v3.6.0/BmobDemo/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Mon Dec 28 10:00:20 PST 2015
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
|
@ -0,0 +1,160 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -0,0 +1 @@
|
||||||
|
include ':app'
|