diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..29f81d81
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/animation/src/main/java/com/example/animation/widget/PieAnimation.java b/animation/src/main/java/com/example/animation/widget/PieAnimation.java
index 2c12020b..d09897bf 100644
--- a/animation/src/main/java/com/example/animation/widget/PieAnimation.java
+++ b/animation/src/main/java/com/example/animation/widget/PieAnimation.java
@@ -31,7 +31,7 @@ public PieAnimation(Context context, AttributeSet attrs) {
mPaint = new Paint(); // 创建一个新的画笔
mPaint.setAntiAlias(true); //设置画笔为无锯齿
mPaint.setColor(Color.GREEN); // 设置画笔的颜色
- mPaint.setStyle(Style.FILL); // 设置画笔的类型。STROK表示空心,FILL表示实心
+ mPaint.setStyle(Style.FILL); // 设置画笔的类型。STROKE表示空心,FILL表示实心
}
// 开始播放动画
diff --git a/build.gradle b/build.gradle
index 483940d8..fb0514fc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven { url 'https://maven.aliyun.com/repository/public'}
google() // Android Studio 3.0开始需要添加这行
- jcenter()
+ mavenCentral()
}
dependencies {
// 下面的版本号就是Android Studio的版本号
@@ -25,7 +25,7 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven { url 'https://maven.aliyun.com/repository/public'}
google() // Android Studio 3.0开始需要添加这行
- jcenter()
+ mavenCentral()
}
}
diff --git a/custom/src/main/AndroidManifest.xml b/custom/src/main/AndroidManifest.xml
index 18ccde8a..9588668e 100644
--- a/custom/src/main/AndroidManifest.xml
+++ b/custom/src/main/AndroidManifest.xml
@@ -11,6 +11,8 @@
+
+ getAppInfo(Context ctx, int type) {
PackageManager pm = ctx.getPackageManager();
// 获取系统中已经安装的应用列表
List installList = pm.getInstalledApplications(
- PackageManager.PERMISSION_GRANTED);
+ PackageManager.MATCH_UNINSTALLED_PACKAGES);
for (int i = 0; i < installList.size(); i++) { ApplicationInfo item = installList.get(i); // 去掉重复的应用信息 @@ -68,7 +68,7 @@ public static ArrayList fillAppInfo(Context ctx, ArrayList ori
ArrayList fullArray = (ArrayList) originArray.clone();
PackageManager pm = ctx.getPackageManager();
// 获取系统中已经安装的应用列表
- List installList = pm.getInstalledApplications(PackageManager.PERMISSION_GRANTED);
+ List installList = pm.getInstalledApplications(PackageManager.MATCH_UNINSTALLED_PACKAGES);
for (int i = 0; i < fullArray.size(); i++) { AppInfo app = fullArray.get(i); for (ApplicationInfo item : installList) { diff --git a/device/src/main/java/com/example/device/FindShakeActivity.java b/device/src/main/java/com/example/device/FindShakeActivity.java index 4e0bd176..6d1b3303 100644 --- a/device/src/main/java/com/example/device/FindShakeActivity.java +++ b/device/src/main/java/com/example/device/FindShakeActivity.java @@ -108,7 +108,7 @@ public void run() { } }; - // 计算中奖等级 + // 计算博饼结果 private String calculatePrize() { int four_count = checkCount(4); if (four_count == 6) { // 出现六个红四 diff --git a/device/src/main/java/com/example/device/widget/VideoPlayer.java b/device/src/main/java/com/example/device/widget/VideoPlayer.java index 7141be92..e561b404 100644 --- a/device/src/main/java/com/example/device/widget/VideoPlayer.java +++ b/device/src/main/java/com/example/device/widget/VideoPlayer.java @@ -98,6 +98,7 @@ public void onCompletion(MediaPlayer mp) { if (mTimer != null) { mTimer.cancel(); // 取消计时器 } + mMediaPlayer.release(); // 释放媒体播放器资源 } @Override diff --git a/device/src/main/java/com/example/device/widget/VideoRecorder.java b/device/src/main/java/com/example/device/widget/VideoRecorder.java index 4c81eb29..33af141d 100644 --- a/device/src/main/java/com/example/device/widget/VideoRecorder.java +++ b/device/src/main/java/com/example/device/widget/VideoRecorder.java @@ -8,6 +8,7 @@ import android.content.Context; import android.hardware.Camera; +import android.media.CamcorderProfile; import android.media.MediaRecorder; import android.media.MediaRecorder.AudioEncoder; import android.media.MediaRecorder.AudioSource; @@ -154,16 +155,18 @@ private void initRecord() { mMediaRecorder.setPreviewDisplay(mHolder.getSurface()); // 设置媒体录制器的预览界面 mMediaRecorder.setVideoSource(VideoSource.CAMERA); // 设置视频源为摄像头 mMediaRecorder.setAudioSource(AudioSource.MIC); // 设置音频源为麦克风 - mMediaRecorder.setOutputFormat(OutputFormat.MPEG_4); // 设置媒体的输出格式 - mMediaRecorder.setAudioEncoder(AudioEncoder.AMR_NB); // 设置媒体的音频编码器 - // 如果录像报错:MediaRecorder start failed: -19 - // 试试把setVideoSize和setVideoFrameRate注释掉,因为尺寸设置必须为摄像头所支持,否则报错 - // mMediaRecorder.setVideoSize(mWidth, mHeight); // 设置视频的分辨率 - // mMediaRecorder.setVideoFrameRate(16); // 设置视频每秒录制的帧数 - // setVideoFrameRate与setVideoEncodingBitRate设置其一即可 - mMediaRecorder.setVideoEncodingBitRate(1 * 1024 * 512); // 设置视频每秒录制的字节数 + // setProfile囊括了setOutputFormat、setVideoEncoder、setAudioEncoder、setVideoSize、setVideoEncodingBitRate等参数设置 + mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_720P)); +// mMediaRecorder.setOutputFormat(OutputFormat.MPEG_4); // 设置媒体的输出格式 +// mMediaRecorder.setAudioEncoder(AudioEncoder.AMR_NB); // 设置媒体的音频编码器 +// // 如果录像报错:MediaRecorder start failed: -19 +// // 试试把setVideoSize和setVideoFrameRate注释掉,因为尺寸设置必须为摄像头所支持,否则报错 +// // mMediaRecorder.setVideoSize(mWidth, mHeight); // 设置视频的分辨率 +// // mMediaRecorder.setVideoFrameRate(16); // 设置视频每秒录制的帧数 +// // setVideoFrameRate与setVideoEncodingBitRate设置其一即可 +// mMediaRecorder.setVideoEncodingBitRate(1 * 1024 * 512); // 设置视频每秒录制的字节数 +// mMediaRecorder.setVideoEncoder(VideoEncoder.MPEG_4_SP); // 设置媒体的视频编码器 mMediaRecorder.setOrientationHint(90); // 输出旋转90度,也就是保持竖屏录制 - mMediaRecorder.setVideoEncoder(VideoEncoder.MPEG_4_SP); // 设置媒体的视频编码器 mMediaRecorder.setMaxDuration(mRecordMaxTime * 1000); // 设置媒体的最大录制时长 // mMediaRecorder.setMaxFileSize(1024*1024*10); // 设置媒体的最大文件大小 // setMaxFileSize与setMaxDuration设置其一即可 diff --git a/event/src/main/java/com/example/event/TouchMultipleActivity.java b/event/src/main/java/com/example/event/TouchMultipleActivity.java index 434f9656..ce3b28fe 100644 --- a/event/src/main/java/com/example/event/TouchMultipleActivity.java +++ b/event/src/main/java/com/example/event/TouchMultipleActivity.java @@ -43,7 +43,7 @@ public boolean onTouchEvent(MotionEvent event) { if (isMinorPressed) { desc_minor = String.format("%s次要动作名称是:移动", desc_minor); } - } else if (action == MotionEvent.ACTION_UP) { // 手指松开 + } else if (action == MotionEvent.ACTION_UP) { // 手指提起 desc_major = String.format("%s提起", desc_major); } else if (action == MotionEvent.ACTION_CANCEL) { // 取消手势 desc_major = String.format("%s取消", desc_major); diff --git a/event/src/main/java/com/example/event/TouchSingleActivity.java b/event/src/main/java/com/example/event/TouchSingleActivity.java index cb44f885..14a99e94 100644 --- a/event/src/main/java/com/example/event/TouchSingleActivity.java +++ b/event/src/main/java/com/example/event/TouchSingleActivity.java @@ -36,7 +36,7 @@ public boolean onTouchEvent(MotionEvent event) { desc = String.format("%s按下", desc); } else if (action == MotionEvent.ACTION_MOVE) { // 手指移动 desc = String.format("%s移动", desc); - } else if (action == MotionEvent.ACTION_UP) { // 手指松开 + } else if (action == MotionEvent.ACTION_UP) { // 手指提起 desc = String.format("%s提起", desc); } else if (action == MotionEvent.ACTION_CANCEL) { // 取消手势 desc = String.format("%s取消", desc); diff --git a/event/src/main/java/com/example/event/widget/CropImageView.java b/event/src/main/java/com/example/event/widget/CropImageView.java index b53ba36a..dfc72d17 100644 --- a/event/src/main/java/com/example/event/widget/CropImageView.java +++ b/event/src/main/java/com/example/event/widget/CropImageView.java @@ -100,7 +100,7 @@ public boolean onTouchEvent(MotionEvent event) { } setBitmapRect(rect); // 设置位图的矩形边界 break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 break; default: break; diff --git a/event/src/main/java/com/example/event/widget/CustomScrollView.java b/event/src/main/java/com/example/event/widget/CustomScrollView.java index 7d5a31a9..a614fa33 100644 --- a/event/src/main/java/com/example/event/widget/CustomScrollView.java +++ b/event/src/main/java/com/example/event/widget/CustomScrollView.java @@ -32,7 +32,7 @@ public boolean onInterceptTouchEvent(MotionEvent event) { mLastPosY = event.getY(); result = super.onInterceptTouchEvent(event); break; - default: // 其余动作,包括手指移动、手指松开等等 + default: // 其余动作,包括手指移动、手指提起等等 float thisPosX = event.getX(); float thisPosY = event.getY(); mOffsetX += Math.abs(thisPosX - mLastPosX); // x轴偏差 diff --git a/event/src/main/java/com/example/event/widget/MeituView.java b/event/src/main/java/com/example/event/widget/MeituView.java index 0b6592c1..40dffe61 100644 --- a/event/src/main/java/com/example/event/widget/MeituView.java +++ b/event/src/main/java/com/example/event/widget/MeituView.java @@ -171,7 +171,7 @@ public boolean onTouchEvent(MotionEvent event) { setBitmapRect(rect); // 设置位图的矩形边界 } break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 // 判断点击和长按 if (mListener != null && Math.abs(event.getX() - mOriginX) < mInterval && Math.abs(event.getY() - mOriginY) < mInterval) { diff --git a/event/src/main/java/com/example/event/widget/PanoramaView.java b/event/src/main/java/com/example/event/widget/PanoramaView.java index 97aa01ce..3f1b9a67 100644 --- a/event/src/main/java/com/example/event/widget/PanoramaView.java +++ b/event/src/main/java/com/example/event/widget/PanoramaView.java @@ -109,7 +109,7 @@ public boolean onTouchEvent(MotionEvent event) { mRender.yAngle += dx * 0.3f; mRender.xAngle += dy * 0.3f; break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 // 手势松开,则重新注册陀螺仪传感器 mSensorMgr.registerListener(this, mGyroscopeSensor, SensorManager.SENSOR_DELAY_FASTEST); diff --git a/event/src/main/java/com/example/event/widget/PullDownRefreshLayout.java b/event/src/main/java/com/example/event/widget/PullDownRefreshLayout.java index 9627e03b..2c161e29 100644 --- a/event/src/main/java/com/example/event/widget/PullDownRefreshLayout.java +++ b/event/src/main/java/com/example/event/widget/PullDownRefreshLayout.java @@ -114,7 +114,7 @@ public boolean onTouch(View view, MotionEvent event) { mLinearLayout.setPadding(0, dragOffset, 0, 0); // 立刻刷新线性布局 mLinearLayout.invalidate(); - } else if (action == MotionEvent.ACTION_UP) { // 手指松开 + } else if (action == MotionEvent.ACTION_UP) { // 手指提起 // 下拉距离太短,则直接将页面恢复原状。只有下拉距离足够长,才会触发页面刷新动作 if (offsetY <= Utils.dip2px(mContext, 150)) { resumePage(); diff --git a/event/src/main/java/com/example/event/widget/PullDownScrollView.java b/event/src/main/java/com/example/event/widget/PullDownScrollView.java index e2b26a69..5601240e 100644 --- a/event/src/main/java/com/example/event/widget/PullDownScrollView.java +++ b/event/src/main/java/com/example/event/widget/PullDownScrollView.java @@ -35,7 +35,7 @@ public boolean onInterceptTouchEvent(MotionEvent event) { mLastPosY = event.getY(); result = super.onInterceptTouchEvent(event); break; - default: // 其余动作,包括手指移动、手指松开等等 + default: // 其余动作,包括手指移动、手指提起等等 float thisPosX = event.getX(); float thisPosY = event.getY(); mOffsetX += Math.abs(thisPosX - mLastPosX); // x轴偏差 diff --git a/event/src/main/java/com/example/event/widget/SignatureView.java b/event/src/main/java/com/example/event/widget/SignatureView.java index 438da726..4403ac16 100644 --- a/event/src/main/java/com/example/event/widget/SignatureView.java +++ b/event/src/main/java/com/example/event/widget/SignatureView.java @@ -134,7 +134,7 @@ public boolean onTouchEvent(MotionEvent event) { mPos.firstX = event.getX(); mPos.firstY = event.getY(); break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 // 在画布上绘制指定路径线条 mCanvas.drawPath(mPath, mPaint); mPath.reset(); diff --git a/junior/src/main/java/com/example/junior/CalculatorActivity.java b/junior/src/main/java/com/example/junior/CalculatorActivity.java index d98ff873..3ba1ab2e 100644 --- a/junior/src/main/java/com/example/junior/CalculatorActivity.java +++ b/junior/src/main/java/com/example/junior/CalculatorActivity.java @@ -170,12 +170,12 @@ private boolean caculate() { } else if (operator.equals("×ばつ")) { // 当前是相乘运算 result = String.valueOf(Arith.mul(firstNum, nextNum)); } else if (operator.equals("÷")) { // 当前是相除运算 - if (Double.parseDouble(nextNum) == 0) { // 发现被除数是0 - // 被除数为0,要弹窗提示用户 - Toast.makeText(this, "被除数不能为零", Toast.LENGTH_SHORT).show(); + if (Double.parseDouble(nextNum) == 0) { // 发现除数是0 + // 除数为0,要弹窗提示用户 + Toast.makeText(this, "除数不能为零", Toast.LENGTH_SHORT).show(); // 返回false表示运算失败 return false; - } else { // 被除数非0,则进行正常的除法运算 + } else { // 除数非0,则进行正常的除法运算 result = String.valueOf(Arith.div(firstNum, nextNum)); } } diff --git a/media/src/main/java/com/example/media/service/StockService.java b/media/src/main/java/com/example/media/service/StockService.java index deb72790..4d2e8ac6 100644 --- a/media/src/main/java/com/example/media/service/StockService.java +++ b/media/src/main/java/com/example/media/service/StockService.java @@ -87,6 +87,7 @@ public void run() { } else if (mType == SHENZHEN) { // 深圳成指 req_data.url = "https://hq.sinajs.cn/list=s_sz399001"; } + req_data.referer = "https://finance.sina.com.cn"; // 发送HTTP请求信息,并获得HTTP应答对象 HttpRespData resp_data = HttpRequestUtil.getData(req_data); // 返回串形如 var hq_str_s_sh000001="上证指数,3019.9873,-5.6932,-0.19,1348069,14969598"; diff --git a/media/src/main/java/com/example/media/widget/FloatWindow.java b/media/src/main/java/com/example/media/widget/FloatWindow.java index ab90b9be..d3548302 100644 --- a/media/src/main/java/com/example/media/widget/FloatWindow.java +++ b/media/src/main/java/com/example/media/widget/FloatWindow.java @@ -50,7 +50,7 @@ public boolean onTouch(View v, MotionEvent event) { case MotionEvent.ACTION_MOVE: // 手指移动 updateViewPosition(); // 更新视图的位置 break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 updateViewPosition(); // 更新视图的位置 // 响应悬浮窗的点击事件 if (Math.abs(mScreenX - mDownX) < 3 diff --git a/media/src/main/java/com/example/media/widget/MovieView.java b/media/src/main/java/com/example/media/widget/MovieView.java index 17e270dd..de6b4242 100644 --- a/media/src/main/java/com/example/media/widget/MovieView.java +++ b/media/src/main/java/com/example/media/widget/MovieView.java @@ -77,7 +77,7 @@ public boolean onTouch(View v, MotionEvent event) { mXpos = (int) event.getX(); mYpos = (int) event.getY(); break; - case MotionEvent.ACTION_UP: // 手指松开 + case MotionEvent.ACTION_UP: // 手指提起 // 松开手指,则弹出或关闭相关的控件(如顶部的标题栏和底部的控制条) if (Math.abs(event.getX() - mXpos) < mOffset && Math.abs(event.getY() - mYpos) < mOffset) { diff --git a/middle/src/main/java/com/example/middle/MortgageActivity.java b/middle/src/main/java/com/example/middle/MortgageActivity.java index 0257ef54..f28f96af 100644 --- a/middle/src/main/java/com/example/middle/MortgageActivity.java +++ b/middle/src/main/java/com/example/middle/MortgageActivity.java @@ -106,6 +106,13 @@ private void initRatioSpinner() { } private String[] ratioDescArray = { + "2025年5月8日 五年期商贷利率 3.60% 公积金利率 2.60%", + "2024年10月21日 五年期商贷利率 3.60% 公积金利率 2.85%", + "2024年07月22日 五年期商贷利率 3.85% 公积金利率 2.85%", + "2024年05月18日 五年期商贷利率 3.95% 公积金利率 2.85%", + "2024年02月20日 五年期商贷利率 3.95% 公积金利率 3.10%", + "2023年06月20日 五年期商贷利率 4.20% 公积金利率 3.10%", + "2022年10月01日 五年期商贷利率 4.65% 公积金利率 3.10%", "2015年10月24日 五年期商贷利率 4.90% 公积金利率 3.25%", "2015年08月26日 五年期商贷利率 5.15% 公积金利率 3.25%", "2015年06月28日 五年期商贷利率 5.40% 公积金利率 3.50%", @@ -114,8 +121,8 @@ private void initRatioSpinner() { "2014年11月22日 五年期商贷利率 6.15% 公积金利率 4.25%", "2012年07月06日 五年期商贷利率 6.55% 公积金利率 4.50%", }; - private double[] businessArray = {4.90, 5.15, 5.40, 5.65, 5.90, 6.15, 6.55}; - private double[] accumulationArray = {3.25, 3.25, 3.50, 3.75, 4.00, 4.25, 4.50}; + private double[] businessArray = {3.60, 3.60, 3.85, 3.95, 3.95, 4.20, 4.65, 4.90, 5.15, 5.40, 5.65, 5.90, 6.15, 6.55}; + private double[] accumulationArray = {2.60, 2.85, 2.85, 2.85, 3.10, 3.10, 3.10, 3.25, 3.25, 3.50, 3.75, 4.00, 4.25, 4.50}; // 定义一个基准利率的选择监听器 class RatioSelectedListener implements OnItemSelectedListener { diff --git a/mixture/src/main/java/com/example/mixture/WifiShareActivity.java b/mixture/src/main/java/com/example/mixture/WifiShareActivity.java index 13fce641..f7e23c6e 100644 --- a/mixture/src/main/java/com/example/mixture/WifiShareActivity.java +++ b/mixture/src/main/java/com/example/mixture/WifiShareActivity.java @@ -67,7 +67,11 @@ protected void onCreate(Bundle savedInstanceState) { ll_client_title = findViewById(R.id.ll_client_title); lv_wifi_client = findViewById(R.id.lv_wifi_client); findViewById(R.id.btn_wifi_save).setOnClickListener(this); - et_wifi_name.setText(Build.SERIAL); + if (Build.VERSION.SDK_INT>= Build.VERSION_CODES.P) {
+ et_wifi_name.setText(Build.getSerial());
+ } else {
+ et_wifi_name.setText(Build.SERIAL);
+ }
et_wifi_password.setText("");
ck_wifi_switch.setOnCheckedChangeListener(this);
// 从系统服务中获取无线网络管理器
diff --git a/mixture/src/main/java/com/example/mixture/fragment/HtmlFragment.java b/mixture/src/main/java/com/example/mixture/fragment/HtmlFragment.java
index 528c9b3b..7e7826af 100644
--- a/mixture/src/main/java/com/example/mixture/fragment/HtmlFragment.java
+++ b/mixture/src/main/java/com/example/mixture/fragment/HtmlFragment.java
@@ -34,6 +34,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mView = inflater.inflate(R.layout.fragment_html, container, false);
// 从布局文件中获取名叫wv_content的网页视图
WebView wv_content = mView.findViewById(R.id.wv_content);
+ // 设置是否允许访问文件,如WebView访问存储卡的文件。
+ // 不过assets与res文件不受此限制,仍然可以通过"file:///android_asset"和"file:///android_res"访问
+ // Android11开始该值默认为false,故Android11必须设置为true才能访问存储卡的网页
+ wv_content.getSettings().setAllowFileAccess(true);
// 命令网页视图加载指定路径的网页
wv_content.loadUrl("file:///" + htmlPath);
return mView;
diff --git a/mixture/src/main/java/com/example/mixture/util/NetUtil.java b/mixture/src/main/java/com/example/mixture/util/NetUtil.java
index ee9f377d..1af10067 100644
--- a/mixture/src/main/java/com/example/mixture/util/NetUtil.java
+++ b/mixture/src/main/java/com/example/mixture/util/NetUtil.java
@@ -10,7 +10,7 @@
public class NetUtil {
private final static String TAG = "NetUtil";
- public static String[] mClassArray = {"UNKNOWN", "2G", "3G", "4G"};
+ public static String[] mClassArray = {"UNKNOWN", "2G", "3G", "4G", "5G"};
public static int TYPE_UNKNOWN = 0;
public static int TYPE_2G = 1;
diff --git a/mixture/src/main/java/com/example/mixture/widget/BookView.java b/mixture/src/main/java/com/example/mixture/widget/BookView.java
index a432d5ed..06e10fc5 100644
--- a/mixture/src/main/java/com/example/mixture/widget/BookView.java
+++ b/mixture/src/main/java/com/example/mixture/widget/BookView.java
@@ -67,7 +67,7 @@ public interface OnScrollListener {
private int mDistanceGap = 20; // 每次滚动的间距大小
private Handler mHandler = new Handler(); // 声明一个处理器对象
- // 定义一个滚动任务,用于在手指松开时自动判断继续往左滚还是往右滚
+ // 定义一个滚动任务,用于在手指提起时自动判断继续往左滚还是往右滚
private class ScrollRunnable implements Runnable {
private int mDirection; // 滚动方向
private int mDistance; // 剩余距离
diff --git a/mixture/src/main/java/com/example/mixture/widget/ViewSlider.java b/mixture/src/main/java/com/example/mixture/widget/ViewSlider.java
index dbb3b7d1..cace4f09 100644
--- a/mixture/src/main/java/com/example/mixture/widget/ViewSlider.java
+++ b/mixture/src/main/java/com/example/mixture/widget/ViewSlider.java
@@ -115,7 +115,7 @@ public boolean onTouchEvent(MotionEvent event) {
}
}
break;
- case MotionEvent.ACTION_UP: // 手指松开
+ case MotionEvent.ACTION_UP: // 手指提起
if (mShowPage == SHOW_PRE) { // 原来在拉出上一页
// 根据已拉出的距离计算接下来要往哪个方向滚动
int direction = Math.abs(distanceX) < mWidth / 2 ? BookView.DIRECTION_LEFT : BookView.DIRECTION_RIGHT; diff --git a/network/src/main/java/com/example/network/ChatMainActivity.java b/network/src/main/java/com/example/network/ChatMainActivity.java index 60f78d17..701106b5 100644 --- a/network/src/main/java/com/example/network/ChatMainActivity.java +++ b/network/src/main/java/com/example/network/ChatMainActivity.java @@ -9,6 +9,7 @@ import com.example.network.task.UploadHttpTask.OnUploadHttpListener; import com.example.network.thread.ClientThread; import com.example.network.util.DateUtil; +import com.example.network.util.PermissionUtil; import com.example.network.util.Utils; import com.example.network.widget.TextProgressCircle; @@ -121,7 +122,7 @@ public void onClick(View v) { MainApplication.getInstance().getNickName(), DateUtil.formatTime(DateUtil.getNowDateTime("")), body); // 在聊天窗口中添加文本消息 - appendMsg(Build.SERIAL, append); + appendMsg(PermissionUtil.getSerial(), append); // 往后端服务器发送文本消息的请求 MainApplication.getInstance().sendAction(ClientThread.SENDMSG, mOtherId, body); et_input.setText(""); @@ -131,9 +132,9 @@ public void onClick(View v) { // 在聊天窗口中添加文本消息 private static void appendMsg(String deviceId, String append) { // 我方消息靠右对齐,对方消息靠左对齐 - int gravity = deviceId.equals(Build.SERIAL) ? Gravity.RIGHT : Gravity.LEFT; + int gravity = deviceId.equals(PermissionUtil.getSerial()) ? Gravity.RIGHT : Gravity.LEFT; // 我方消息背景色为蓝色,对方消息背景色为红色 - int bg_color = deviceId.equals(Build.SERIAL) ? 0xffccccff : 0xffffcccc; + int bg_color = deviceId.equals(PermissionUtil.getSerial()) ? 0xffccccff : 0xffffcccc; // 以下初始化单条聊天消息的线性布局 LinearLayout ll_append = new LinearLayout(mContext); LinearLayout.LayoutParams ll_params = new LinearLayout.LayoutParams( @@ -216,12 +217,12 @@ public void onUploadFinish(String result) { DateUtil.formatTime(DateUtil.getNowDateTime(""))); if (mType == TYPE_PHOTO) { // 图片消息 // 在聊天窗口中添加多媒体消息 - showMedia(ClientThread.RECVPHOTO, Build.SERIAL, title, mFilePath); + showMedia(ClientThread.RECVPHOTO, PermissionUtil.getSerial(), title, mFilePath); // 向后端服务器发送图片消息的请求 MainApplication.getInstance().sendAction(ClientThread.SENDPHOTO, mOtherId, downloadUrl); } else if (mType == TYPE_SOUND) { // 音频消息 // 在聊天窗口中添加多媒体消息 - showMedia(ClientThread.RECVSOUND, Build.SERIAL, title, mFilePath); + showMedia(ClientThread.RECVSOUND, PermissionUtil.getSerial(), title, mFilePath); // 向后端服务器发送音频消息的请求 MainApplication.getInstance().sendAction(ClientThread.SENDSOUND, mOtherId, downloadUrl); } @@ -276,10 +277,10 @@ private static void showMedia(String action, String deviceId, String title, Stri Log.d(TAG, "showMedia action="/index.cgi/contrast/https://github.com/bitecheng/android2/compare/ + action + ", url=" + url); boolean isLocalPath = (!url.contains("http://") && !url.contains("https://")); // 我方消息靠右对齐,对方消息靠左对齐 - int gravity = deviceId.equals(Build.SERIAL) ? Gravity.RIGHT : Gravity.LEFT; + int gravity = deviceId.equals(PermissionUtil.getSerial()) ? Gravity.RIGHT : Gravity.LEFT; gravity = gravity | Gravity.CENTER_VERTICAL; // 并且垂直居中 // 我方消息背景色为蓝色,对方消息背景色为红色 - int bg_color = deviceId.equals(Build.SERIAL) ? 0xffccccff : 0xffffcccc; + int bg_color = deviceId.equals(PermissionUtil.getSerial()) ? 0xffccccff : 0xffffcccc; int type = TYPE_PHOTO; // 以下初始化单条聊天消息的线性布局 LinearLayout ll_append = new LinearLayout(mContext); diff --git a/network/src/main/java/com/example/network/MainApplication.java b/network/src/main/java/com/example/network/MainApplication.java index 6c03e157..b9c43fb3 100644 --- a/network/src/main/java/com/example/network/MainApplication.java +++ b/network/src/main/java/com/example/network/MainApplication.java @@ -2,6 +2,7 @@ import com.example.network.thread.ClientThread; import com.example.network.util.DateUtil; +import com.example.network.util.PermissionUtil; import android.app.Application; import android.os.Build; @@ -37,7 +38,7 @@ public void onCreate() { public void sendAction(String action, String otherId, String msgText) { // 拼接完整的聊天消息 String content = String.format("%s,%s,%s,%s,%s%s%s\r\n", - action, Build.SERIAL, getNickName(), DateUtil.getNowDateTime(""), + action, PermissionUtil.getSerial(), getNickName(), DateUtil.getNowDateTime(""), otherId, ClientThread.SPLIT_LINE, msgText); Log.d(TAG, "sendAction : " + content); // 获得一个默认的消息对象 diff --git a/network/src/main/java/com/example/network/task/CheckUpdateTask.java b/network/src/main/java/com/example/network/task/CheckUpdateTask.java index 8f585d04..2f817561 100644 --- a/network/src/main/java/com/example/network/task/CheckUpdateTask.java +++ b/network/src/main/java/com/example/network/task/CheckUpdateTask.java @@ -35,7 +35,7 @@ protected String doInBackground(String... params) { // e.printStackTrace(); // } // HttpRespData resp_data = new HttpRespData(); -// resp_data.content = "{\"package_list\":[{\"new_version\":\"8.12.5\",\"download_url\":\"http://www.lenovomm.com/appdown/21661264-2\",\"package_name\":\"com.qiyi.video\"},{\"new_version\":\"8.9.2\",\"download_url\":\"http://www.lenovomm.com/appdown/21589548-2\",\"package_name\":\"com.kugou.android\"},{\"new_version\":\"7.0.5.0\",\"download_url\":\"http://www.lenovomm.com/appdown/21665086-2\",\"package_name\":\"com.mt.mtxx.mtxx\"},{\"new_version\":\"6.6.1\",\"download_url\":\"http://www.lenovomm.com/appdown/21665350-2\",\"package_name\":\"com.tencent.mm\"},{\"new_version\":\"7.4.0\",\"download_url\":\"http://www.lenovomm.com/appdown/21672339-2\",\"package_name\":\"com.taobao.taobao\"},{\"new_version\":\"7.3.2\",\"download_url\":\"http://www.lenovomm.com/appdown/21639509-2\",\"package_name\":\"com.tencent.mobileqq\"}]}"; +// resp_data.content = "{\"package_list\":[{\"new_version\":\"13.7.5\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/F1E6E8850F6F80BD071AE8E319C51759.apk\",\"package_name\":\"com.qiyi.video\"},{\"new_version\":\"11.2.6\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/52C4F042C7AC91FE1D97EE8699E0191C.apk\",\"package_name\":\"com.kugou.android\"},{\"new_version\":\"9.6.2.0\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/FAE5E860689E67BAEE7038261614B64E.apk\",\"package_name\":\"com.mt.mtxx.mtxx\"},{\"new_version\":\"8.0.25\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/5F93793C6C5F539487B11418A5D4C902.apk\",\"package_name\":\"com.tencent.mm\"},{\"new_version\":\"10.15.0\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/99CA4F060773B985797B9EFA0DA0A632.apk\",\"package_name\":\"com.taobao.taobao\"},{\"new_version\":\"8.9.3\",\"download_url\":\"https://imtt.dd.qq.com/sjy.10001/sjy.00004/16891/apk/995F74DF2D12C2325158455865E4CC4C.apk\",\"package_name\":\"com.tencent.mobileqq\"}]}"; Log.d(TAG, "err_msg=" + resp_data.err_msg + ", result=" + resp_data.content); return resp_data.content; // 返回HTTP调用的应答内容 } diff --git a/network/src/main/java/com/example/network/task/GetAddressTask.java b/network/src/main/java/com/example/network/task/GetAddressTask.java index d74e0db6..2b3fbb70 100644 --- a/network/src/main/java/com/example/network/task/GetAddressTask.java +++ b/network/src/main/java/com/example/network/task/GetAddressTask.java @@ -1,5 +1,7 @@ package com.example.network.task; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.text.MessageFormat; import org.json.JSONArray; @@ -19,7 +21,7 @@ public class GetAddressTask extends AsyncTask {
private final static String TAG = "GetAddressTask";
// 谷歌地图从2019年开始必须传入密钥才能根据经纬度获取地址,所以把查询接口改成了国内的天地图
//private String mAddressUrl = "http://maps.google.cn/maps/api/geocode/json?latlng={0},{1}&sensor=true&language=zh-CN";
- private String mAddressUrl = "https://api.tianditu.gov.cn/geocoder?postStr={'lon':%f,'lat':%f,'ver':1}&type=geocode&tk=145897399844a50e3de2309513c8df4b";
+ private String mQueryUrl = "https://api.tianditu.gov.cn/geocoder?postStr=%s&type=geocode&tk=253b3bd69713d4bdfdc116255f379841";
public GetAddressTask() {
super();
@@ -29,8 +31,13 @@ public GetAddressTask() {
protected String doInBackground(Location... params) {
Location location = params[0];
// 把经度和纬度代入到URL地址
- //String url = MessageFormat.format(mAddressUrl, location.getLatitude(), location.getLongitude());
- String url = String.format(mAddressUrl, location.getLongitude(), location.getLatitude());
+ String param = String.format("{'lon':%f,'lat':%f,'ver':1}", location.getLongitude(), location.getLatitude());
+ try {
+ param = URLEncoder.encode(param, "utf8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ String url = String.format(mQueryUrl, param);
// 创建一个HTTP请求对象
HttpReqData req_data = new HttpReqData(url);
// 发送HTTP请求信息,并获得HTTP应答对象
diff --git a/network/src/main/java/com/example/network/util/PermissionUtil.java b/network/src/main/java/com/example/network/util/PermissionUtil.java
index ce267779..b6576dfd 100644
--- a/network/src/main/java/com/example/network/util/PermissionUtil.java
+++ b/network/src/main/java/com/example/network/util/PermissionUtil.java
@@ -7,6 +7,7 @@
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
+import android.text.TextUtils;
import android.util.Log;
/**
@@ -58,4 +59,17 @@ public static void goActivity(Context ctx, Class> cls) {
ctx.startActivity(intent);
}
+ public static String getSerial() {
+ String serial = "";
+ if (Build.VERSION.SDK_INT>= Build.VERSION_CODES.P) {
+ serial = Build.getSerial();
+ } else {
+ serial = Build.SERIAL;
+ }
+ if (TextUtils.isEmpty(serial) || serial.toLowerCase().startsWith("unknown")) {
+ serial = String.format("%s_%s_%d", Build.BRAND, Build.HARDWARE, Build.TIME);
+ }
+ return serial;
+ }
+
}
diff --git a/network/src/main/java/com/example/network/util/Utils.java b/network/src/main/java/com/example/network/util/Utils.java
index 017a4e1d..b8465948 100644
--- a/network/src/main/java/com/example/network/util/Utils.java
+++ b/network/src/main/java/com/example/network/util/Utils.java
@@ -14,7 +14,7 @@ public static String getDotOne(double src) {
return df.format(src);
}
- public static String[] mClassNameArray = {"UNKNOWN", "2G", "3G", "4G"};
+ public static String[] mClassNameArray = {"UNKNOWN", "2G", "3G", "4G", "5G"};
// public static int TYPE_UNKNOWN = 0;
// public static int TYPE_2G = 1;
diff --git a/senior/src/main/AndroidManifest.xml b/senior/src/main/AndroidManifest.xml
index 166bc69c..1854af9c 100644
--- a/senior/src/main/AndroidManifest.xml
+++ b/senior/src/main/AndroidManifest.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/storage/src/main/AndroidManifest.xml b/storage/src/main/AndroidManifest.xml
index cf528745..f358808d 100644
--- a/storage/src/main/AndroidManifest.xml
+++ b/storage/src/main/AndroidManifest.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/thirdsdk/src/main/AndroidManifest.xml b/thirdsdk/src/main/AndroidManifest.xml
index 2495ed96..3665aadb 100644
--- a/thirdsdk/src/main/AndroidManifest.xml
+++ b/thirdsdk/src/main/AndroidManifest.xml
@@ -28,7 +28,15 @@
-
+
+
+