Android:问题与反馈界面及功能

前言:暑期做了一个月平面设计实习,很多知识都忘了,特意写个界面练练手。本来想用反馈的api 来着,集成的东西比较多,无法加载,有的开发者身份不合,先写个差不多的。

界面:

activity_feedback.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".FeedbackActivity">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/white"
        tools:context=".FeedbackActivity">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/white"
                android:padding="0dp">


                <ImageButton
                    android:id="@+id/back_btn"
                    android:layout_width="?attr/actionBarSize"
                    android:layout_height="?attr/actionBarSize"
                    android:layout_alignParentLeft="true"
                    android:background="@drawable/tab_menu_bg"
                    android:src="?attr/homeAsUpIndicator"
                    />


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="问题与反馈"
                    android:textSize="19sp"/>

            </RelativeLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dp"
                    android:text="标 题:"
                    android:textColor="@color/design_default_color_primary"
                    android:textSize="20sp" />

                <EditText
                    android:id="@+id/f_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="10dp"
                    android:hint="具体问题"
                    android:textColor="@color/bg_black"
                    android:textSize="18sp" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
                <EditText android:text=""
                    android:id="@+id/f_details"
                    android:lines="5"
                    android:gravity="top"
                    android:hint="请输入您的反馈意见(字数500以内)!"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"></EditText>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:text="联系方式:"
                        android:textColor="@color/design_default_color_primary"
                        android:textSize="20sp" />

                    <EditText
                        android:id="@+id/f_contact"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="10dp"
                        android:hint=""
                        android:textColor="@color/bg_black"
                        android:textSize="18sp" />
                </LinearLayout>


                <Button
                    android:id="@+id/but_help_feedback"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:background="@color/colorPrimaryDark"
                    android:text="提交"
                    android:textSize="20sp"></Button>

            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                >
                <TextView
                    android:text="下面是常见问题"
                    android:id="@+id/help_allseequestions"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:layout_width="fill_parent"
                    android:textColor="#000000"
                    android:layout_marginTop="10px"
                    android:layout_height="wrap_content"></TextView>

                <TextView
                    android:layout_marginTop="10px"
                    android:paddingLeft="15px"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:text="Q:【新生信息采集】相关疑问.\n A:可参考录取通知书内容,或者咨询迎新校园号哟~也欢迎于同学圈发帖互动~"
                    android:layout_width="fill_parent"
                    android:id="@+id/help_1"></TextView>



                <TextView
                    android:layout_marginTop="10px"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:paddingLeft="15px"
                    android:text="Q:通知并未提醒和显示? \n A:去管理开启手机通知提醒"
                    android:layout_width="fill_parent"
                    android:id="@+id/help_2"
                    ></TextView>



                <TextView
                    android:layout_marginTop="10px"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:paddingLeft="15px"
                    android:text="Q【校园号管理员】如何新增呢? \n A:申请校园号的主管理员,请联系qq:2332446920."
                    android:layout_width="fill_parent"
                    android:id="@+id/help_3"
                    ></TextView>



                <TextView
                    android:layout_marginTop="10px"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:paddingLeft="15px"
                    android:text="Q:已经做完的测试主题是否可以再做? \n A:不可以."
                    android:layout_width="fill_parent"
                    android:id="@+id/help_4"
                    ></TextView>

                <TextView
                    android:layout_marginTop="10px"
                    android:layout_height="wrap_content"
                    android:textColor="#000000"
                    android:paddingLeft="15px"
                    android:text="Q:回答问题,【解除管理】 \nA:校园号主管理员也可将现有子管理员“移出管理”,即取消某个用户的子管理员权限。"
                    android:layout_width="fill_parent"
                    android:id="@+id/help_5"></TextView>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <Button
                    android:id="@+id/Customer_tele"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="@color/bg_white"
                    android:text="联系客服"
                    android:textColor="@color/design_default_color_primary"
                    android:textSize="18sp" />
            </LinearLayout>

        </LinearLayout>

    </ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>

FeedbackActivity.class

package com.example.instructorhelpdome;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;

import com.example.instructorhelpdome.JavaBean.Feedback;
import com.fingerth.supdialogutils.SYSDiaLogUtils;

import androidx.appcompat.app.AppCompatActivity;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

public class FeedbackActivity extends AppCompatActivity implements View.OnClickListener{

    private EditText f_title;
    private EditText f_details;
    private EditText f_contact;

    private Button but_help_feedback;
    private Button Customer_tele;

    private String sproblem;
    private String sdetails;
    private String scontact;

    private ImageButton back_btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);

        initview();

    }

    private void initview() {

        f_title=(EditText)findViewById(R.id.f_title);
        f_details =(EditText)findViewById(R.id.f_details);
        f_contact=(EditText)findViewById(R.id.f_contact);

        but_help_feedback=(Button)findViewById(R.id.but_help_feedback);
        but_help_feedback.setOnClickListener(this);

        Customer_tele=(Button)findViewById(R.id.Customer_tele);
        Customer_tele.setOnClickListener(this);

        back_btn=(ImageButton)findViewById(R.id.back_btn);
        back_btn.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.but_help_feedback:
                but_feedback();
                break;
            case R.id.Customer_tele:
                String phoneNum="16642712339";
                toTelephone(phoneNum);
                break;
            case R.id.back_btn:
                finish();
                break;
        }
    }

    private void toTelephone(String phoneNum) {

        Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum));
        startActivity(intent);
    }

    private void but_feedback() {
        sproblem=f_title.getText().toString();
        sdetails=f_details.getText().toString();
        scontact=f_contact.getText().toString();

        Feedback feedback=new Feedback();
        feedback.setProblem(sproblem);
        feedback.setDetails(sdetails);
        feedback.setContact(scontact);

        feedback.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {
                if (e==null){
                    Log.i("插入成功",s);
                    SYSDiaLogUtils.showSuccessDialog(FeedbackActivity.this, "反馈成功", "感谢您的反馈,我们会尽快处理您的意见!", "OK", false);

                }else {
                    Log.i("失败",e.getMessage());
                    SYSDiaLogUtils.showErrorDialog(FeedbackActivity.this, "失败警告", "很抱歉,这次更新失败,請检查网络重新試試!", "取消", false);

                }
            }
        });

    }
}

发布了71 篇原创文章 · 获赞 19 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_39131246/article/details/100135903