a"> talkRecommendBean = null; 182
                chatRecommendBean = null;
168 183
                break;
169
            case R.id.item_choose_video:
184
            case R.id.item_choose_video: // 选择视频事件
170 185
                PictureSelector.create(this)
171 186
                        .openGallery(PictureMimeType.ofVideo())// 全部.PictureMimeType.ofAll()、图片.ofImage()、app_talk_video_icon.ofVideo()
172 187
                        .theme(R.style.picture_default_style)// 主题样式设置 具体参考 libray中values/styles
@ -192,7 +207,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
192 207
                        .recordVideoSecond(15)//录制视频秒数 默认60秒
193 208
                        .forResult(PictureConfig.CHOOSE_REQUEST);
194 209
                break;
195
            case R.id.item_video_delete:
210
            case R.id.item_video_delete: // 删除视频事件
196 211
                mItemVideoLl.setVisibility(View.GONE);
197 212
                mPublishtopicGv.setVisibility(View.VISIBLE);
198 213
                media = null;
@ -294,7 +309,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
294 309
        Map<String, String> map = new HashMap<>();
295 310
        map.put("content", mPublishtopicCon.getText().toString());
296 311
        map.put("urls", urls);
297
        map.put("topicId", talkRecommendBean.targetId + "");
312
        map.put("topicId", chatRecommendBean.targetId + "");
298 313
        map.put("targetType", "23");
299 314
        map.put("coverImgW", media.getWidth() + "");
300 315
        map.put("coverImgH", media.getHeight() + "");
@ -330,16 +345,16 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
330 345
331 346
    final int reqTopic = 100;
332 347
333
    TalkRecommendBean talkRecommendBean = null;
348
    TalkRecommendBean chatRecommendBean = null;
334 349
335 350
    @Override
336 351
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
337 352
        super.onActivityResult(requestCode, resultCode, data);
