myflag step 13:后台代码编写、客户端具体功能实现与界面优化

引言

在这半周的工作中,我们小组仍然进行后台和客户端的代码编写工作,以及用户界面的优化,具体内容如下:

  • 客户端 :设置中的功能以及查看评论
  • 后台:完成所有接口编写
  • 界面:界面跳转关系与布局的优化

下面做一个详细的介绍。

一、客户端

1、界面

在之前的界面设计中,已经完成了关于我们界面的设计。该界面比较简单,在最外层使用一个纵向的LinearLayout,内部嵌套若干个横向的LinearLayout或RelativeLayout,再布置不同的控件就可以实现,具体代码如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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/toolbar_back_bg"
            android:onClick="AboutUsBack"
            android:src="?attr/homeAsUpIndicator" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="关于我们"
            android:textColor="@color/black"
            android:textSize="19sp" />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@color/activity_bg_gray"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:layout_width="70dp"
            android:layout_height="80dp"
            android:scaleType="fitCenter"
            android:src="@drawable/app_icon" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp"
            android:text="Ver:1.0.0"
            android:textColor="@color/text_dark_gray" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:background="@color/activity_bg_gray"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/white"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="15dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="最新版本:1.0.0"
                android:textColor="@color/text_dark_gray" />
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@color/activity_bg_gray" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/white"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="15dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="制作团队:MYFLAG团队"
                android:textColor="@color/text_dark_gray" />
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@color/activity_bg_gray" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/white"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:paddingLeft="15dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="反馈与合作QQ群:570757560"
                android:textColor="@color/text_dark_gray" />
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@color/activity_bg_gray" />
    </LinearLayout>
</LinearLayout>

根据该代码生成的预览效果如下所示,可以看到是符合预期的。
这里写图片描述

退出登录的功能是集成在设置界面里边的,故不需要单独编写界面。

2、内部逻辑实现

1、关于我们功能

该界面的功能非常简单,只需要将预先设计好的内容显示在界面上即可,即显示一些开发者的信息,并没有什么复杂的逻辑。需要处理的时间只有用户点击后退按钮,只需将当前Activity结束即可跳回上一个界面。
具体代码如下:

package com.example.sdu.myflag.activity;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.example.sdu.myflag.R;

/**
 * 关于我们界面
 */
public class AboutUsActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);
    }

    public void AboutUsBack(View view) {
        this.finish();
    }
}

2、退出登录

这个功能的实现也不复杂,只需要结束当前界面的Activity和主Activity,以退出用户的登录,在跳转到登陆的初始界面即可。
具体实现代码如下所示:

public void exitLogin(View view) {
    startNewActivity(LoginActivity.class);
    MainActivity.getInstance().finish();
    finish();
}

在这两个功能完成之后,进行了白盒测试。因为代码比较简单的缘故,测试没有发现问题,顺利通过。

二、后台

本次的任务主要是完成了所有的接口的编写,因为前面已经完成了大部分的内容,所以接口的编写也很简单。新增的接口有:
这里写图片描述
Createflag是创建flag的时候的接口
Deleteflag是删除flag的接口
Frinedsflag是用来获取朋友们的flag
Getapplymyflag用来获取想要监督我的请求
Getflag是用来获取一个具体的flag
Getmyapplysupervise是用来获取我的监督的请求
Judgeflag是用来判定flag的
Myflag是用来获取flag的
同时新增了joindao,joindao是用来添加新的成员的。

//String createFlag="http://localhost:8080/myflag/flag/CreateFlag";
        //String friendsFlag="http://localhost:8080/myflag/flag/FriendsFlag";
        //String MyFlag="http://localhost:8080/myflag/flag/MyFlag";
    //  String confirmFlagStste="http://localhost:8080/myflag/flag/JudgeFlag";
        //String confirmFlagRequest="http://localhost:8080/myflag/flag/ConfirmSuperviseRequest";
    //String getMySuperviseRequest="http://localhost:8080/myflag/flag/GetMySuperviseRequest";
        //String flag="http://localhost:8080/myflag/flag/Flag";
        //String MySuperviseFlag="http://localhost:8080/myflag/flag/MySuperviseFlag";
        //String applySupervise="http://localhost:8080/myflag/flag/ApplySupervise";
        //String deleteFlag="http://localhost:8080/myflag/flag/DeleteFlag";
        String GetApplyMyFlag="http://localhost:8080/myflag/flag/GetApplyMyFlag";
        //String GetMyApplySupervise="http://localhost:8080/myflag/flag/GetMyApplySupervise";


int timeout=200*10000;
try {
    //Response resp=Jsoup.connect(createFlag).data("id","26").data("content","可以").data("award", "行啊").data("isTeam", "true").
    //data("startTime", "1451581200").data("endTime", "1469980900").data("maxSupervise","4").data("supervise", "28").data("member","29").timeout(timeout).execute();
    //Response resp=Jsoup.connect(friendsFlag).data("id","29").timeout(timeout).execute();
    //Response resp=Jsoup.connect(MyFlag).data("id","26").timeout(timeout).execute();
    //Response resp=Jsoup.connect(applySupervise).data("fid","30").data("uid","31").timeout(timeout).execute();
    //Response resp=Jsoup.connect(confirmFlagRequest).data("fid","17").data("uid","4").data("agree", "2").timeout(timeout).execute();
    //Response resp=Jsoup.connect(confirmFlagStste).data("fid","32").data("uid","27").data("achieve", "2").data("evaluate", "成功").timeout(timeout).execute();
    //Response resp=Jsoup.connect(getMySuperviseRequest).data("id","26").timeout(timeout).execute();
//Response resp=Jsoup.connect(flag).data("id","28").timeout(timeout).execute();
    //Response resp=Jsoup.connect(MySuperviseFlag).data("id","26").timeout(timeout).execute();
    //Response resp=Jsoup.connect(deleteFlag).data("id","54").timeout(timeout).execute();
    //Response resp=Jsoup.connect(applySupervise).data("fid","54").data("uid","26").timeout(timeout).execute();
    //String ConfirmApplySupervise="http://localhost:8080/myflag/flag/ConfirmApplySupervise";
    //Response resp=Jsoup.connect(ConfirmApplySupervise).data("fid","54").data("uid","27").data("agree","2").timeout(timeout).execute();
    Response resp=Jsoup.connect(GetApplyMyFlag).data("uid","26").timeout(timeout).execute();
    //Response resp=Jsoup.connect(GetMyApplySupervise).data("uid","31").timeout(timeout).execute();
    System.out.println(resp.body());

三、界面

这一阶段页面即将完成规定的最后一个功能—打卡
对于打卡的操作,前段方面主要是明切具体的概念:

  • 打卡的入口
  • 打卡的形式
  • 打卡的入口
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值