1145873331@qq.com 6 years ago
parent
commit
eb17f9ccbb
33 changed files with 28 additions and 993 deletions
  1. 7 0
      app/bugly/BuglyUploadLog.txt
  2. 3 11
      app/build.gradle
  3. 0 0
      app/libs/MobCommons.jar
  4. 0 0
      app/libs/MobTools.jar
  5. 15 0
      app/proguard-rules.pro
  6. 0 1
      app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java
  7. 3 0
      app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java
  8. 0 0
      app/src/main/jniLibs/ShareSDK-Core-2.6.4.jar
  9. 0 0
      app/src/main/jniLibs/ShareSDK-QQ-2.6.4.jar
  10. 0 0
      app/src/main/jniLibs/ShareSDK-QZone-2.6.4.jar
  11. 0 0
      app/src/main/jniLibs/ShareSDK-Wechat-2.6.4.jar
  12. 0 0
      app/src/main/jniLibs/ShareSDK-Wechat-Core-2.6.4.jar
  13. 0 0
      app/src/main/jniLibs/ShareSDK-Wechat-Favorite-2.6.4.jar
  14. 0 0
      app/src/main/jniLibs/ShareSDK-Wechat-Moments-2.6.4.jar
  15. BIN
      app/src/main/jniLibs/armeabi/libijkffmpeg.so
  16. BIN
      app/src/main/jniLibs/armeabi/libijkplayer.so
  17. BIN
      app/src/main/jniLibs/armeabi/libijksdl.so
  18. 0 1
      app/src/main/jniLibs/autolayout/.gitignore
  19. 0 24
      app/src/main/jniLibs/autolayout/build.gradle
  20. 0 17
      app/src/main/jniLibs/autolayout/proguard-rules.pro
  21. 0 15
      app/src/main/jniLibs/autolayout/src/androidTest/java/zhy/com/autolayout/ApplicationTest.java
  22. 0 10
      app/src/main/jniLibs/autolayout/src/main/AndroidManifest.xml
  23. 0 115
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoFrameLayout.java
  24. 0 175
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayout.java
  25. 0 46
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayoutActivity.java
  26. 0 365
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayoutHelper.java
  27. 0 82
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLinearLayout.java
  28. 0 100
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoRelativeLayout.java
  29. 0 22
      app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/L.java
  30. 0 6
      app/src/main/jniLibs/autolayout/src/main/res/values/attrs.xml
  31. 0 3
      app/src/main/jniLibs/autolayout/src/main/res/values/strings.xml
  32. BIN
      app/src/main/jniLibs/bugly_1.2.3.8__release.jar
  33. BIN
      app/src/main/jniLibs/mframework.jar

+ 7 - 0
app/bugly/BuglyUploadLog.txt

@ -5,3 +5,10 @@ appChannel=anzhi
5 5
appPackage=com.electric.chargingpile
6 6
appVersion=3.2.1
7 7
8
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
9
sha1=5b27d36006fd69ed89e5dacbc5a19a1e2884cbe1
10
appId=900010422
11
appChannel=anzhi
12
appPackage=com.electric.chargingpile
13
appVersion=3.2.1
14

+ 3 - 11
app/build.gradle

@ -38,6 +38,9 @@ android {
38 38
            abiFilters "armeabi"
39 39
        }
40 40
    }
41
    sourceSets.main {
42
        jniLibs.srcDirs 'src/main/libs'
43
    }
