Commit 979e6844 authored by bixing's avatar bixing

fix

parent a9959f3c
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="17" />
</component>
</project>
\ No newline at end of file
......@@ -22,9 +22,15 @@ android {
buildTypes {
release {
minifyEnabled false
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'app-proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -44,6 +50,24 @@ android {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
signingConfigs {
toolsTest {
storeFile file("../marqueeTest.jks")
storePassword '123456'
keyAlias 'key0'
keyPassword '123456'
}
}
flavorDimensions "versionName"
productFlavors {
marquee {
applicationId "com.ads.cal.marquee"
versionName "1.0.0.0"
signingConfig signingConfigs.toolsTest
}
}
}
dependencies {
......
......@@ -18,4 +18,223 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
#-renamesourcefileattribute SourceFile
-dontpreverify
-flattenpackagehierarchy
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-useuniqueclassmembernames
-ignorewarnings
#基础模板开始
# 保护注解
-keepattributes *Annotation*
-keepattributes *JavascriptInterface*
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
#泛型 内部类 反射
-keepattributes Signature,InnerClasses,EnclosingMethod
#显示代码行数
-keepattributes Exceptions,SourceFile,LineNumberTable
-keep public class *$JavaScriptInterface
-keepattributes *$JavaScriptInterface
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keepclassmembers class * extends android.webkit.WebViewClient {
*;
}
# Understand the @Keep support annotation.
-keep class android.support.annotation.Keep
-keep @android.support.annotation.Keep class * {*;}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <methods>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <init>(...);
}
#【不进行混淆保持原样】
-keep public class * extends android.view.View
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
#commom
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keep public class * extends android.support.**
-keep class com.google.** { *; }
-keep class android.webkit.**{*;}
-keep class org.apache.** { *; }
-keep public class android.** { *; }
-keepclassmembers public class android.** { *; }
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {*;}
-keepclassmembers class * implements android.os.Parcelable {*;}
-keep class * implements java.io.Serializable {*;}
-keepclassmembers class * implements java.io.Serializable {*;}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class **.R$* {
public static <fields>;
}
#基础模板结束
#utilcode
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-keepclassmembers class * {
@com.blankj.utilcode.util.BusUtils$Bus <methods>;
}
-dontwarn com.blankj.utilcode.**
-dontwarn javax.annotation.**
-dontwarn javax.inject.**
# OkHttp3
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
#okhttp
-dontwarn okhttp3.**
-keep class okhttp3.*{*;}
#okio
-dontwarn okio.**
-keep class okio.*{*;}
# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature-keepattributes
# Gson
-keep class com.google.gson.stream.** { *; }
-keepattributes EnclosingMethod
-keep class org.xz_sale.entity.**{*;}
# agentWeb
-keep class com.just.agentweb.** {
*;
}
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
##Glide
-keep class com.bumptech.glide.** {*;}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl { *; }
#alibaba arouter start
-keep public class com.alibaba.android.arouter.routes.**{*;}
-keep public class com.alibaba.android.arouter.facade.**{*;}
-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;}
# 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口
-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider
# 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现
-keep class * implements com.alibaba.android.arouter.facade.template.IProvider
#alibaba arouter end
#kotlinx start
-keep class kotlinx.** { *; }
-keep class kotlin.** { *; }
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
#kotlinx end
#9.22版本新增加混淆
-keep class android.support.v7.widget.RecyclerView {*;}
-keepnames class android.support.v7.widget.RecyclerView$* {
public <fields>;
public <methods>;
}
#android
-keep class android.** {*;}
-keep class androidx.** {*;}
-keep class android.support.** {*;}
-keep class android.content.** {*;}
-keep class android.app.** {*;}
-keep class android.os.** {*;}
-keep class android.net.** {*;}
-keep class android.provider.** {*;}
#com.github
-keep class com.github.** {*;}
#com.google
-keep class com.google.** {*;}
#org.
-keep class org.**{ *; }
......@@ -20,6 +20,7 @@
android:exported="true"
android:hardwareAccelerated="true"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:theme="@style/MarqueeTheme"
android:label="@string/app_name">
<intent-filter>
......@@ -31,6 +32,7 @@
<activity
android:name="com.ads.cal.marquee.MarqueeMActivity"
android:exported="true"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:hardwareAccelerated="true"
android:screenOrientation="landscape"
android:theme="@style/MarqueeTheme">
......
......@@ -9,8 +9,6 @@ import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
......@@ -53,11 +51,39 @@ public class MarqueeMActivity extends Activity {
marqueeView = findViewById(R.id.mq);
marqueeView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
marqueeView.startRun(1.8f);
f = findViewById(R.id.f);
FrameLayout f = findViewById(R.id.f);
marqueeView.setOnTouchListener(new View.OnTouchListener() {
private float x, y;
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
x = motionEvent.getX();
y = motionEvent.getY();
break;
case MotionEvent.ACTION_UP:
if (isClick(x, y, motionEvent.getX(), motionEvent.getY())) {
showSetting(f);
}
break;
}
return false;
}
});
marqueeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
private FrameLayout f;
private boolean isClick(float startX, float startY, float endX, float endY) {
// 设置一个点击范围,这里假设点击范围是10像素
float touchSlop = 20;
// 判断起始点和抬起点的距离是否在点击范围内
return Math.abs(endX - startX) < touchSlop && Math.abs(endY - startY) < touchSlop;
}
private View view;
......@@ -96,16 +122,6 @@ public class MarqueeMActivity extends Activity {
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return true;
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
showSetting(f);
return true;
}
private void initPopupWindowView() {
EditText editText = view.findViewById(R.id.ed);
......@@ -220,6 +236,11 @@ public class MarqueeMActivity extends Activity {
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
......
......@@ -2,6 +2,7 @@ package com.ads.cal.marquee;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
......@@ -46,6 +47,11 @@ public class OpenActivity extends Activity {
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message message) {
......
......@@ -10,9 +10,6 @@
<com.ads.cal.marquee.MarqueeView
android:id="@+id/mq"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="false"
android:focusable="false"
android:clickable="false" />
android:layout_height="match_parent" />
</FrameLayout>
\ No newline at end of file
......@@ -150,6 +150,7 @@
android:gravity="center"
android:text="Privacy Policy"
android:textColor="#575151"
android:visibility="gone"
android:textSize="13sp" />
<TextView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment