Browse Source

添加评论提醒dialog

hy 3 years ago
parent
commit
c75e35b96c

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

4163
        DaoSession mDaoSession = daoMaster.newSession();
4163
        DaoSession mDaoSession = daoMaster.newSession();
4164
        zhan_listDao = mDaoSession.getZhan_listDao();
4164
        zhan_listDao = mDaoSession.getZhan_listDao();
4165
4165
4166
        zhan_lists = zhan_listDao.queryRaw("where status = ? " + MainApplication.sql, new String[]{"4"});
4167
        if (onResumeRefresh == true) {
4166
        if (onResumeRefresh == true) {
4168
            ToastUtil.showToast(getApplicationContext(), "共" + zhan_lists.size() + "个符合条件的站点", Toast.LENGTH_SHORT);
4167
            ToastUtil.showToast(getApplicationContext(), "共" + zhan_lists.size() + "个符合条件的站点", Toast.LENGTH_SHORT);
4169
        }
4168
        }
4169
4170
        new Thread() {
4170
        new Thread() {
4171
            public void run() {
4171
            public void run() {
4172
                zhan_lists = zhan_listDao.queryRaw("where status = ? " + MainApplication.sql, new String[]{"4"});
4172
                List<ClusterItem> items = new ArrayList<ClusterItem>();
4173
                List<ClusterItem> items = new ArrayList<ClusterItem>();
4173
                if (zhan_lists != null && zhan_lists.size() > 0) {
4174
                if (zhan_lists != null && zhan_lists.size() > 0) {
4174
                    for (int i = 0; i < zhan_lists.size(); i++) {
4175
                    for (int i = 0; i < zhan_lists.size(); i++) {

+ 8 - 3
app/src/main/java/com/electric/chargingpile/activity/ZhanCommentActivity.java

43
import android.widget.Toast;
43
import android.widget.Toast;
44
44
45
import androidx.annotation.NonNull;
45
import androidx.annotation.NonNull;
46
import androidx.appcompat.app.AppCompatActivity;
46
47
47
import com.blankj.utilcode.util.CacheUtils;
48
import com.blankj.utilcode.util.CacheUtils;
48
import com.electric.chargingpile.R;
49
import com.electric.chargingpile.R;
68
import com.electric.chargingpile.util.ToastUtil;
69
import com.electric.chargingpile.util.ToastUtil;
69
import com.electric.chargingpile.util.UploadUtil;
70
import com.electric.chargingpile.util.UploadUtil;
70
import com.electric.chargingpile.util.Util;
71
import com.electric.chargingpile.util.Util;
72
import com.electric.chargingpile.view.CommentHintDialog;
71
import com.electric.chargingpile.view.REditText;
73
import com.electric.chargingpile.view.REditText;
72
import com.electric.chargingpile.view.RatingBarView;
74
import com.electric.chargingpile.view.RatingBarView;
73
75
107
import pub.devrel.easypermissions.AfterPermissionGranted;
109
import pub.devrel.easypermissions.AfterPermissionGranted;
108
import pub.devrel.easypermissions.EasyPermissions;
110
import pub.devrel.easypermissions.EasyPermissions;
109
111
110
public class ZhanCommentActivity extends Activity implements View.OnClickListener, EasyPermissions.PermissionCallbacks {
112
public class ZhanCommentActivity extends AppCompatActivity implements View.OnClickListener, EasyPermissions.PermissionCallbacks {
111
    private static final String TAG = "ZhanCommentActivity";
113
    private static final String TAG = "ZhanCommentActivity";
112
    private static final int PIC_NUM = 1;
114
    private static final int PIC_NUM = 1;
113
    private ProgressDialog insertDialog;
115
    private ProgressDialog insertDialog;
131
    List<String> list;
133
    List<String> list;
132
    private String select_s = "";
134
    private String select_s = "";
133
    private String select_ss = "";
135
    private String select_ss = "";
134
    private TextView tv_grade, tv_point;
136
    private TextView tv_grade, tv_point,tv_zhan_name;
135
137
136
    private static String PHOTO_FILE_NAME = "";
138
    private static String PHOTO_FILE_NAME = "";
137
    private static final String PHOTO_FILE_PATH = getPath(PhotoUtils.CACHE_DIR);
139
    private static final String PHOTO_FILE_PATH = getPath(PhotoUtils.CACHE_DIR);
214
        insertDialog.setCanceledOnTouchOutside(false);
216
        insertDialog.setCanceledOnTouchOutside(false);
215
        rl_point = (RelativeLayout) findViewById(R.id.rl_point);
217
        rl_point = (RelativeLayout) findViewById(R.id.rl_point);
216
        tv_point = (TextView) findViewById(R.id.tv_point);
218
        tv_point = (TextView) findViewById(R.id.tv_point);
219
        tv_zhan_name = (TextView) findViewById(R.id.tv_zhan_name);
217
        animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.nn);
220
        animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.nn);
218
221
219
        relativeLayout = (RelativeLayout) findViewById(R.id.activity_zhan_comment);
222
        relativeLayout = (RelativeLayout) findViewById(R.id.activity_zhan_comment);
439
            }
442
            }
440
        });
443
        });
441
444
442
445
        tv_zhan_name.setOnClickListener(v->{
446
            CommentHintDialog.newInstart().show(getSupportFragmentManager());
447
        });
443
    }
448
    }
444
449
445
    public void Init() {
450
    public void Init() {

+ 59 - 0
app/src/main/java/com/electric/chargingpile/view/CommentHintDialog.java

1
package com.electric.chargingpile.view;
2
3
import android.os.Bundle;
4
import android.view.LayoutInflater;
5
import android.view.View;
6
import android.view.ViewGroup;
7
8
import androidx.annotation.NonNull;
9
import androidx.annotation.Nullable;
10
import androidx.fragment.app.DialogFragment;
11
import androidx.fragment.app.Fragment;
12
import androidx.fragment.app.FragmentManager;
13
import androidx.fragment.app.FragmentTransaction;
14
15
import com.electric.chargingpile.R;
16
17
import org.jetbrains.annotations.NotNull;
18
19
public class CommentHintDialog extends DialogFragment {
20
21
    public static CommentHintDialog newInstart(){
22
        return  new CommentHintDialog();
23
    }
24
25
    @Override
26
    public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
27
        super.onCreate(savedInstanceState);
28
        setStyle(DialogFragment.STYLE_NORMAL, R.style.TransparentVideoDialogFragmentTheme);
29
30
    }
31
    @Nullable
32
    @org.jetbrains.annotations.Nullable
33
    @Override
34
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
35
        View rootView = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_comment_hint, container, false);
36
        return rootView;
37
    }
38
39
    @Override
40
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
41
        super.onViewCreated(view, savedInstanceState);
42
        view.findViewById(R.id.closeImg).setOnClickListener(v->{
43
            dismissAllowingStateLoss();
44
        });
45
        view.findViewById(R.id.understood).setOnClickListener(v->{
46
            dismissAllowingStateLoss();
47
        });
48
    }
49
50
    public void show(FragmentManager fragmentManager){
51
        FragmentTransaction ft = fragmentManager.beginTransaction();
52
        Fragment prev = fragmentManager.findFragmentByTag(CommentHintDialog.class.getName());
53
        if (prev != null) {
54
            ft.remove(prev);
55
        }
56
        show(fragmentManager,CommentHintDialog.class.getName());
57
        fragmentManager.executePendingTransactions();
58
    }
59
}

BIN
app/src/main/res/drawable-xhdpi/bg_w_1.9.png


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


+ 5 - 0
app/src/main/res/drawable/bg_btn_greenfull_style.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3
    <solid android:color="@color/lvse_style" /><!--填充色-->
4
    <corners android:radius="20dp" />
5
</shape>

+ 5 - 0
app/src/main/res/drawable/bg_comment_hint.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<shape   xmlns:android="http://schemas.android.com/apk/res/android">
3
    <corners android:radius="20dp"/>
4
    <solid android:color="@color/color_white"/>
5
</shape>

+ 2 - 0
app/src/main/res/layout/activity_zhan_comment.xml

36
        android:background="@color/title_background">
36
        android:background="@color/title_background">
37
37
38
        <TextView
38
        <TextView
39
            android:drawablePadding="5dp"
40
            android:drawableEnd="@drawable/ic_comm_hint"
39
            android:id="@+id/tv_zhan_name"
41
            android:id="@+id/tv_zhan_name"
40
            android:layout_width="wrap_content"
42
            android:layout_width="wrap_content"
41
            android:layout_height="wrap_content"
43
            android:layout_height="wrap_content"

+ 80 - 0
app/src/main/res/layout/dialog_comment_hint.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    tools:background="#f1f1"
5
    android:gravity="center"
6
    android:layout_height="match_parent"
7
    xmlns:app="http://schemas.android.com/apk/res-auto"
8
    xmlns:tools="http://schemas.android.com/tools">
9
10
    <androidx.constraintlayout.widget.ConstraintLayout
11
12
        android:layout_width="268dp"
13
        android:background="@drawable/bg_comment_hint"
14
        android:layout_height="wrap_content">
15
16
        <ImageView
17
            android:layout_marginEnd="24dp"
18
            android:layout_marginTop="16dp"
19
            android:id="@+id/closeImg"
20
            android:layout_width="wrap_content"
21
            android:layout_height="wrap_content"
22
            android:src="@drawable/icon_black_close"
23
            app:layout_constraintEnd_toEndOf="parent"
24
            app:layout_constraintTop_toTopOf="parent" />
25
26
        <ImageView
27
            android:id="@+id/titleImg"
28
            android:layout_marginTop="20dp"
29
            android:layout_width="wrap_content"
30
            android:layout_height="wrap_content"
31
            app:layout_constraintEnd_toEndOf="parent"
32
            app:layout_constraintStart_toStartOf="parent"
33
            app:layout_constraintTop_toBottomOf="@+id/closeImg"
34
            android:src="@drawable/ic_logout_dialog" />
35
36
        <TextView
37
            android:textStyle="bold"
38
            android:id="@+id/hintText"
39
            android:layout_marginTop="20dp"
40
            app:layout_constraintEnd_toEndOf="parent"
41
            app:layout_constraintStart_toStartOf="parent"
42
            app:layout_constraintTop_toBottomOf="@+id/titleImg"
43
            android:layout_width="wrap_content"
44
            android:layout_height="wrap_content"
45
            android:text="评论发布小贴士"
46
            android:textColor="#ff0e0e0e"
47
            android:textSize="18sp"
48
            />
49
50
        <TextView
51
            android:layout_marginEnd="16dp"
52
            android:layout_marginStart="16dp"
53
            android:layout_marginTop="20dp"
54
            app:layout_constraintTop_toBottomOf="@+id/hintText"
55
            app:layout_constraintEnd_toEndOf="parent"
56
            app:layout_constraintStart_toStartOf="parent"
57
            android:layout_width="match_parent"
58
            android:layout_height="wrap_content"
59
            android:text="充电桩APP鼓励并支持对车主有帮助的评价,以下几种评价的账户会被禁言:\n\n1.有违法违规、低俗的内容\n\n2.含有网址、广告图片、微信号、手机号、QQ号等营销信息\n\n3.多次无实际内容的评价或内容基本相同的评价"
60
            android:textColor="#ff0e0e0e"
61
            android:textSize="14sp"
62
            android:id="@+id/contentText"
63
            />
64
65
        <TextView
66
            android:id="@+id/understood"
67
            app:layout_constraintBottom_toBottomOf="parent"
68
            android:layout_marginBottom="16dp"
69
            android:layout_marginTop="16dp"
70
            app:layout_constraintEnd_toEndOf="parent"
71
            app:layout_constraintStart_toStartOf="parent"
72
            app:layout_constraintTop_toBottomOf="@+id/contentText"
73
            android:gravity="center"
74
            android:background="@drawable/bg_btn_greenfull_style"
75
            android:text="我知道了"
76
            android:textColor="@color/white"
77
            android:layout_width="110dp"
78
            android:layout_height="40dp"/>
79
    </androidx.constraintlayout.widget.ConstraintLayout>
80
</RelativeLayout>

+ 1 - 0
app/src/main/res/values/color.xml

149
    <color name="editcolor">#333333</color>
149
    <color name="editcolor">#333333</color>
150
    <color name="juhuang">#ff9a00</color>
150
    <color name="juhuang">#ff9a00</color>
151
    <color name="lvse">#01b637</color>
151
    <color name="lvse">#01b637</color>
152
    <color name="lvse_style">#3EC34C</color>
152
    <color name="status_blue">#487FFF</color>
153
    <color name="status_blue">#487FFF</color>
153
    <color name="juse">#ff9e05</color>
154
    <color name="juse">#ff9e05</color>
154
    <color name="ogreen">#c5ecd0</color>
155
    <color name="ogreen">#c5ecd0</color>