41 44
    lintOptions {
42 45
        checkReleaseBuilds false
43 46
        abortOnError false
@ -109,8 +112,6 @@ android {
109 112
            //混淆规则配置文件
110 113
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
111 114
            signingConfig signingConfigs.release
112
            //
113
//            signingConfig signingConfigs.config
114 115
        }
115 116
        release {
116 117
            //是否优化zip
@ -122,8 +123,6 @@ android {
122 123
            //混淆规则配置文件
123 124
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
124 125
            signingConfig signingConfigs.release
125
            //
126
//            signingConfig signingConfigs.config
127 126
        }
128 127
129 128
    }
@ -222,13 +221,6 @@ MobSDK {
222 221
    }
223 222
}
224 223
225
//allprojects {
226
//    repositories {
227
//        google()
228
//        jcenter()
229
//    }
230
//}
231
232 224
dependencies {
233 225
    compile files('libs/mframework.jar')
234 226
    compile files('libs/xUtils-2.6.14.jar')

app/src/main/jniLibs/MobCommons.jar → app/libs/MobCommons.jar


app/src/main/jniLibs/MobTools.jar → app/libs/MobTools.jar


+ 15 - 0
app/proguard-rules.pro

@ -294,3 +294,18 @@ public static java.lang.String TABLENAME;
294 294
-keepclassmembers class * extends android.webkit.WebViewClient {
295 295
    public void *(android.webkit.WebView, jav.lang.String);
296 296
}
297
298
299
#ijkplayer
300
-keep class tv.danmaku.ijk.media.player.** {*;}
301
-keep class tv.danmaku.ijk.media.player.IjkMediaPlayer{*;}
302
-keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{*;}
303
304
305
-dontwarn demo.**
306
-keep class demo.**{*;}
307
308
-dontwarn net.sourceforge.pinyin4j.**
309
-keep class net.sourceforge.pinyin4j.**{*;}
310
-keep class net.sourceforge.pinyin4j.format.**{*;}
311
-keep class net.sourceforge.pinyin4j.format.exception.**{*;}

+ 0 - 1
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -1138,7 +1138,6 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1138 1138
        getRecyclerViewData();
1139 1139
        File databasePath = getDatabasePath("zhan_list");
1140 1140
        if (databasePath.exists()) {
1141
            LogUtils.e("存在");
1142 1141
            eteinit("{\"fun\":\"timer\"}");
1143 1142
            try {
1144 1143
                getZhanData();

+ 3 - 0
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

@ -152,6 +152,9 @@ public class SvVideoShowView implements View.OnClickListener {
152 152
            videoUrl = "http://uprocess.b0.upaiyun.com/demo/short_video/UPYUN_0.flv";
153 153
            if (!TextUtils.isEmpty(videoUrl)) {
154 154
                upVideoView2.setVideoPath(videoUrl);
155
                if(!upVideoView2.isPlaying()){
156
                    upVideoView2.start();
157
                }
155 158
            }
156 159
        } else if (talkRecommendBean.targetType == 24) {
157 160

+ 0 - 0
app/src/main/jniLibs/ShareSDK-Core-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-QQ-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-QZone-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-Wechat-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-Wechat-Core-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-Wechat-Favorite-2.6.4.jar


+ 0 - 0
app/src/main/jniLibs/ShareSDK-Wechat-Moments-2.6.4.jar


BIN
app/src/main/jniLibs/armeabi/libijkffmpeg.so


BIN
app/src/main/jniLibs/armeabi/libijkplayer.so


BIN
app/src/main/jniLibs/armeabi/libijksdl.so


+ 0 - 1
app/src/main/jniLibs/autolayout/.gitignore

@ -1 +0,0 @@
1
/build

+ 0 - 24
app/src/main/jniLibs/autolayout/build.gradle

@ -1,24 +0,0 @@
1
apply plugin: 'com.android.library'
2
3
android {
4
    compileSdkVersion 23
5
    buildToolsVersion "23.0.1"
6
7
    defaultConfig {
8
        minSdkVersion 10
9
        targetSdkVersion 23
10
        versionCode 1
11
        versionName "1.0"
12
    }
13
    buildTypes {
14
        release {
15
            minifyEnabled false
16
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17
        }
18
    }
19
}
20
21
dependencies {
22
    compile fileTree(dir: 'libs', include: ['*.jar'])
23
    compile 'com.android.support:appcompat-v7:23.0.1'
24
}

+ 0 - 17
app/src/main/jniLibs/autolayout/proguard-rules.pro

@ -1,17 +0,0 @@
1
# Add project specific ProGuard rules here.
2
# By default, the flags in this file are appended to flags specified
3
# in /Users/zhy/android/sdk/android-sdk-macosx/tools/proguard/proguard-android.txt
4
# You can edit the include path and order by changing the proguardFiles
5
# directive in build.gradle.
6
#
7
# For more details, see
8
#   http://developer.android.com/guide/developing/tools/proguard.html
9
10
# Add any project specific keep options here:
11
12
# If your project uses WebView with JS, uncomment the following
13
# and specify the fully qualified class name to the JavaScript interface
14
# class:
15
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
#   public *;
17
#}

+ 0 - 15
app/src/main/jniLibs/autolayout/src/androidTest/java/zhy/com/autolayout/ApplicationTest.java

@ -1,15 +0,0 @@
1
package zhy.com.autolayout;
2
3
import android.app.Application;
4
import android.test.ApplicationTestCase;
5
6
/**
7
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8
 */
9
public class ApplicationTest extends ApplicationTestCase<Application>
10
{
11
    public ApplicationTest()
12
    {
13
        super(Application.class);
14
    }
15
}

+ 0 - 10
app/src/main/jniLibs/autolayout/src/main/AndroidManifest.xml

@ -1,10 +0,0 @@
1
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
          package="com.zhy.autolayout">
3
4
    <application android:allowBackup="true"
5
                 android:label="@string/app_name"
6
        >
7
8
    </application>
9
10
</manifest>

+ 0 - 115
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoFrameLayout.java

@ -1,115 +0,0 @@
1
/*
2
 * Copyright (C) 2015 The Android Open Source Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package com.zhy.autolayout;
18
19
import android.content.Context;
20
import android.content.res.TypedArray;
21
import android.util.AttributeSet;
22
import android.view.ViewGroup;
23
import android.widget.FrameLayout;
24
25
public class AutoFrameLayout extends FrameLayout
26
{
27
    private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
28
29
    public AutoFrameLayout(Context context)
30
    {
31
        super(context);
32
    }
33
34
    public AutoFrameLayout(Context context, AttributeSet attrs)
35
    {
36
        super(context, attrs);
37
    }
38
39
    public AutoFrameLayout(Context context, AttributeSet attrs, int defStyleAttr)
40
    {
41
        super(context, attrs, defStyleAttr);
42
    }
43
44
    @Override
45
    public LayoutParams generateLayoutParams(AttributeSet attrs)
46
    {
47
        return new LayoutParams(getContext(), attrs);
48
    }
49
50
    @Override
51
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
52
    {
53
        if (!isInEditMode())
54
            mHelper.adjustChildren();
55
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
56
    }
57
58
    @Override
59
    protected void onLayout(boolean changed, int left, int top, int right, int bottom)
60
    {
61
        super.onLayout(changed, left, top, right, bottom);
62
    }
63
64
    public static class LayoutParams extends FrameLayout.LayoutParams
65
            implements AutoLayoutHelper.AutoLayoutParams
66
    {
67
        private AutoLayoutHelper.AutoLayoutInfo mAutoLayoutInfo;
68
69
        public LayoutParams(Context c, AttributeSet attrs)
70
        {
71
            super(c, attrs);
72
            mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs);
73
        }
74
75
        public LayoutParams(int width, int height)
76
        {
77
            super(width, height);
78
        }
79
80
        public LayoutParams(int width, int height, int gravity)
81
        {
82
            super(width, height, gravity);
83
        }
84
85
        public LayoutParams(ViewGroup.LayoutParams source)
86
        {
87
            super(source);
88
        }
89
90
        public LayoutParams(MarginLayoutParams source)
91
        {
92
            super(source);
93
        }
94
95
        public LayoutParams(FrameLayout.LayoutParams source)
96
        {
97
            super((MarginLayoutParams) source);
98
            gravity = source.gravity;
99
        }
100
101
        public LayoutParams(LayoutParams source)
102
        {
103
            this((FrameLayout.LayoutParams) source);
104
            mAutoLayoutInfo = source.mAutoLayoutInfo;
105
        }
106
107
        @Override
108
        public AutoLayoutHelper.AutoLayoutInfo getPercentLayoutInfo()
109
        {
110
            return mAutoLayoutInfo;
111
        }
112
113
114
    }
115
}

+ 0 - 175
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayout.java

@ -1,175 +0,0 @@
1
package com.zhy.autolayout;
2
3
import android.app.Activity;
4
import android.content.Context;
5
import android.content.pm.ApplicationInfo;
6
import android.content.pm.PackageManager;
7
import android.content.res.Resources;
8
import android.content.res.TypedArray;
9
import android.os.Build;
10
import android.util.DisplayMetrics;
11
import android.view.ViewGroup;
12
import android.view.Window;
13
import android.view.WindowManager;
14
15
/**
16
 * Created by zhy on 15/11/18.
17
 */
18
public class AutoLayout
19
{
20
    private boolean mStatusBarAvailable;
21
    private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
22
23
24
    DisplayMetrics outMetrics = new DisplayMetrics();
25
26
    private int mAvailableWidth;
27
    private int mAvailaleHegiht;
28
29
30
    private static final String KEY_DESIGN_WIDTH = "design_width";
31
    private static final String KEY_DESIGN_HEIGHT = "design_height";
32
33
    private int mDesignWidth;
34
    private int mDesignHeight;
35
36
37
    public int getAvailableWidth()
38
    {
39
        return mAvailableWidth;
40
    }
41
42
    public int getAvailaleHeight()
43
    {
44
        return mAvailaleHegiht;
45
    }
46
47
    public int getDesignWidth()
48
    {
49
        return mDesignWidth;
50
    }
51
52
    public int getDesignHeight()
53
    {
54
        return mDesignHeight;
55
    }
56
57
    public void auto(Activity activity)
58
    {
59
        auto(activity, true);
60
    }
61
62
63
    public void auto(Activity activity, boolean ignoreStatusBar)
64
    {
65
        getMetaData(activity);
66
67
        WindowManager wm = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
68
        wm.getDefaultDisplay().getMetrics(outMetrics);
69
        mAvailableWidth = outMetrics.widthPixels;
70
        mAvailaleHegiht = outMetrics.heightPixels;
71
        mAvailaleHegiht -= getStatusHeight(activity.getResources());
72
73
74
        if (ignoreStatusBar)
75
            return;
76
77
        checkStatusBar(activity);
78
79
        if (mStatusBarAvailable)
80
        {
81
            mAvailaleHegiht += getStatusHeight(activity.getResources());
82
        }
83
84
        L.e("mAvailableWidth =" + mAvailableWidth + " , mAvailaleHegiht = " + mAvailaleHegiht);
85
    }
86
87
    private void getMetaData(Context context)
88
    {
89
        if (mDesignWidth > 0 && mDesignHeight > 0) return;
90
        PackageManager packageManager = context.getPackageManager();
91
        ApplicationInfo applicationInfo;
92
        try
93
        {
94
            applicationInfo = packageManager.getApplicationInfo(context
95
                    .getPackageName(), PackageManager.GET_META_DATA);
96
            if (applicationInfo != null && applicationInfo.metaData != null)
97
            {
98
                mDesignWidth = (int) applicationInfo.metaData.get(KEY_DESIGN_WIDTH);
99
                mDesignHeight = (int) applicationInfo.metaData.get(KEY_DESIGN_HEIGHT);
100
            }
101
        } catch (PackageManager.NameNotFoundException e)
102
        {
103
            throw new RuntimeException(
104
                    "you must set " + KEY_DESIGN_WIDTH + " and " + KEY_DESIGN_HEIGHT + "  in your manifest file.", e);
105
        }
106
107
        L.e("mDesignWidth =" + mDesignWidth + " , mDesignHeight = " + mDesignHeight);
108
    }
109
110
    private void checkStatusBar(Activity activity)
111
    {
112
        Window win = activity.getWindow();
113
        ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
114
115
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
116
        {
117
            // check theme attrs
118
            int[] attrs = {android.R.attr.windowTranslucentStatus,
119
                    android.R.attr.windowTranslucentNavigation};
120
            TypedArray a = activity.obtainStyledAttributes(attrs);
121
            try
122
            {
123
                mStatusBarAvailable = a.getBoolean(0, false);
124
            } finally
125
            {
126
                a.recycle();
127
            }
128
129
            // check window flags
130
            WindowManager.LayoutParams winParams = win.getAttributes();
131
            int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
132
            if ((winParams.flags & bits) != 0)
133
            {
134
                mStatusBarAvailable = true;
135
            }
136
137
        }
138
    }
139
140
141
    private int getStatusHeight(Resources res)
142
    {
143
        int result = 0;
144
        int resourceId = res.getIdentifier(STATUS_BAR_HEIGHT_RES_NAME, "dimen", "android");
145
        if (resourceId > 0)
146
        {
147
            result = res.getDimensionPixelSize(resourceId);
148
        }
149
        return result;
150
    }
151
152
153
    private AutoLayout()
154
    {
155
    }
156
157
    private static volatile AutoLayout sInstance;
158
159
    public static AutoLayout getInstance()
160
    {
161
        if (sInstance == null)
162
        {
163
            synchronized (AutoLayout.class)
164
            {
165
                if (sInstance == null)
166
                {
167
                    sInstance = new AutoLayout();
168
                }
169
            }
170
        }
171
        return sInstance;
172
    }
173
174
175
}

+ 0 - 46
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayoutActivity.java

@ -1,46 +0,0 @@
1
package com.zhy.autolayout;
2
3
import android.content.Context;
4
import android.support.v7.app.AppCompatActivity;
5
import android.util.AttributeSet;
6
import android.view.View;
7
8
;
9
10
/**
11
 * Created by zhy on 15/11/19.
12
 */
13
public class AutoLayoutActivity extends AppCompatActivity
14
{
15
    private static final String LAYOUT_LINEARLAYOUT = "LinearLayout";
16
    private static final String LAYOUT_FRAMELAYOUT = "FrameLayout";
17
    private static final String LAYOUT_RELATIVELAYOUT = "RelativeLayout";
18
19
    @Override
20
    public View onCreateView(String name, Context context, AttributeSet attrs)
21
    {
22
        View view = null;
23
        if (name.equals(LAYOUT_FRAMELAYOUT))
24
        {
25
            view = new AutoFrameLayout(context, attrs);
26
        }
27
28
        if (name.equals(LAYOUT_LINEARLAYOUT))
29
        {
30
            view = new AutoLinearLayout(context, attrs);
31
        }
32
33
        if (name.equals(LAYOUT_RELATIVELAYOUT))
34
        {
35
            view = new AutoRelativeLayout(context, attrs);
36
        }
37
38
        if (view != null) return view;
39
40
        return super.onCreateView(name, context, attrs);
41
    }
42
43
44
45
46
}

+ 0 - 365
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLayoutHelper.java

@ -1,365 +0,0 @@
1
/*
2
 * Copyright (C) 2015 The Android Open Source Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package com.zhy.autolayout;
18
19
import android.content.Context;
20
import android.content.res.TypedArray;
21
import android.util.AttributeSet;
22
import android.util.TypedValue;
23
import android.view.View;
24
import android.view.ViewGroup;
25
import android.widget.TextView;
26
27
public class AutoLayoutHelper
28
{
29
    private final ViewGroup mHost;
30
31
    private static final int[] LL = new int[]
32
            { //
33
                    android.R.attr.textSize,
34
                    android.R.attr.padding,//
35
                    android.R.attr.paddingLeft,//
36
                    android.R.attr.paddingTop,//
37
                    android.R.attr.paddingRight,//
38
                    android.R.attr.paddingBottom,//
39
                    android.R.attr.layout_width,//
40
                    android.R.attr.layout_height,//
41
                    android.R.attr.layout_margin,//
42
                    android.R.attr.layout_marginLeft,//
43
                    android.R.attr.layout_marginTop,//
44
                    android.R.attr.layout_marginRight,//
45
                    android.R.attr.layout_marginBottom,//
46
47
            };
48
49
    private static final int INDEX_TEXT_SIZE = 0;
50
    private static final int INDEX_PADDING = 1;
51
    private static final int INDEX_PADDING_LEFT = 2;
52
    private static final int INDEX_PADDING_TOP = 3;
53
    private static final int INDEX_PADDING_RIGHT = 4;
54
    private static final int INDEX_PADDING_BOTTOM = 5;
55
    private static final int INDEX_WIDTH = 6;
56
    private static final int INDEX_HEIGHT = 7;
57
    private static final int INDEX_MARGIN = 8;
58
    private static final int INDEX_MARGIN_LEFT = 9;
59
    private static final int INDEX_MARGIN_TOP = 10;
60
    private static final int INDEX_MARGIN_RIGHT = 11;
61
    private static final int INDEX_MARGIN_BOTTOM = 12;
62
63
    private static final String VAL_WRAP_CONTENT = "-2";
64
    private static final String VAL_MATCH_PARENT = "-1";
65
66
67
    public AutoLayoutHelper(ViewGroup host)
68
    {
69
        mHost = host;
70
71
    }
72
73
74
    public void adjustChildren()
75
    {
76
        for (int i = 0, n = mHost.getChildCount(); i < n; i++)
77
        {
78
            View view = mHost.getChildAt(i);
79
            ViewGroup.LayoutParams params = view.getLayoutParams();
80
81
            if (params instanceof AutoLayoutParams)
82
            {
83
                AutoLayoutInfo info =
84
                        ((AutoLayoutParams) params).getPercentLayoutInfo();
85
                if (info != null)
86
                {
87
                    supportTextSize(view, info);
88
89
                    supportPadding(view, info);
90
91
                    if (params instanceof ViewGroup.MarginLayoutParams)
92
                    {
93
                        info.fillMarginLayoutParams((ViewGroup.MarginLayoutParams) params,
94
                                getAvailableWidth(), getAvailaleHegiht(), getDesignWidth(), getDesignHeight());
95
                    } else
96
                    {
97
                        info.fillLayoutParams(params,
98
                                getAvailableWidth(), getAvailaleHegiht(), getDesignWidth(), getDesignHeight());
99
                    }
100
                }
101
            }
102
        }
103
104
105
    }
106
107
    private void supportPadding(View view, AutoLayoutInfo info)
108
    {
109
110
        int mAvailableWidth = getAvailableWidth();
111
        int mAvailaleHegiht = getAvailaleHegiht();
112
        int mDesignWidth = getDesignWidth();
113
        int mDesignHeight = getDesignHeight();
114
115
        int left = view.getPaddingLeft(), right = view.getPaddingRight(), top = view.getPaddingTop(), bottom = view.getPaddingBottom();
116
117
        if (info.padding != 0)
118
        {
119
            int vertical = (int) (info.padding * 1.0f / mDesignHeight * mAvailaleHegiht);
120
            int horizon = (int) (info.padding * 1.0f / mDesignWidth * mAvailableWidth);
121
            left = right = horizon;
122
            top = bottom = vertical;
123
        }
124
        if (info.paddingLeft != 0)
125
        {
126
            left = (int) (info.paddingLeft * 1.0f / mDesignWidth * mAvailableWidth);
127
        }
128
129
        if (info.paddingTop != 0)
130
        {
131
            top = (int) (info.paddingTop * 1.0f / mDesignHeight * mAvailaleHegiht);
132
        }
133
134
        if (info.paddingRight != 0)
135
        {
136
            right = (int) (info.paddingRight * 1.0f / mDesignWidth * mAvailableWidth);
137
        }
138
139
        if (info.paddingBottom != 0)
140
        {
141
            bottom = (int) (info.paddingBottom * 1.0f / mDesignHeight * mAvailaleHegiht);
142
        }
143
144
        view.setPadding(left, top, right, bottom);
145
    }
146
147
    private int getAvailableWidth()
148
    {
149
        return AutoLayout.getInstance().getAvailableWidth();
150
    }
151
152
    private int getAvailaleHegiht()
153
    {
154
        return AutoLayout.getInstance().getAvailaleHeight();
155
156
    }
157
158
    private int getDesignWidth()
159
    {
160
        return AutoLayout.getInstance().getDesignWidth();
161
    }
162
163
    private int getDesignHeight()
164
    {
165
        return AutoLayout.getInstance().getDesignHeight();
166
    }
167
168
169
    private void supportTextSize(View view, AutoLayoutInfo info)
170
    {
171
        if (!(view instanceof TextView)) return;
172
        if (info.textSize == 0) return;
173
174
        boolean textSizeBaseWidth = info.textSizeBaseWidth;
175
        float textSize;
176
        if (textSizeBaseWidth)
177
        {
178
            textSize = info.textSize * 1.0f / getDesignWidth() * getAvailableWidth();
179
        } else
180
        {
181
            textSize = info.textSize * 1.0f / getDesignHeight() * getAvailaleHegiht();
182
        }
183
        //textSize = textSize / 1.34f;
184
185
        ((TextView) view).setIncludeFontPadding(false);
186
        ((TextView) view).setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
187
    }
188
189
190
    public static AutoLayoutInfo getAutoLayoutInfo(Context context,
191
                                                   AttributeSet attrs)
192
    {
193
        AutoLayoutInfo info = new AutoLayoutInfo();
194
195
        boolean isTextSizeBaseWidth = isTextSizeBaseWidth(context, attrs);
196
        info.textSizeBaseWidth = isTextSizeBaseWidth;
197
198
        TypedArray array = context.obtainStyledAttributes(attrs, LL);
199
200
        int n = array.getIndexCount();
201
202
203
        for (int i = 0; i < n; i++)
204
        {
205
            int index = array.getIndex(i);
206
            String val = array.getString(index);
207
            L.e(val);
208
            if (val.equals(VAL_WRAP_CONTENT) || val.equals(VAL_MATCH_PARENT))
209
            {
210
                continue;
211
            }
212
            if (!val.endsWith("px"))
213
            {
214
                continue;
215
            }
216
            switch (index)
217
            {
218
                case INDEX_TEXT_SIZE:
219
                    info.textSize = array.getDimensionPixelOffset(index, 0);
220
                    break;
221
                case INDEX_PADDING:
222
                    info.padding = array.getDimensionPixelOffset(index, 0);
223
                    break;
224
                case INDEX_PADDING_LEFT:
225
                    info.paddingLeft = array.getDimensionPixelOffset(index, 0);
226
                    break;
227
                case INDEX_PADDING_TOP:
228
                    info.paddingTop = array.getDimensionPixelOffset(index, 0);
229
                    break;
230
                case INDEX_PADDING_RIGHT:
231
                    info.paddingRight = array.getDimensionPixelOffset(index, 0);
232
                    break;
233
                case INDEX_PADDING_BOTTOM:
234
                    info.paddingBottom = array.getDimensionPixelOffset(index, 0);
235
                    break;
236
                case INDEX_WIDTH:
237
                    info.widthPx = array.getDimensionPixelSize(index, 0);
238
                    break;
239
                case INDEX_HEIGHT:
240
                    info.heightPx = array.getDimensionPixelSize(index, 0);
241
                    break;
242
                case INDEX_MARGIN:
243
                    info.margin = array.getDimensionPixelOffset(index, 0);
244
                    break;
245
                case INDEX_MARGIN_LEFT:
246
                    info.marginLeft = array.getDimensionPixelOffset(index, 0);
247
                    break;
248
                case INDEX_MARGIN_TOP:
249
                    info.marginTop = array.getDimensionPixelOffset(index, 0);
250
                    break;
251
                case INDEX_MARGIN_RIGHT:
252
                    info.marginRight = array.getDimensionPixelOffset(index, 0);
253
                    break;
254
                case INDEX_MARGIN_BOTTOM:
255
                    info.marginBottom = array.getDimensionPixelOffset(index, 0);
256
                    break;
257
            }
258
        }
259
        array.recycle();
260
        L.e(info.toString());
261
        return info;
262
    }
263
264
    private static boolean isTextSizeBaseWidth(Context context, AttributeSet attrs)
265
    {
266
        TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.AutoLayout_Layout);
267
        boolean res = array.getBoolean(R.styleable.AutoLayout_Layout_layout_auto_textSizeBaseWidth, false);
268
        array.recycle();
269
        return res;
270
    }
271
272
273
    public static class AutoLayoutInfo
274
    {
275
        public int widthPx;
276
        public int heightPx;
277
278
        private int margin;
279
        private int marginLeft;
280
        private int marginRight;
281
        private int marginTop;
282
        private int marginBottom;
283
284
        private int textSize;
285
286
        private int padding;
287
        private int paddingLeft;
288
        private int paddingRight;
289
        private int paddingTop;
290
        private int paddingBottom;
291
292
        private boolean textSizeBaseWidth;
293
294
295
        public void fillLayoutParams(ViewGroup.LayoutParams params, int avaWidth,
296
                                     int avaHeight, int designWidth, int designHeight)
297
        {
298
299
300
            if (widthPx != 0)
301
            {
302
                params.width = (int) (widthPx * 1.0f / designWidth * avaWidth);
303
            }
304
            if (heightPx != 0)
305
            {
306
                params.height = (int) (heightPx * 1.0f / designHeight * avaHeight);
307
            }
308
        }
309
310
        @Override
311
        public String toString()
312
        {
313
            return "AutoLayoutInfo{" +
314
                    "widthPx=" + widthPx +
315
                    ", heightPx=" + heightPx +
316
                    ", margin=" + margin +
317
                    ", marginLeft=" + marginLeft +
318
                    ", marginRight=" + marginRight +
319
                    ", marginTop=" + marginTop +
320
                    ", marginBottom=" + marginBottom +
321
                    ", textSize=" + textSize +
322
                    ", padding=" + padding +
323
                    ", paddingLeft=" + paddingLeft +
324
                    ", paddingRight=" + paddingRight +
325
                    ", paddingTop=" + paddingTop +
326
                    ", paddingBottom=" + paddingBottom +
327
                    '}';
328
        }
329
330
        public void fillMarginLayoutParams(ViewGroup.MarginLayoutParams params, int avaWidth,
331
                                           int avaHeight, int designWidth, int designHeight)
332
        {
333
334
            if (margin != 0)
335
            {
336
                int marginSize = (int) (margin * 1.0f / designHeight * avaHeight);
337
                params.leftMargin = params.topMargin = params.rightMargin = params.bottomMargin = marginSize;
338
            }
339
            if (marginLeft != 0)
340
            {
341
                params.leftMargin = (int) (marginLeft * 1.0f / designWidth * avaWidth);
342
            }
343
            if (marginTop != 0)
344
            {
345
                params.topMargin = (int) (marginTop * 1.0f / designHeight * avaHeight);
346
            }
347
            if (marginRight != 0)
348
            {
349
                params.rightMargin = (int) (marginRight * 1.0f / designWidth * avaWidth);
350
            }
351
            if (marginBottom != 0)
352
            {
353
                params.bottomMargin = (int) (marginBottom * 1.0f / designHeight * avaHeight);
354
            }
355
            fillLayoutParams(params, avaWidth, avaHeight, designWidth, designHeight);
356
        }
357
358
359
    }
360
361
    public interface AutoLayoutParams
362
    {
363
        AutoLayoutInfo getPercentLayoutInfo();
364
    }
365
}

+ 0 - 82
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoLinearLayout.java

@ -1,82 +0,0 @@
1
package com.zhy.autolayout;
2
3
import android.content.Context;
4
import android.util.AttributeSet;
5
import android.view.ViewGroup;
6
import android.widget.LinearLayout;
7
8
/**
9
 * Created by zhy on 15/6/30.
10
 */
11
public class AutoLinearLayout extends LinearLayout
12
{
13
14
    private AutoLayoutHelper mPercentLayoutHelper;
15
16
    public AutoLinearLayout(Context context, AttributeSet attrs)
17
    {
18
        super(context, attrs);
19
        mPercentLayoutHelper = new AutoLayoutHelper(this);
20
    }
21
22
23
    @Override
24
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
25
    {
26
        if (!isInEditMode())
27
            mPercentLayoutHelper.adjustChildren();
28
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
29
    }
30
31
32
    @Override
33
    protected void onLayout(boolean changed, int l, int t, int r, int b)
34
    {
35
        super.onLayout(changed, l, t, r, b);
36
    }
37
38
39
    @Override
40
    public LayoutParams generateLayoutParams(AttributeSet attrs)
41
    {
42
        return new AutoLinearLayout.LayoutParams(getContext(), attrs);
43
    }
44
45
46
    public static class LayoutParams extends LinearLayout.LayoutParams
47
            implements AutoLayoutHelper.AutoLayoutParams
48
    {
49
        private AutoLayoutHelper.AutoLayoutInfo mAutoLayoutInfo;
50
51
        public LayoutParams(Context c, AttributeSet attrs)
52
        {
53
            super(c, attrs);
54
            mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs);
55
        }
56
57
        @Override
58
        public AutoLayoutHelper.AutoLayoutInfo getPercentLayoutInfo()
59
        {
60
            return mAutoLayoutInfo;
61
        }
62
63
64
        public LayoutParams(int width, int height)
65
        {
66
            super(width, height);
67
        }
68
69
70
        public LayoutParams(ViewGroup.LayoutParams source)
71
        {
72
            super(source);
73
        }
74
75
        public LayoutParams(MarginLayoutParams source)
76
        {
77
            super(source);
78
        }
79
80
    }
81
82
}

+ 0 - 100
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/AutoRelativeLayout.java

@ -1,100 +0,0 @@
1
/*
2
 * Copyright (C) 2015 The Android Open Source Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package com.zhy.autolayout;
18
19
import android.content.Context;
20
import android.content.res.TypedArray;
21
import android.util.AttributeSet;
22
import android.view.ViewGroup;
23
import android.widget.RelativeLayout;
24
25
public class AutoRelativeLayout extends RelativeLayout
26
{
27
    private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this);
28
29
    public AutoRelativeLayout(Context context)
30
    {
31
        super(context);
32
    }
33
34
    public AutoRelativeLayout(Context context, AttributeSet attrs)
35
    {
36
        super(context, attrs);
37
    }
38
39
    public AutoRelativeLayout(Context context, AttributeSet attrs, int defStyle)
40
    {
41
        super(context, attrs, defStyle);
42
    }
43
44
    @Override
45
    public LayoutParams generateLayoutParams(AttributeSet attrs)
46
    {
47
        return new LayoutParams(getContext(), attrs);
48
    }
49
50
51
52
    @Override
53
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
54
    {
55
        if (!isInEditMode())
56
            mHelper.adjustChildren();
57
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
58
    }
59
60
    @Override
61
    protected void onLayout(boolean changed, int left, int top, int right, int bottom)
62
    {
63
        super.onLayout(changed, left, top, right, bottom);
64
    }
65
66
    public static class LayoutParams extends RelativeLayout.LayoutParams
67
            implements AutoLayoutHelper.AutoLayoutParams
68
    {
69
        private AutoLayoutHelper.AutoLayoutInfo mAutoLayoutInfo;
70
71
        public LayoutParams(Context c, AttributeSet attrs)
72
        {
73
            super(c, attrs);
74
            mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo(c, attrs);
75
        }
76
77
        public LayoutParams(int width, int height)
78
        {
79
            super(width, height);
80
        }
81
82
        public LayoutParams(ViewGroup.LayoutParams source)
83
        {
84
            super(source);
85
        }
86
87
        public LayoutParams(MarginLayoutParams source)
88
        {
89
            super(source);
90
        }
91
92
        @Override
93
        public AutoLayoutHelper.AutoLayoutInfo getPercentLayoutInfo()
94
        {
95
            return mAutoLayoutInfo;
96
        }
97
98
99
    }
100
}

+ 0 - 22
app/src/main/jniLibs/autolayout/src/main/java/com/zhy/autolayout/L.java

@ -1,22 +0,0 @@
1
package com.zhy.autolayout;
2
3
import android.util.Log;
4
5
/**
6
 * Created by zhy on 15/11/18.
7
 */
8
public class L
9
{
10
    public static boolean debug = false;
11
    private static final String TAG = "AUTO_LAYOUT";
12
13
    public static void e(String msg)
14
    {
15
        if (debug)
16
        {
17
            Log.e(TAG, msg);
18
        }
19
    }
20
21
22
}

+ 0 - 6
app/src/main/jniLibs/autolayout/src/main/res/values/attrs.xml

@ -1,6 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
    <declare-styleable name="AutoLayout_Layout">
4
        <attr name="layout_auto_textSizeBaseWidth" format="boolean"/>
5
    </declare-styleable>
6
</resources>

+ 0 - 3
app/src/main/jniLibs/autolayout/src/main/res/values/strings.xml

@ -1,3 +0,0 @@
1
<resources>
2
    <string name="app_name">autolayout</string>
3
</resources>

BIN
app/src/main/jniLibs/bugly_1.2.3.8__release.jar


BIN
app/src/main/jniLibs/mframework.jar