338 353
339 354
        if (requestCode == reqTopic && resultCode == -100) {
340
            talkRecommendBean = (TalkRecommendBean) data.getSerializableExtra("topic");
341
            if (talkRecommendBean != null) {
342
                mPublishtopicChooseTopic.setText("# " + talkRecommendBean.topicName);
355
            chatRecommendBean = (TalkRecommendBean) data.getSerializableExtra("topic");
356
            if (chatRecommendBean != null) {
357
                mPublishtopicChooseTopic.setText("# " + chatRecommendBean.topicName);
343 358
                mPublishTopicDe.setVisibility(View.VISIBLE);
344 359
            }
345 360
        } else if (requestCode == PictureConfig.CHOOSE_REQUEST && resultCode == RESULT_OK) {

BIN
app/src/main/res/drawable-hdpi/add_picture.png


BIN
app/src/main/res/drawable-hdpi/delete_picture.png


BIN
app/src/main/res/drawable-mdpi/add_picture.png


BIN
app/src/main/res/drawable-mdpi/delete_picture.png


BIN
app/src/main/res/drawable-xhdpi/add_picture.png


BIN
app/src/main/res/drawable-xhdpi/delete_picture.png


BIN
app/src/main/res/drawable-xxhdpi/add_picture.png


BIN
app/src/main/res/drawable-xxhdpi/delete_picture.png


BIN
app/src/main/res/drawable-xxxhdpi/add_picture.png


BIN
app/src/main/res/drawable-xxxhdpi/delete_picture.png


+ 59 - 63
app/src/main/res/layout/activity_publish_picture_content.xml

@ -2,17 +2,17 @@
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4 4
    android:layout_height="match_parent"
5
    android:background="@color/white"
5 6
    android:focusable="true"
6 7
    android:focusableInTouchMode="true"
7
    android:background="@color/white"
8
    android:orientation="vertical" >
8
    android:orientation="vertical">
9 9

10 10
    <RelativeLayout
11 11
        android:id="@+id/rl_title"
12 12
        android:layout_width="match_parent"
13 13
        android:layout_height="44dp"
14
        android:layout_alignParentLeft="true"
15 14
        android:layout_alignParentStart="true"
15
        android:layout_alignParentLeft="true"
16 16
        android:layout_alignParentTop="true"
17 17
        android:background="@color/white">
18 18

@ -26,122 +26,120 @@
26 26

27 27
        <ImageView
28 28
            android:id="@+id/iv_back"
29
            android:layout_width="18dp"
30
            android:layout_height="18dp"
29
            android:layout_width="44dp"
30
            android:layout_height="44dp"
31 31
            android:layout_alignParentLeft="true"
32 32
            android:layout_centerVertical="true"
33
            android:layout_marginLeft="12dp"
34 33
            android:contentDescription="@null"
34
            android:scaleType="centerInside"
35
            android:padding="13dp"
35 36
            android:src="@drawable/app_publish_back_icon" />
36 37

37 38
        <TextView
38 39
            android:id="@+id/tv_right"
39
            android:layout_width="wrap_content"
40
            android:layout_height="wrap_content"
41
            android:layout_alignParentRight="true"
42
            android:layout_marginRight="15dp"
43
            android:gravity="center"
44
            android:text="提交"
45
            android:textSize="16sp"
46
            android:textColor="@color/white"
47
            android:layout_centerVertical="true"
48
            android:paddingRight="9dp"
49
            android:paddingLeft="9dp"
50
            android:paddingTop="4dp"
51
            android:paddingBottom="4dp"
40
            android:layout_width="50dp"
41
            android:layout_height="25dp"
42
            android:layout_alignParentEnd="true"
43
            android:layout_centerHorizontal="true"
44
            android:layout_marginTop="@dimen/ui_10_dip"
45
            android:layout_marginEnd="25dp"
46
            android:background="#9ed3ae"
52 47
            android:enabled="false"
53
            android:background="#9ed3ae"/>
48
            android:gravity="center"
49
            android:text="发布"
50
            android:textColor="#fff"
51
            android:textSize="16sp" />
54 52

55 53
        <View
56 54
            android:layout_width="match_parent"
57
            android:layout_height="0.5dp"
58
            android:visibility="gone"
59
            android:background="@color/title_line"/>
55
            android:layout_height="1dp"
56
            android:layout_alignParentBottom="true"
57
            android:background="@color/ui_6d" />
58

60 59
    </RelativeLayout>
61
    
60

62 61
    <TextView
63 62
        android:id="@+id/tv_title"
64 63
        android:layout_width="wrap_content"
65 64
        android:layout_height="wrap_content"
66 65
        android:layout_below="@+id/rl_title"
67
        android:layout_marginTop="15dp"
68 66
        android:layout_marginLeft="15dp"
67
        android:layout_marginTop="15dp"
69 68
        android:text="描述问题(必填)"
70 69
        android:textColor="@color/ui_62"
71 70
        android:textSize="16sp"
72
        android:visibility="gone"/>
73
    
71
        android:visibility="gone" />
72

74 73
    <EditText
75 74
        android:id="@+id/et_context"
76 75
        android:layout_width="match_parent"
77 76
        android:layout_height="134dp"
78 77
        android:layout_below="@+id/tv_title"
79 78
        android:layout_marginTop="16dp"
79
        android:layout_marginBottom="14dp"
80
        android:background="@color/white"
81
        android:gravity="left"
82
        android:hint="聊聊你的想法......"
83
        android:lineSpacingExtra="4dp"
84
        android:maxEms="500"
80 85
        android:paddingLeft="15dp"
81 86
        android:paddingRight="15dp"
82
        android:maxEms="500"
83
        android:hint="聊聊你的想法......"
84
        android:textColorHint="@color/ui_68"
85
        android:textSize="14sp"
86 87
        android:textColor="@color/ui_65"
87
        android:layout_marginBottom="14dp"
88
        android:gravity="left"
89
        android:background="@color/white"
90
        android:lineSpacingExtra="4dp"/>
88
        android:textColorHint="@color/ui_68"
89
        android:textSize="14sp" />
91 90

92 91
    <GridView
93 92
        android:id="@+id/noScrollgridview"
94 93
        android:layout_width="match_parent"
95 94
        android:layout_height="wrap_content"
96 95
        android:layout_below="@+id/et_context"
97
        android:layout_marginBottom="50dp"
98 96
        android:layout_marginLeft="15dp"
99 97
        android:layout_marginRight="15dp"
98
        android:layout_marginBottom="50dp"
100 99
        android:numColumns="3"
101 100
        android:scrollbars="none"
102
        android:verticalSpacing="5dp" >
103
    </GridView>
101
        android:verticalSpacing="5dp"></GridView>
104 102

105 103
    <View
106 104
        android:layout_width="match_parent"
107 105
        android:layout_height="0.5dp"
108
        android:background="@color/Line"
109 106
        android:layout_below="@+id/noScrollgridview"
110
        android:visibility="gone"
111
        android:layout_marginTop="12dp"/>
107
        android:layout_marginTop="12dp"
108
        android:background="@color/Line"
109
        android:visibility="gone" />
112 110

113 111

114 112
    <ImageView
115 113
        android:id="@+id/tv_one"
116 114
        android:layout_width="wrap_content"
117 115
        android:layout_height="wrap_content"
116
        android:layout_alignParentBottom="true"
117
        android:layout_centerHorizontal="true"
118 118
        android:layout_gravity="center"
119
        android:layout_marginBottom="50dp"
120
        android:background="@drawable/icon_2point"
119 121
        android:gravity="center"
120 122
        android:padding="5dp"
121 123
        android:scaleType="fitXY"
122
        android:background="@drawable/icon_2point"
123 124
        android:textColor="#000000"
124
        android:visibility="gone"
125
        android:layout_marginBottom="50dp"
126
        android:layout_centerHorizontal="true"
127
        android:layout_alignParentBottom="true"/>
125
        android:visibility="gone" />
128 126

129 127

130 128
    <RelativeLayout
131 129
        android:id="@+id/rl_point"
132 130
        android:layout_width="80dp"
133 131
        android:layout_height="80dp"
134
        android:layout_marginBottom="50dp"
135
        android:layout_centerHorizontal="true"
136 132
        android:layout_alignParentBottom="true"
137
        android:visibility="gone"
138
        android:background="@drawable/icon_point_bg">
133
        android:layout_centerHorizontal="true"
134
        android:layout_marginBottom="50dp"
135
        android:background="@drawable/icon_point_bg"
136
        android:visibility="gone">
139 137

140 138
        <LinearLayout
141 139
            android:layout_width="wrap_content"
142 140
            android:layout_height="wrap_content"
143
            android:orientation="vertical"
144
            android:layout_centerInParent="true">
141
            android:layout_centerInParent="true"
142
            android:orientation="vertical">
145 143

146 144
            <LinearLayout
147 145
                android:layout_width="wrap_content"
@ -152,17 +150,17 @@
152 150
                    android:layout_width="wrap_content"
153 151
                    android:layout_height="wrap_content"
154 152
                    android:text="+"
155
                    android:textSize="16sp"
156
                    android:textColor="@color/white"/>
153
                    android:textColor="@color/white"
154
                    android:textSize="16sp" />
157 155

158 156
                <TextView
159 157
                    android:id="@+id/tv_point"
160 158
                    android:layout_width="wrap_content"
161 159
                    android:layout_height="wrap_content"
162
                    android:text="20"
163
                    android:textSize="19sp"
164 160
                    android:layout_marginLeft="2dp"
165
                    android:textColor="@color/white"/>
161
                    android:text="20"
162
                    android:textColor="@color/white"
163
                    android:textSize="19sp" />
166 164

167 165

168 166
            </LinearLayout>
@ -171,20 +169,18 @@
171 169
                android:layout_width="wrap_content"
172 170
                android:layout_height="wrap_content"
173 171
                android:layout_gravity="center_horizontal"
172
                android:layout_marginTop="2dp"
174 173
                android:text="充电币"
175
                android:textSize="13sp"
176 174
                android:textColor="@color/white"
177
                android:layout_marginTop="2dp"/>
175
                android:textSize="13sp" />
178 176

179 177

180 178
        </LinearLayout>
181 179

182 180

183

184 181
    </RelativeLayout>
185 182

186 183

187

188 184
    <LinearLayout
189 185
        android:layout_width="wrap_content"
190 186
        android:layout_height="30dp"
@ -233,14 +229,14 @@
233 229
        android:text="预览"
234 230
        android:textColor="#b2b2b2"
235 231
        android:textSize="14sp"
236
        android:visibility="invisible"/>
232
        android:visibility="invisible" />
237 233

238 234
    <TextView
239 235
        android:id="@+id/publishtopic_word_num"
240 236
        android:layout_width="wrap_content"
241 237
        android:layout_height="49dp"
242
        android:layout_toLeftOf="@+id/publishtopic_word"
243 238
        android:layout_alignParentBottom="true"
239
        android:layout_toLeftOf="@+id/publishtopic_word"
244 240
        android:gravity="center_vertical"
245 241
        android:text="0"
246 242
        android:textSize="14sp" />

+ 19 - 17
app/src/main/res/layout/activity_publishtopic.xml

@ -1,7 +1,8 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent">
4
    android:layout_height="match_parent"
5
    android:background="@color/white">
5 6
6 7
    <ImageView
7 8
        android:id="@+id/publishtopic_back"
@ -9,7 +10,7 @@
9 10
        android:layout_height="44dp"
10 11
        android:padding="13dp"
11 12
        android:rotation="90"
12
        android:src="@drawable/icon_edit_down" />
13
        android:src="@drawable/app_publish_back_icon" />
13 14
14 15
    <TextView
15 16
        android:layout_width="wrap_content"
@ -28,7 +29,8 @@
28 29
        android:layout_centerHorizontal="true"
29 30
        android:layout_marginTop="@dimen/ui_10_dip"
30 31
        android:layout_marginEnd="25dp"
31
        android:background="#02B637"
32
        android:background="#9ed3ae"
33
        android:enabled="false"
32 34
        android:gravity="center"
33 35
        android:text="发布"
34 36
        android:textColor="#fff"
@ -43,8 +45,8 @@
43 45
    <ScrollView
44 46
        android:layout_width="match_parent"
45 47
        android:layout_height="match_parent"
46
        android:layout_marginBottom="50dp"
47
        android:layout_below="@+id/publishtopic_back">
48
        android:layout_below="@+id/publishtopic_back"
49
        android:layout_marginBottom="50dp">
48 50
49 51
        <LinearLayout
50 52
            android:layout_width="match_parent"
@ -59,7 +61,7 @@
59 61
                android:background="@null"
60 62
                android:gravity="top"
61 63
                android:hint="聊聊你的想法......"
62
                android:minHeight="260dp"
64
                android:minHeight="135dp"
63 65
                android:textColorHint="#555555"
64 66
                android:textSize="14sp" />
65 67
@ -67,8 +69,9 @@
67 69
                android:id="@+id/item_choose_video"
68 70
                android:layout_width="108dp"
69 71
                android:layout_height="108dp"
70
                android:background="@drawable/icon_feedback_upload"
71
                android:scaleType="centerCrop" />
72
                android:background="#f5f5f5"
73
                android:scaleType="centerInside"
74
                android:src="@drawable/add_picture" />
72 75
73 76
            <RelativeLayout
74 77
                android:id="@+id/item_video_ll"
@ -79,10 +82,8 @@
79 82
80 83
                <ImageView
81 84
                    android:id="@+id/item_video"
82
                    android:layout_width="wrap_content"
83
                    android:layout_height="wrap_content"
84
                    android:minWidth="206dp"
85
                    android:minHeight="220dp" />
85
                    android:layout_width="match_parent"
86
                    android:layout_height="200dp" />
86 87
87 88
                <View
88 89
                    android:layout_width="40dp"
@ -96,7 +97,7 @@
96 97
                    android:layout_height="16dp"
97 98
                    android:layout_alignEnd="@+id/item_video"
98 99
                    android:layout_margin="12dp"
99
                    android:background="@drawable/icon_tuijian_close" />
100
                    android:background="@drawable/delete_picture" />
100 101
            </RelativeLayout>
101 102
        </LinearLayout>
102 103
    </ScrollView>
@ -145,20 +146,20 @@
145 146
        android:layout_marginStart="11dp"
146 147
        android:gravity="center_vertical"
147 148
        android:orientation="horizontal"
148
        android:visibility="gone"
149 149
        android:paddingStart="@dimen/ui_10_dip"
150 150
        android:paddingEnd="15dp"
151 151
        android:text="预览"
152 152
        android:textColor="#b2b2b2"
153
        android:textSize="14sp" />
153
        android:textSize="14sp"
154
        android:visibility="gone" />
154 155
155 156
    <TextView
156 157
        android:id="@+id/publishtopic_word_num"
157 158
        android:layout_width="wrap_content"
158 159
        android:layout_height="49dp"
159 160
        android:layout_alignParentEnd="true"
160
        android:layout_marginEnd="15dp"
161 161
        android:layout_alignParentBottom="true"
162
        android:layout_marginEnd="15dp"
162 163
        android:layout_toStartOf="@+id/publishtopic_choose_preview"
163 164
        android:gravity="center_vertical"
164 165
        android:text="0/500"
@ -169,5 +170,6 @@
169 170
        android:layout_width="match_parent"
170 171
        android:layout_height="1dp"
171 172
        android:layout_above="@+id/publishtopic_choose_preview"
172
        android:background="#ddd" />
173
        android:background="#ddd"
174
        android:visibility="gone" />
173 175
</RelativeLayout>

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

@ -8,6 +8,7 @@
8 8
        android:id="@+id/item_grida_image"
9 9
        android:layout_width="81dp"
10 10
        android:layout_height="81dp"
11
        android:background="#ff0000"
11 12
        android:scaleType="centerCrop">
12 13
    </ImageView>
13 14

+ 8 - 0
app/src/main/res/values-v19/style.xml

@ -0,0 +1,8 @@
1
<resources>
2
3
    <style name="ImageTranslucentTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4
        <item name="android:windowTranslucentStatus">true</item>
5
        <item name="android:windowTranslucentNavigation">true</item>
6
    </style>
7
8
</resources>

+ 9 - 0
app/src/main/res/values-v21/style.xml

@ -0,0 +1,9 @@
1
<resources>
2
3
    <style name="ImageTranslucentTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4
        <item name="android:windowTranslucentStatus">false</item>
5
        <item name="android:windowTranslucentNavigation">true</item>
6
        <!--Android 5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色-->
7
        <item name="android:statusBarColor">@android:color/transparent</item>
8
    </style>
9
</resources>

文件更新 · c28066b694 - Gogs: Go Git Service
huyuguo 6 vuotta sitten
vanhempi
commit
c28066b694

+ 35 - 33
app/src/main/java/com/electric/chargingpile/activity/ChargingCommentActivity.java

@ -53,7 +53,6 @@ import com.electric.chargingpile.data.RObject;
53 53
import com.electric.chargingpile.util.BarColorUtil;
54 54
import com.electric.chargingpile.util.Bimp;
55 55
import com.electric.chargingpile.util.DES3;
56
import com.electric.chargingpile.util.FileUtils;
57 56
import com.electric.chargingpile.util.ImageItem;
58 57
import com.electric.chargingpile.util.ImageUtils;
59 58
import com.electric.chargingpile.util.JsonUtils;
@ -69,10 +68,6 @@ import com.electric.chargingpile.view.HongBaoResultDialog;
69 68
import com.electric.chargingpile.view.REditText;
70 69
import com.electric.chargingpile.view.RatingBarView;
71 70
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
72
import com.zhihu.matisse.Matisse;
73
import com.zhihu.matisse.MimeType;
74
import com.zhihu.matisse.engine.impl.GlideEngine;
75
import com.zhihu.matisse.internal.entity.CaptureStrategy;
76 71
import com.zhy.http.okhttp.OkHttpUtils;
77 72
import com.zhy.http.okhttp.callback.StringCallback;
78 73
import com.zhy.view.flowlayout.FlowLayout;
@ -108,6 +103,7 @@ import io.reactivex.Observer;
108 103
import io.reactivex.android.schedulers.AndroidSchedulers;
109 104
import io.reactivex.disposables.Disposable;
110 105
import io.reactivex.schedulers.Schedulers;
106
import me.iwf.photopicker.PhotoPicker;
111 107
import okhttp3.Call;
112 108
import pub.devrel.easypermissions.AfterPermissionGranted;
113 109
import pub.devrel.easypermissions.EasyPermissions;
@ -159,7 +155,6 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
159 155
    private String isShow = "0";
160 156
    private HongBaoDialog hongBaoDialog;
161 157
    private static final int RC_ALBUM_PERM = 123;
162
    public static final int REQUEST_CODE_CHOOSE = 335;
163 158
    //输入表情前EditText中的文本
164 159
//    private String inputAfterText;
165 160
    Handler handler = new Handler() {
@ -558,15 +553,16 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
558 553
     * 调用图库选择
559 554
     */
560 555
    private void callGallery() {
561
        Matisse.from(ChargingCommentActivity.this)
562
                .choose(MimeType.of(MimeType.JPEG, MimeType.PNG, MimeType.GIF))
563
                .showSingleMediaType(true)
564
                .countable(true)
565
                .maxSelectable(PIC_NUM - Bimp.tempSelectBitmap.size())
566
                .capture(true)
567
                .captureStrategy(new CaptureStrategy(true, "com.electric.chargingpile.provider"))
568
                .imageEngine(new GlideEngine())
569
                .forResult(REQUEST_CODE_CHOOSE);
556
        Log.e(TAG, "callGallery: " + (Bimp.max - Bimp.tempSelectBitmap.size()));
557
        //调用第三方图库选择
558
        PhotoPicker.builder()
559
                .setPhotoCount(PIC_NUM - Bimp.tempSelectBitmap.size())//可选择图片数量
560
                .setShowCamera(true)//是否显示拍照按钮
561
                .setShowGif(true)//是否显示动态图
562
                .setPreviewEnabled(true)//是否可以预览
563
                .start(this, PhotoPicker.REQUEST_CODE);
564
565
570 566
    }
571 567
572 568
    @Override
@ -576,7 +572,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
576 572
            if (data != null) {
577 573
                if (requestCode == 1) {
578 574
                    //处理调用系统图库
579
                } else if (requestCode == REQUEST_CODE_CHOOSE) {
575
                } else if (requestCode == PhotoPicker.REQUEST_CODE) {
580 576
                    //异步方式插入图片
581 577
                    insertImagesSync(data);
582 578
                }
@ -596,17 +592,22 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
596 592
            public void subscribe(ObservableEmitter<String> subscriber) throws Exception {
597 593
598 594
                try {
599
                    List<Uri> uriList = Matisse.obtainResult(data);
600
                    for (Uri uri : uriList) {
601
                        Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
602
                        File file = FileUtils.from(ChargingCommentActivity.this, uri);
603
604
                        bitmap = FileUtils.rotateIfRequired(file, bitmap);
605
                        bitmap = imageZoom(bitmap);
595
                    ArrayList<String> photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
596
                    //可以同时插入多张图片
597
                    for (String imagePath : photos) {
598
599
                        Log.e(TAG, "call: imagePath " + imagePath);
600
                        Bitmap bitmap = BitmapFactory.decodeFile(imagePath);//压缩图片
601
                        if (ImageUtils.readPictureDegree(imagePath) != 0) {
602
                            bitmap = imageZoom(ImageUtils.toturn(bitmap));
603
                        } else {
604
                            bitmap = imageZoom(bitmap);
605
                        }
606 606
                        ImageItem takePhoto = new ImageItem();
607 607
                        takePhoto.setBitmap(bitmap);
608
                        takePhoto.setImagePath(imagePath);
608 609
                        Bimp.tempSelectBitmap.add(takePhoto);
609
                        subscriber.onNext("");
610
                        subscriber.onNext(imagePath);
610 611
                    }
611 612
                    subscriber.onComplete();
612 613
                } catch (Exception e) {
@ -1045,21 +1046,23 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1045 1046
    public void permissionTask() {
1046 1047
        if (isPermissionOK()) {
1047 1048
            callGallery();
1049
            // Have permission, do the thing!
1050
//            Toast.makeText(this, "TODO: Camera things", Toast.LENGTH_LONG).show();
1051
//            ifTimeout();
1048 1052
        } else {
1053
            // Ask for one permission
1049 1054
            EasyPermissions.requestPermissions(
1050 1055
                    this, "充电桩想要获取您的图片读取权限,是否允许?",
1051 1056
                    RC_ALBUM_PERM,
1052 1057
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
1053
                    Manifest.permission.READ_EXTERNAL_STORAGE,
1054
                    Manifest.permission.CAMERA);
1058
                    Manifest.permission.READ_EXTERNAL_STORAGE);
1055 1059
        }
1056 1060
    }
1057 1061
1058 1062
    private boolean isPermissionOK() {
1059 1063
        return EasyPermissions.hasPermissions(this,
1060 1064
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
1061
                Manifest.permission.READ_EXTERNAL_STORAGE,
1062
                Manifest.permission.CAMERA
1065
                Manifest.permission.READ_EXTERNAL_STORAGE
1063 1066
        );
1064 1067
    }
1065 1068
@ -1447,6 +1450,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1447 1450
                && (codePoint <= 0x10FFFF));
1448 1451
    }
1449 1452
1453
1450 1454
    private void getShareIntegral() {
1451 1455
        String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId + "&order_id=" + order_id;
1452 1456
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
@ -1460,11 +1464,9 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1460 1464
                LogUtils.e(response);
1461 1465
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1462 1466
                String red_money = JsonUtils.getKeyResult(response, "red_money");
1463
                try {
1464
                    int redMoney = Integer.parseInt(red_money);
1465
                    new HongBaoResultDialog(ChargingCommentActivity.this).builder().setCancelable(true).show(red_money);
1466
                } catch (Exception e) {
1467
                    e.printStackTrace();
1467
                int redMoney = Integer.valueOf(red_money);
1468
                if (redMoney > 0) {
1469
                    new HongBaoResultDialog(ChargingCommentActivity.this).builder().setCancelable(true).show(redMoney);
1468 1470
                }
1469 1471
1470 1472
                if ("01".equals(rtnCode)) { // 成功

+ 4 - 2
app/src/main/java/com/electric/chargingpile/view/HongBaoResultDialog.java

@ -11,7 +11,6 @@ import android.widget.LinearLayout;
11 11
import android.widget.TextView;
12 12
13 13
import com.electric.chargingpile.R;
14
import com.electric.chargingpile.util.ScreenUtils;
15 14
16 15
/**
17 16
 * Created by demon on 2017/5/25.
@ -20,6 +19,7 @@ import com.electric.chargingpile.util.ScreenUtils;
20 19
public class HongBaoResultDialog {
21 20
    private Context context;
22 21
    private android.app.Dialog dialog;
22
    private Display display;
23 23
    private ImageView dialog_close;
24 24
    private LinearLayout dialog_bg;
25 25
@ -27,6 +27,7 @@ public class HongBaoResultDialog {
27 27
        this.context = context;
28 28
        WindowManager windowManager = (WindowManager) context
29 29
                .getSystemService(Context.WINDOW_SERVICE);
30
        display = windowManager.getDefaultDisplay();
30 31
    }
31 32
32 33
    public HongBaoResultDialog builder() {
@ -43,7 +44,8 @@ public class HongBaoResultDialog {
43 44
        dialog.setContentView(view);
44 45
45 46
        // 调整dialog背景大小
46
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (ScreenUtils.getScreenWidth(context) * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
47
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
48
                .getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
47 49
48 50
        return this;
49 51
    }