7"> 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


modify user avatar · 0b7c0f62ae - Gogs: Go Git Service
ソースを参照

modify user avatar

dxh 7 年 前
コミット
0b7c0f62ae

+ 19 - 4
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

@ -56,7 +56,7 @@ public class SvVideoShowView implements View.OnClickListener {
56 56
            sv_show_comment_ll;
57 57
    private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
58 58
            sv_show_user_name, sv_show_user_time, sv_show_topic_con, vd_title_tv;
59
    private ImageView sv_show_like_img, sv_show_user_avatar;
59
    private ImageView sv_show_like_img, sv_show_user_avatar,playIcon;
60 60
61 61
    private View sv_show_tvcon_more;
62 62
@ -137,8 +137,9 @@ public class SvVideoShowView implements View.OnClickListener {
137 137
        sv_show_comment_count_tv.setText(talkRecommendBean.commentNums + "");
138 138
        sv_show_like_tv.setText(talkRecommendBean.likeNums + "");
139 139
        sv_show_tvcon.setText(talkRecommendBean.content);
140
        sv_show_tvcon.setText(talkRecommendBean.title);
140 141
        sv_show_user_name.setText(talkRecommendBean.nickName);
141
        String time = TimeUtil.getTimeFormatText(talkRecommendBean.addTime);
142
        String time = ""+talkRecommendBean.addTime;
142 143
        sv_show_user_time.setText(time);
143 144
        sv_show_topic_con.setText(talkRecommendBean.topicName);
144 145
@ -151,7 +152,7 @@ public class SvVideoShowView implements View.OnClickListener {
151 152
                    .into(sv_show_user_avatar);
152 153
        } else {
153 154
            Picasso.with(activity)
154
                    .load("http://cdz.evcharge.cc/zhannew/uploadfile/"+talkRecommendBean.headImgUrl)
155
                    .load("http://cdz.evcharge.cc/zhannew/uploadfile/" + talkRecommendBean.headImgUrl)
155 156
                    .placeholder(R.drawable.icon_face2_0)
156 157
                    .error(R.drawable.icon_face2_0)
157 158
                    .transform(new CircleTransform())
@ -165,7 +166,7 @@ public class SvVideoShowView implements View.OnClickListener {
165 166
            // sv_show_like_img  not like
166 167
        }
167 168
168
        if (sv_show_tvcon.getLineCount() >= 3) {
169
        if (sv_show_tvcon.getLineCount() > 3) {
169 170
            sv_show_tvcon_more.setVisibility(View.VISIBLE);
170 171
        } else {
171 172
            sv_show_tvcon_more.setVisibility(View.GONE);
@ -246,7 +247,21 @@ public class SvVideoShowView implements View.OnClickListener {
246 247
    }
247 248
248 249
    private void initPlayer(View view) {
250
        playIcon = view.findViewById(R.id.view_show_icon);
249 251
        upVideoView2 = view.findViewById(R.id.view_show_video);
252
        upVideoView2.setOnClickListener(new View.OnClickListener() {
253
            @Override
254
            public void onClick(View view) {
255
                boolean playing = upVideoView2.isPlaying();
256
                if (playing) {
257
                    upVideoView2.pause();
258
                    playIcon.setVisibility(View.VISIBLE);
259
                } else {
260
                    playIcon.setVisibility(View.GONE);
261
                    upVideoView2.start();
262
                }
263
            }
264
        });
250 265
    }
251 266
252 267
    ZoomingViewpager zoomingViewpager;

+ 1 - 1
app/src/main/java/com/electric/chargingpile/view/VideoPubilshDialog.java

@ -51,7 +51,7 @@ public class VideoPubilshDialog extends Dialog implements View.OnClickListener {
51 51
        videoPublishClose.setOnClickListener(this);
52 52
53 53
54
        videoPublishTopicCon.setText(talkRecommendBean.title);
54
        videoPublishTopicCon.setText(talkRecommendBean.topicName);
55 55
        videoPublishCon.setText(talkRecommendBean.title);
56 56
57 57
        if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {

+ 1 - 0
app/src/main/res/layout/view_show_bottom.xml

@ -122,6 +122,7 @@
122 122
        android:layout_marginLeft="39dp"
123 123
        android:layout_marginRight="39dp"
124 124
        android:layout_marginBottom="23dp"
125
        android:textColor="#E2E2E2"
125 126
        android:ellipsize="end"
126 127
        android:maxLines="3"
127 128
        android:textSize="14sp" />

+ 8 - 0
app/src/main/res/layout/view_show_view.xml

@ -12,6 +12,14 @@
12 12
        android:layout_width="match_parent"
13 13
        android:layout_height="match_parent" />
14 14
15
    <ImageView
16
        android:id="@+id/view_show_icon"
17
        android:layout_width="40dp"
18
        android:layout_height="40dp"
19
        android:visibility="gone"
20
        android:layout_centerInParent="true"
21
        android:background="@drawable/app_talk_video_icon"/>
22
15 23
    <include layout="@layout/view_show_bottom" />
16 24
17 25
</RelativeLayout>

+ 1 - 0
app/src/main/res/layout/view_show_zoom.xml

@ -6,6 +6,7 @@
6 6
7 7
    <com.electric.chargingpile.widge.photoview.ZoomingViewpager
8 8
        android:id="@+id/view_show_zoomingphoto"
9
        android:layout_marginTop="48dp"
9 10
        android:layout_width="match_parent"
10 11
        android:layout_height="match_parent" />
11 12