From 2d2fd8bd9b205aa2c2d1a0124addb99721df65b0 Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 22 May 2019 16:33:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=AF=86=E5=88=AB=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 7 +- app/debug/output.json | 1 - app/src/main/AndroidManifest.xml | 2 +- .../example/open_nsfw_android/MainActivity.kt | 105 ++++++++++++-- .../example/open_nsfw_android/MainAdapter.kt | 10 +- app/src/main/res/layout/activity_main.xml | 54 +++---- app/src/main/res/values/colors.xml | 3 +- app/src/main/res/values/strings.xml | 1 + nsfw/src/main/AndroidManifest.xml | 2 - .../main/java/com/zwy/nsfw/Classifier.java | 132 ++++++++---------- .../zwy/nsfw/ClassifierFloatMobileNet.java | 53 ------- .../debug/annotationProcessors.json | 1 - .../compile_library_classes/debug/classes.jar | Bin 307445 -> 0 bytes .../debug/generateDebugRFile/R.jar | Bin 1506 -> 0 bytes .../debug-mergeJniLibs/merge-state | Bin 580 -> 0 bytes .../mergeDebugJniLibFolders/merger.xml | 2 - .../incremental/mergeDebugShaders/merger.xml | 2 - .../incremental/packageDebugAssets/merger.xml | 2 - .../compile-file-map.properties | 1 - .../merged.dir/values/values.xml | 11 -- .../packageDebugResources/merger.xml | 16 --- .../classes/org/opencv/BuildConfig.class | Bin 678 -> 0 bytes .../opencv/android/AsyncServiceHelper$1.class | Bin 2262 -> 0 bytes .../opencv/android/AsyncServiceHelper$2.class | Bin 1934 -> 0 bytes .../android/AsyncServiceHelper$3$1.class | Bin 2825 -> 0 bytes .../android/AsyncServiceHelper$3$2.class | Bin 2781 -> 0 bytes .../opencv/android/AsyncServiceHelper$3.class | Bin 4640 -> 0 bytes .../opencv/android/AsyncServiceHelper.class | Bin 5354 -> 0 bytes .../opencv/android/BaseLoaderCallback$1.class | Bin 917 -> 0 bytes .../opencv/android/BaseLoaderCallback$2.class | Bin 917 -> 0 bytes .../opencv/android/BaseLoaderCallback$3.class | Bin 917 -> 0 bytes .../opencv/android/BaseLoaderCallback$4.class | Bin 1143 -> 0 bytes .../opencv/android/BaseLoaderCallback$5.class | Bin 1142 -> 0 bytes .../opencv/android/BaseLoaderCallback$6.class | Bin 1148 -> 0 bytes .../opencv/android/BaseLoaderCallback$7.class | Bin 1142 -> 0 bytes .../opencv/android/BaseLoaderCallback.class | Bin 3800 -> 0 bytes .../opencv/android/Camera2Renderer$1.class | Bin 1488 -> 0 bytes .../opencv/android/Camera2Renderer$2.class | Bin 2901 -> 0 bytes .../org/opencv/android/Camera2Renderer.class | Bin 11068 -> 0 bytes .../android/CameraBridgeViewBase$1.class | Bin 1038 -> 0 bytes ...meraBridgeViewBase$CvCameraViewFrame.class | Bin 310 -> 0 bytes ...aBridgeViewBase$CvCameraViewListener.class | Bin 405 -> 0 bytes ...BridgeViewBase$CvCameraViewListener2.class | Bin 536 -> 0 bytes ...ViewBase$CvCameraViewListenerAdapter.class | Bin 2253 -> 0 bytes ...ameraBridgeViewBase$ListItemAccessor.class | Bin 315 -> 0 bytes .../opencv/android/CameraBridgeViewBase.class | Bin 12195 -> 0 bytes .../opencv/android/CameraGLRendererBase.class | Bin 12177 -> 0 bytes ...aGLSurfaceView$CameraTextureListener.class | Bin 369 -> 0 bytes .../opencv/android/CameraGLSurfaceView.class | Bin 3676 -> 0 bytes .../org/opencv/android/CameraRenderer.class | Bin 6090 -> 0 bytes .../classes/org/opencv/android/FpsMeter.class | Bin 2537 -> 0 bytes .../android/InstallCallbackInterface.class | Bin 365 -> 0 bytes .../org/opencv/android/JavaCameraView$1.class | Bin 228 -> 0 bytes .../android/JavaCameraView$CameraWorker.class | Bin 2325 -> 0 bytes .../JavaCameraView$JavaCameraFrame.class | Bin 1726 -> 0 bytes ...avaCameraView$JavaCameraSizeAccessor.class | Bin 995 -> 0 bytes .../org/opencv/android/JavaCameraView.class | Bin 10626 -> 0 bytes .../android/LoaderCallbackInterface.class | Bin 475 -> 0 bytes .../org/opencv/android/OpenCVLoader.class | Bin 1781 -> 0 bytes .../org/opencv/android/StaticHelper.class | Bin 2882 -> 0 bytes .../classes/org/opencv/android/Utils.class | Bin 4309 -> 0 bytes .../classes/org/opencv/calib3d/Calib3d.class | Bin 47958 -> 0 bytes .../classes/org/opencv/calib3d/StereoBM.class | Bin 3517 -> 0 bytes .../org/opencv/calib3d/StereoMatcher.class | Bin 2692 -> 0 bytes .../org/opencv/calib3d/StereoSGBM.class | Bin 2559 -> 0 bytes .../classes/org/opencv/core/Algorithm.class | Bin 1208 -> 0 bytes .../opencv/core/Core$MinMaxLocResult.class | Bin 594 -> 0 bytes .../classes/org/opencv/core/Core.class | Bin 38499 -> 0 bytes .../classes/org/opencv/core/CvException.class | Bin 695 -> 0 bytes .../classes/org/opencv/core/CvType.class | Bin 3918 -> 0 bytes .../classes/org/opencv/core/DMatch.class | Bin 1362 -> 0 bytes .../classes/org/opencv/core/KeyPoint.class | Bin 1869 -> 0 bytes .../classes/org/opencv/core/Mat.class | Bin 17467 -> 0 bytes .../classes/org/opencv/core/MatOfByte.class | Bin 3069 -> 0 bytes .../classes/org/opencv/core/MatOfDMatch.class | Bin 3220 -> 0 bytes .../classes/org/opencv/core/MatOfDouble.class | Bin 3095 -> 0 bytes .../classes/org/opencv/core/MatOfFloat.class | Bin 3080 -> 0 bytes .../classes/org/opencv/core/MatOfFloat4.class | Bin 3084 -> 0 bytes .../classes/org/opencv/core/MatOfFloat6.class | Bin 3090 -> 0 bytes .../classes/org/opencv/core/MatOfInt.class | Bin 3076 -> 0 bytes .../classes/org/opencv/core/MatOfInt4.class | Bin 3075 -> 0 bytes .../org/opencv/core/MatOfKeyPoint.class | Bin 3271 -> 0 bytes .../classes/org/opencv/core/MatOfPoint.class | Bin 2903 -> 0 bytes .../org/opencv/core/MatOfPoint2f.class | Bin 2911 -> 0 bytes .../classes/org/opencv/core/MatOfPoint3.class | Bin 2957 -> 0 bytes .../org/opencv/core/MatOfPoint3f.class | Bin 2961 -> 0 bytes .../classes/org/opencv/core/MatOfRect.class | Bin 2972 -> 0 bytes .../classes/org/opencv/core/MatOfRect2d.class | Bin 3008 -> 0 bytes .../classes/org/opencv/core/Point.class | Bin 2181 -> 0 bytes .../classes/org/opencv/core/Point3.class | Bin 2526 -> 0 bytes .../classes/org/opencv/core/Range.class | Bin 2538 -> 0 bytes .../classes/org/opencv/core/Rect.class | Bin 3563 -> 0 bytes .../classes/org/opencv/core/Rect2d.class | Bin 3531 -> 0 bytes .../classes/org/opencv/core/RotatedRect.class | Bin 3800 -> 0 bytes .../classes/org/opencv/core/Scalar.class | Bin 3051 -> 0 bytes .../classes/org/opencv/core/Size.class | Bin 2213 -> 0 bytes .../org/opencv/core/TermCriteria.class | Bin 2208 -> 0 bytes .../classes/org/opencv/core/TickMeter.class | Bin 1680 -> 0 bytes .../classes/org/opencv/dnn/DictValue.class | Bin 2370 -> 0 bytes .../classes/org/opencv/dnn/Dnn.class | Bin 5504 -> 0 bytes .../classes/org/opencv/dnn/Layer.class | Bin 3158 -> 0 bytes .../classes/org/opencv/dnn/Net.class | Bin 8865 -> 0 bytes .../OpenCVEngineInterface$Stub$Proxy.class | Bin 2647 -> 0 bytes .../engine/OpenCVEngineInterface$Stub.class | Bin 2653 -> 0 bytes .../opencv/engine/OpenCVEngineInterface.class | Bin 521 -> 0 bytes .../classes/org/opencv/features2d/AKAZE.class | Bin 3439 -> 0 bytes .../features2d/AgastFeatureDetector.class | Bin 2250 -> 0 bytes .../org/opencv/features2d/BFMatcher.class | Bin 1127 -> 0 bytes .../BOWImgDescriptorExtractor.class | Bin 1702 -> 0 bytes .../opencv/features2d/BOWKMeansTrainer.class | Bin 1490 -> 0 bytes .../org/opencv/features2d/BOWTrainer.class | Bin 1952 -> 0 bytes .../classes/org/opencv/features2d/BRISK.class | Bin 2592 -> 0 bytes .../features2d/DescriptorExtractor.class | Bin 3814 -> 0 bytes .../opencv/features2d/DescriptorMatcher.class | Bin 8157 -> 0 bytes .../features2d/FastFeatureDetector.class | Bin 2237 -> 0 bytes .../org/opencv/features2d/Feature2D.class | Bin 4871 -> 0 bytes .../opencv/features2d/FeatureDetector.class | Bin 4952 -> 0 bytes .../org/opencv/features2d/Features2d.class | Bin 6111 -> 0 bytes .../opencv/features2d/FlannBasedMatcher.class | Bin 833 -> 0 bytes .../org/opencv/features2d/GFTTDetector.class | Bin 3383 -> 0 bytes .../classes/org/opencv/features2d/KAZE.class | Bin 3019 -> 0 bytes .../classes/org/opencv/features2d/MSER.class | Bin 3183 -> 0 bytes .../classes/org/opencv/features2d/ORB.class | Bin 3805 -> 0 bytes .../org/opencv/features2d/Params.class | Bin 6143 -> 0 bytes .../org/opencv/imgcodecs/Imgcodecs.class | Bin 6194 -> 0 bytes .../classes/org/opencv/imgproc/CLAHE.class | Bin 1663 -> 0 bytes .../classes/org/opencv/imgproc/Imgproc.class | Bin 76712 -> 0 bytes .../opencv/imgproc/LineSegmentDetector.class | Bin 1935 -> 0 bytes .../classes/org/opencv/imgproc/Moments.class | Bin 7394 -> 0 bytes .../classes/org/opencv/imgproc/Subdiv2D.class | Bin 6359 -> 0 bytes .../classes/org/opencv/ml/ANN_MLP.class | Bin 6215 -> 0 bytes .../org/opencv/ml/ANN_MLP_ANNEAL.class | Bin 1716 -> 0 bytes .../classes/org/opencv/ml/Boost.class | Bin 2091 -> 0 bytes .../classes/org/opencv/ml/DTrees.class | Bin 3935 -> 0 bytes .../classes/org/opencv/ml/EM.class | Bin 5618 -> 0 bytes .../classes/org/opencv/ml/KNearest.class | Bin 2465 -> 0 bytes .../org/opencv/ml/LogisticRegression.class | Bin 3930 -> 0 bytes .../classes/org/opencv/ml/Ml.class | Bin 502 -> 0 bytes .../org/opencv/ml/NormalBayesClassifier.class | Bin 1793 -> 0 bytes .../classes/org/opencv/ml/ParamGrid.class | Bin 1750 -> 0 bytes .../classes/org/opencv/ml/RTrees.class | Bin 2753 -> 0 bytes .../classes/org/opencv/ml/SVM.class | Bin 5966 -> 0 bytes .../classes/org/opencv/ml/SVMSGD.class | Bin 3950 -> 0 bytes .../classes/org/opencv/ml/StatModel.class | Bin 2588 -> 0 bytes .../classes/org/opencv/ml/TrainData.class | Bin 7664 -> 0 bytes .../objdetect/BaseCascadeClassifier.class | Bin 544 -> 0 bytes .../opencv/objdetect/CascadeClassifier.class | Bin 4530 -> 0 bytes .../org/opencv/objdetect/HOGDescriptor.class | Bin 8690 -> 0 bytes .../org/opencv/objdetect/Objdetect.class | Bin 1215 -> 0 bytes .../org/opencv/osgi/OpenCVInterface.class | Bin 127 -> 0 bytes .../org/opencv/osgi/OpenCVNativeLoader.class | Bin 837 -> 0 bytes .../org/opencv/photo/AlignExposures.class | Bin 1283 -> 0 bytes .../classes/org/opencv/photo/AlignMTB.class | Bin 3340 -> 0 bytes .../org/opencv/photo/CalibrateCRF.class | Bin 1154 -> 0 bytes .../org/opencv/photo/CalibrateDebevec.class | Bin 1403 -> 0 bytes .../org/opencv/photo/CalibrateRobertson.class | Bin 1359 -> 0 bytes .../org/opencv/photo/MergeDebevec.class | Bin 1577 -> 0 bytes .../org/opencv/photo/MergeExposures.class | Bin 1229 -> 0 bytes .../org/opencv/photo/MergeMertens.class | Bin 2459 -> 0 bytes .../org/opencv/photo/MergeRobertson.class | Bin 1583 -> 0 bytes .../classes/org/opencv/photo/Photo.class | Bin 13664 -> 0 bytes .../classes/org/opencv/photo/Tonemap.class | Bin 1045 -> 0 bytes .../org/opencv/photo/TonemapDrago.class | Bin 1071 -> 0 bytes .../org/opencv/photo/TonemapDurand.class | Bin 1648 -> 0 bytes .../org/opencv/photo/TonemapMantiuk.class | Bin 1082 -> 0 bytes .../org/opencv/photo/TonemapReinhard.class | Bin 1423 -> 0 bytes .../classes/org/opencv/utils/Converters.class | Bin 23797 -> 0 bytes .../opencv/video/BackgroundSubtractor.class | Bin 1203 -> 0 bytes .../video/BackgroundSubtractorKNN.class | Bin 2610 -> 0 bytes .../video/BackgroundSubtractorMOG2.class | Bin 4515 -> 0 bytes .../org/opencv/video/DenseOpticalFlow.class | Bin 937 -> 0 bytes .../opencv/video/DualTVL1OpticalFlow.class | Bin 4432 -> 0 bytes .../opencv/video/FarnebackOpticalFlow.class | Bin 3198 -> 0 bytes .../org/opencv/video/KalmanFilter.class | Bin 4730 -> 0 bytes .../org/opencv/video/SparseOpticalFlow.class | Bin 1257 -> 0 bytes .../opencv/video/SparsePyrLKOpticalFlow.class | Bin 2860 -> 0 bytes .../classes/org/opencv/video/Video.class | Bin 7953 -> 0 bytes .../org/opencv/videoio/VideoCapture.class | Bin 3130 -> 0 bytes .../org/opencv/videoio/VideoWriter.class | Bin 3875 -> 0 bytes .../classes/org/opencv/videoio/Videoio.class | Bin 31010 -> 0 bytes .../library_java_res/debug/res.jar | Bin 22 -> 0 bytes .../packaged_res/debug/values/values.xml | 11 -- .../debug/package-aware-r.txt | 7 - .../runtime_library_classes/debug/classes.jar | Bin 307445 -> 0 bytes .../build/intermediates/symbols/debug/R.txt | 8 -- .../mergeJniLibs/debug/__content__.json | 1 - .../stripDebugSymbol/debug/__content__.json | 1 - 187 files changed, 184 insertions(+), 249 deletions(-) delete mode 100644 app/debug/output.json delete mode 100644 nsfw/src/main/java/com/zwy/nsfw/ClassifierFloatMobileNet.java delete mode 100644 openCVLibrary340/build/intermediates/annotation_processor_list/debug/annotationProcessors.json delete mode 100644 openCVLibrary340/build/intermediates/compile_library_classes/debug/classes.jar delete mode 100644 openCVLibrary340/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar delete mode 100644 openCVLibrary340/build/intermediates/incremental/debug-mergeJniLibs/merge-state delete mode 100644 openCVLibrary340/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml delete mode 100644 openCVLibrary340/build/intermediates/incremental/mergeDebugShaders/merger.xml delete mode 100644 openCVLibrary340/build/intermediates/incremental/packageDebugAssets/merger.xml delete mode 100644 openCVLibrary340/build/intermediates/incremental/packageDebugResources/compile-file-map.properties delete mode 100644 openCVLibrary340/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml delete mode 100644 openCVLibrary340/build/intermediates/incremental/packageDebugResources/merger.xml delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/BuildConfig.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper$2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper$3$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper$3$2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper$3.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/AsyncServiceHelper.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$3.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$4.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$5.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$6.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback$7.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/BaseLoaderCallback.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/Camera2Renderer$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/Camera2Renderer$2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/Camera2Renderer.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$CvCameraViewFrame.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$CvCameraViewListener.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$CvCameraViewListener2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$CvCameraViewListenerAdapter.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase$ListItemAccessor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraBridgeViewBase.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraGLRendererBase.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraGLSurfaceView$CameraTextureListener.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraGLSurfaceView.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/CameraRenderer.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/FpsMeter.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/InstallCallbackInterface.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/JavaCameraView$1.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/JavaCameraView$CameraWorker.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/JavaCameraView$JavaCameraFrame.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/JavaCameraView$JavaCameraSizeAccessor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/JavaCameraView.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/LoaderCallbackInterface.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/OpenCVLoader.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/StaticHelper.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/android/Utils.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/calib3d/Calib3d.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/calib3d/StereoBM.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/calib3d/StereoMatcher.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/calib3d/StereoSGBM.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Algorithm.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Core$MinMaxLocResult.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Core.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/CvException.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/CvType.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/DMatch.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/KeyPoint.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Mat.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfByte.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfDMatch.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfDouble.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfFloat.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfFloat4.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfFloat6.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfInt.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfInt4.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfKeyPoint.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfPoint.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfPoint2f.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfPoint3.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfPoint3f.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfRect.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/MatOfRect2d.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Point.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Point3.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Range.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Rect.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Rect2d.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/RotatedRect.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Scalar.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/Size.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/TermCriteria.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/core/TickMeter.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/dnn/DictValue.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/dnn/Dnn.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/dnn/Layer.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/dnn/Net.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/engine/OpenCVEngineInterface$Stub$Proxy.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/engine/OpenCVEngineInterface$Stub.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/engine/OpenCVEngineInterface.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/AKAZE.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/AgastFeatureDetector.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/BFMatcher.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/BOWImgDescriptorExtractor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/BOWKMeansTrainer.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/BOWTrainer.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/BRISK.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/DescriptorExtractor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/DescriptorMatcher.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/FastFeatureDetector.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/Feature2D.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/FeatureDetector.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/Features2d.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/FlannBasedMatcher.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/GFTTDetector.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/KAZE.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/MSER.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/ORB.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/features2d/Params.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgcodecs/Imgcodecs.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgproc/CLAHE.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgproc/Imgproc.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgproc/LineSegmentDetector.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgproc/Moments.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/imgproc/Subdiv2D.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/ANN_MLP.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/ANN_MLP_ANNEAL.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/Boost.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/DTrees.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/EM.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/KNearest.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/LogisticRegression.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/Ml.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/NormalBayesClassifier.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/ParamGrid.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/RTrees.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/SVM.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/SVMSGD.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/StatModel.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/ml/TrainData.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/objdetect/BaseCascadeClassifier.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/objdetect/CascadeClassifier.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/objdetect/HOGDescriptor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/objdetect/Objdetect.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/osgi/OpenCVInterface.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/osgi/OpenCVNativeLoader.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/AlignExposures.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/AlignMTB.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/CalibrateCRF.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/CalibrateDebevec.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/CalibrateRobertson.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/MergeDebevec.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/MergeExposures.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/MergeMertens.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/MergeRobertson.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/Photo.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/Tonemap.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/TonemapDrago.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/TonemapDurand.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/TonemapMantiuk.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/photo/TonemapReinhard.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/utils/Converters.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/BackgroundSubtractor.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/BackgroundSubtractorKNN.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/BackgroundSubtractorMOG2.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/DenseOpticalFlow.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/DualTVL1OpticalFlow.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/FarnebackOpticalFlow.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/KalmanFilter.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/SparseOpticalFlow.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/SparsePyrLKOpticalFlow.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/video/Video.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/videoio/VideoCapture.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/videoio/VideoWriter.class delete mode 100644 openCVLibrary340/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/opencv/videoio/Videoio.class delete mode 100644 openCVLibrary340/build/intermediates/library_java_res/debug/res.jar delete mode 100644 openCVLibrary340/build/intermediates/packaged_res/debug/values/values.xml delete mode 100644 openCVLibrary340/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt delete mode 100644 openCVLibrary340/build/intermediates/runtime_library_classes/debug/classes.jar delete mode 100644 openCVLibrary340/build/intermediates/symbols/debug/R.txt delete mode 100644 openCVLibrary340/build/intermediates/transforms/mergeJniLibs/debug/__content__.json delete mode 100644 openCVLibrary340/build/intermediates/transforms/stripDebugSymbol/debug/__content__.json diff --git a/app/build.gradle b/app/build.gradle index a737dec01..81307ef57 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,7 +44,10 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + + implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30' -// implementation project(path: ':nsfw') - implementation 'com.github.devzwy:open_nsfw_android:1.2.4' + implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.2.3' + implementation project(path: ':nsfw') +// implementation 'com.github.devzwy:open_nsfw_android:1.2.4' } diff --git a/app/debug/output.json b/app/debug/output.json deleted file mode 100644 index 92a078474..000000000 --- a/app/debug/output.json +++ /dev/null @@ -1 +0,0 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ab5c79484..7df9728b5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ - + diff --git a/app/src/main/java/com/example/open_nsfw_android/MainActivity.kt b/app/src/main/java/com/example/open_nsfw_android/MainActivity.kt index c2fbe8e5a..15b62a3e4 100644 --- a/app/src/main/java/com/example/open_nsfw_android/MainActivity.kt +++ b/app/src/main/java/com/example/open_nsfw_android/MainActivity.kt @@ -1,45 +1,120 @@ package com.example.open_nsfw_android -import android.annotation.SuppressLint +import android.content.Intent import android.graphics.BitmapFactory import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.support.v7.widget.LinearLayoutManager +import android.view.View +import com.luck.picture.lib.PictureSelector +import com.luck.picture.lib.config.PictureConfig +import com.luck.picture.lib.config.PictureMimeType +import com.luck.picture.lib.entity.LocalMedia import com.zwy.nsfw.api.NsfwHelper import kotlinx.android.synthetic.main.activity_main.* -class MainActivity : AppCompatActivity() { +class MainActivity : AppCompatActivity(), View.OnClickListener { + var nsfwHelper: NsfwHelper? = null var mainAdapter: MainAdapter? = null var index = 0 - val listData: ArrayList = ArrayList() - @SuppressLint("SetTextI18n") + var listData: ArrayList = ArrayList() + var selectList: List? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - //assets 目录下的timg-10.jpeg为正常静态图片 ccc.gif 为动态正常图片 可用作测试 -// val b = BitmapFactory.decodeStream(resources.assets.open("img/06 (1).jpg")) -// iv.setImageBitmap(b) - nsfwHelper = NsfwHelper.getInstance(this, true, 1) + initNsfwHelper() + initAdapter() + initClickListener() + } + + override fun onClick(v: View) { + when (v.id) { + R.id.bt_sc_assets -> { + reScAssetsImgs() + } + R.id.bt_sc_from_other -> { + PictureSelector.create(this) + .openGallery(PictureMimeType.ofImage())//全部.ofAll()、图片.、视频.ofVideo()、音频.ofAudio() + .maxSelectNum(20)// 最大图片选择数量 int + .minSelectNum(1)// 最小选择数量 int + .imageSpanCount(3)// 每行显示个数 int + .selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 or PictureConfig.SINGLE + .previewImage(true)// 是否可预览图片 true or false + .isCamera(false)// 是否显示拍照按钮 true or false + .isZoomAnim(true)// 图片列表点击 缩放效果 默认true + .selectionMedia(selectList) + .sizeMultiplier(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效 + .previewEggs(true)// 预览图片时 是否增强左右滑动图片体验(图片滑动一半即可看到上一张是否选中) true or false + .forResult(0x01);//结果回调onActivityResult code + } + } + } + + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + if (requestCode == 0x01 && resultCode == RESULT_OK) { + selectList = PictureSelector.obtainMultipleResult(data) + if (selectList != null && selectList?.size ?: 0 > 0) + reScFromImgs(selectList!!) + } + } + + + private fun initClickListener() { + bt_sc_assets.setOnClickListener(this) + bt_sc_from_other.setOnClickListener(this) + } + + private fun initAdapter() { mainAdapter = MainAdapter(null) rv.layoutManager = LinearLayoutManager(this) rv.adapter = mainAdapter - tv_start.setOnClickListener { - for (a in resources.assets.list("img")) { - val path = "img/${a}" - val b = BitmapFactory.decodeStream(resources.assets.open(path)) - listData.add(MyNsfwBean(0f, 0f, path, b)) - nsfwHelper?.scanBitmap(b) { sfw, nsfw -> + } + + private fun initNsfwHelper() { + nsfwHelper = NsfwHelper.getInstance(this, false, 1) + } + + private fun reScFromImgs(list: List) { + index = 0 + mainAdapter?.setNewData(null) + listData = ArrayList() + Thread(Runnable { + for (lm in list) { + val bitmap = BitmapFactory.decodeFile(lm.path) + listData.add(MyNsfwBean(0.0f, 0.0f, lm.path, bitmap)) + nsfwHelper?.scanBitmap(bitmap) { sfw, nsfw -> listData[index].sfw = sfw listData[index].nsfw = nsfw mainAdapter?.addData(listData[index]) mainAdapter?.notifyItemInserted(index) + rv.scrollToPosition(index) index++ } } + }).start() + } + private fun reScAssetsImgs() { + index = 0 + mainAdapter?.setNewData(null) + listData = ArrayList() + for (a in resources.assets.list("img")) { + val path = "img/${a}" + val b = BitmapFactory.decodeStream(resources.assets.open(path)) + listData.add(MyNsfwBean(0f, 0f, path, b)) + nsfwHelper?.scanBitmap(b) { sfw, nsfw -> + listData[index].sfw = sfw + listData[index].nsfw = nsfw + mainAdapter?.addData(listData[index]) + mainAdapter?.notifyItemInserted(index) + rv.scrollToPosition(index) + index++ + } } - } } diff --git a/app/src/main/java/com/example/open_nsfw_android/MainAdapter.kt b/app/src/main/java/com/example/open_nsfw_android/MainAdapter.kt index 3e40d90b1..cbedcdb4f 100644 --- a/app/src/main/java/com/example/open_nsfw_android/MainAdapter.kt +++ b/app/src/main/java/com/example/open_nsfw_android/MainAdapter.kt @@ -8,7 +8,7 @@ import android.widget.TextView import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseViewHolder -class MainAdapter(val nsfwList: List?) : +class MainAdapter(nsfwList: List?) : BaseQuickAdapter(R.layout.main_item, nsfwList) { @SuppressLint("SetTextI18n") @@ -17,15 +17,15 @@ class MainAdapter(val nsfwList: List?) : val imageView = helper.getView(R.id.iv) val view = helper.getView(R.id.view) var nsfwStr = "色情图片" - var color = ContextCompat.getColor(mContext,R.color.nsfw1) + var color = ContextCompat.getColor(mContext, R.color.nsfw1) when (item.nsfw) { in 0.0..0.3 -> { nsfwStr = "正常图片" - color = ContextCompat.getColor(mContext,R.color.nsfw3) + color = ContextCompat.getColor(mContext, R.color.nsfw3) } - in 0.3..0.7 -> { + in 0.3..0.6 -> { nsfwStr = "👙比基尼" - color = ContextCompat.getColor(mContext,R.color.nsfw2) + color = ContextCompat.getColor(mContext, R.color.nsfw2) } } textView.text = diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 67a45de1b..90b0513ad 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -4,13 +4,26 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> - + +