diff --git a/app/build.gradle b/app/build.gradle index 2f4dbde09..6b62642cc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -107,7 +107,7 @@ dependencies { // 应用服务分发 def appCenterSdkVersion = '4.4.5' - implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" +// implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" // implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}" diff --git a/app/src/androidTest/java/com/hippo/ehviewer/ApplicationTest.java b/app/src/androidTest/java/com/hippo/ehviewer/ApplicationTest.java deleted file mode 100644 index 09ded3dd7..000000000 --- a/app/src/androidTest/java/com/hippo/ehviewer/ApplicationTest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hippo.ehviewer; - -import android.app.Application; -import android.test.ApplicationTestCase; - -/** - * Testing Fundamentals - */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); - } -} \ No newline at end of file diff --git a/app/src/androidTest/java/com/hippo/ehviewer/CardBgTest.java b/app/src/androidTest/java/com/hippo/ehviewer/CardBgTest.java deleted file mode 100644 index f48cf5b35..000000000 --- a/app/src/androidTest/java/com/hippo/ehviewer/CardBgTest.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2016 Hippo Seven - * - * 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. - */ - -package com.hippo.ehviewer; - -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Path; -import android.graphics.RectF; -import android.os.Environment; - -import junit.framework.TestCase; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.OutputStream; - -public class CardBgTest extends TestCase { - - private static final float[] TOP_ALPHA = { - 0f, // Dump - 0.12f, - 0.16f, - 0.19f, - 0.25f, - 0.30f, - }; - - private static final float[] TOP_OFFSET = { - 0f, // Dump - 1f, - 3f, - 10f, - 14f, - 19f, - }; - - private static final float[] TOP_BLUR = { - 0f, // Dump - 1.5f, - 3f, - 10f, - 14f, - 19f, - }; - - private static final float[] BOTTOM_ALPHA = { - 0f, // Dump - 0.24f, - 0.23f, - 0.23f, - 0.22f, - 0.22f, - }; - - private static final float[] BOTTOM_OFFSET = { - 0f, // Dump - 1f, - 3f, - 6f, - 10f, - 15f, - }; - - private static final float[] BOTTOM_BLUR = { - 0f, // Dump - 1f, - 3f, - 3f, - 5f, - 6f, - }; - - private static final int MAX_SIZE = 200; - - - public void testGen() throws FileNotFoundException { - genCardBg(Color.WHITE, 2, 2); - } - - private Path getPath(float radius, float base) { - RectF rectF = new RectF(); - Path path = new Path(); - path.moveTo(base / 2, -base / 2 - radius); - rectF.set(base / 2 - radius, -base / 2 - radius, base / 2 + radius, -base / 2 + radius); - path.arcTo(rectF, -90, 90); - path.lineTo(base / 2 + radius, base / 2); - rectF.set(base / 2 - radius, base / 2 - radius, base / 2 + radius, base / 2 + radius); - path.arcTo(rectF, 0, 90); - path.lineTo(-base / 2, base / 2 + radius); - rectF.set(-base / 2 - radius, base / 2 - radius, -base / 2 + radius, base / 2 + radius); - path.arcTo(rectF, 90, 90); - path.lineTo(-base / 2 - radius, -base / 2); - rectF.set(-base / 2 - radius, -base / 2 - radius, -base / 2 + radius, -base / 2 + radius); - path.arcTo(rectF, 180, 90); - path.close(); - return path; - } - - private void genCardBg(int color, float radius, int elevation) throws FileNotFoundException { - - float base = 4; - float topAlpha = TOP_ALPHA[elevation]; - float topOffset = TOP_OFFSET[elevation]; - float topBlur = TOP_BLUR[elevation]; - float bottomAlpha = BOTTOM_ALPHA[elevation]; - float bottomOffset = BOTTOM_OFFSET[elevation]; - float bottomBlur = BOTTOM_BLUR[elevation]; - - - float ratio = 3; - - - doGenCardBg(new FileOutputStream(new File(Environment.getExternalStorageDirectory(), "test.png")), - color, radius * ratio, base * ratio, - topAlpha, topOffset * ratio, topBlur * ratio, - bottomAlpha, bottomOffset * ratio, bottomBlur * ratio); - - - } - - private int getColor(float alpha) { - return Color.argb((int) (alpha * 0xff), 0, 0, 0); - } - - private void doGenCardBg(OutputStream os, int color, float radius, float base, - float topAlpha, float topOffset, float topBlur, - float bottomAlpha, float bottomOffset, float bottomBlur) throws FileNotFoundException { - - Path path = getPath(radius, base); - path.offset(MAX_SIZE / 2, MAX_SIZE / 2); - - Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); - paint.setColor(color); - Bitmap bitmap = Bitmap.createBitmap(MAX_SIZE, MAX_SIZE, Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(bitmap); - - // Draw bottom - paint.setShadowLayer(bottomBlur, 0, bottomOffset, getColor(bottomAlpha)); - canvas.drawPath(path, paint); - - // Draw top - paint.setShadowLayer(topBlur, 0, topOffset, getColor(topAlpha)); - canvas.drawPath(path, paint); - - bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); - } -} diff --git a/app/src/androidTest/java/com/hippo/ehviewer/CookieDBTest.java b/app/src/androidTest/java/com/hippo/ehviewer/CookieDBTest.java deleted file mode 100644 index 128df76d9..000000000 --- a/app/src/androidTest/java/com/hippo/ehviewer/CookieDBTest.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2016 Hippo Seven - * - * 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. - */ - -package com.hippo.ehviewer; - -import junit.framework.TestCase; - -public class CookieDBTest extends TestCase { -} diff --git a/app/src/androidTest/java/com/hippo/ehviewer/DumpTest.java b/app/src/androidTest/java/com/hippo/ehviewer/DumpTest.java deleted file mode 100644 index 3b311ef8e..000000000 --- a/app/src/androidTest/java/com/hippo/ehviewer/DumpTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2016 Hippo Seven - * - * 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. - */ - -package com.hippo.ehviewer; - -import junit.framework.TestCase; - -import java.net.MalformedURLException; -import java.net.URL; - -public class DumpTest extends TestCase { - - - public void testDump() { - String str = "M12.1,18.55L12,18.65L11.89,18.55C7.14,14.24 4,11.39 4,8.5C4,6.5 5.5,5 7.5,5C9.04,5 10.54,6 11.07,7.36H12.93C13.46,6 14.96,5 16.5,5C18.5,5 20,6.5 20,8.5C20,11.39 16.86,14.24 12.1,18.55"; - System.out.println(str.replaceAll("\\d+(\\.\\d+)?", "12")); - } - - public void testDumpURL() { - String str1 = "http://exhentai.org/?f_doujinshi=1&f_manga=0&f_artistcg=0&f_gamecg=1&f_western=1&f_non-h=1&f_imageset=0&f_cosplay=0&f_asianporn=1&f_misc=1&f_search=&f_apply=Apply+Filter"; - String str2 = "http://exhentai.org/3?f_search=hentai&f_apply=Apply+Filter"; - try { - URL url = new URL(str2); - - - System.out.println(url.getHost()); - System.out.println(url.getPath()); - System.out.println(url.getQuery()); - - - } catch (MalformedURLException e) { - e.printStackTrace(); - } - - } - -} diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/gallery/detail/GalleryDetailScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/gallery/detail/GalleryDetailScene.java index 1cbc7ed93..76ba2e273 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/gallery/detail/GalleryDetailScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/gallery/detail/GalleryDetailScene.java @@ -108,7 +108,6 @@ import com.hippo.ehviewer.ui.scene.history.HistoryScene; import com.hippo.ehviewer.ui.scene.TransitionNameFactory; import com.hippo.ehviewer.ui.scene.gallery.list.GalleryListScene; -import com.hippo.ehviewer.util.AppCenterAnalytics; import com.hippo.ehviewer.util.ClipboardUtil; import com.hippo.ehviewer.widget.ArchiverDownloadProgress; import com.hippo.ehviewer.widget.GalleryRatingBar; @@ -464,7 +463,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) { properties = new HashMap<>(); properties.put("Title", mGalleryInfo.title); properties.put("Time", dateFormat.format(date)); - AppCenterAnalytics.trackEvent("进入画廊详情页", properties); } torrentDownloadHandler = new TorrentDownloadHandler(); diff --git a/app/src/main/java/com/hippo/ehviewer/ui/splash/SplashActivity.kt b/app/src/main/java/com/hippo/ehviewer/ui/splash/SplashActivity.kt index 739b765a3..8ee402c4d 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/splash/SplashActivity.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/splash/SplashActivity.kt @@ -13,7 +13,6 @@ import com.hippo.ehviewer.ui.EhActivity import com.hippo.ehviewer.ui.MainActivity import com.hippo.ehviewer.ui.dialog.EhDistributeListener import com.microsoft.appcenter.AppCenter -import com.microsoft.appcenter.analytics.Analytics import com.microsoft.appcenter.distribute.Distribute import java.lang.Exception @@ -34,7 +33,6 @@ class SplashActivity : EhActivity() { } AppCenter.start( application, "a47010fb-702a-415a-ad93-ab5c674093ca", - Analytics::class.java, Distribute::class.java ) // AppCenter.start(getApplication(), "feb52710-e245-4820-aebb-a57e00ed806d", // Analytics.class, Crashes.class, Distribute.class); diff --git a/app/src/main/java/com/hippo/ehviewer/util/AppCenterAnalytics.java b/app/src/main/java/com/hippo/ehviewer/util/AppCenterAnalytics.java deleted file mode 100644 index 95ef04ab4..000000000 --- a/app/src/main/java/com/hippo/ehviewer/util/AppCenterAnalytics.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hippo.ehviewer.util; - -import com.hippo.ehviewer.Settings; -import com.microsoft.appcenter.analytics.Analytics; - -import java.util.Map; - -public class AppCenterAnalytics { - - private static boolean isEnable(){ - return Settings.getEnableAnalytics(); - } - - public static void trackEvent(String name){ - if (isEnable()){ - Analytics.trackEvent(name); - } - } - - public static void trackEvent(String name, Map properties){ - if (isEnable()){ - Analytics.trackEvent(name,properties); - } - } - - public static void trackEvent(String name,Map properties, int flags){ - if (isEnable()){ - Analytics.trackEvent(name,properties,flags); - } - } - -}