第五周(1) Flag相关的功能设计

引言

不知不觉,我们的创新项目实训已经过去了大半,按照我们事先商定好的计划,这周的任务主要是安卓客户端与后天有关具体的Flag的功能的相关实现,计划能顺利实施,得益于我们前期花费大量时间的讨论以及对工作量的正确的评估。本周的主要任务有:

  • 客户端 :我的好友消息和Flag详情
  • 后台:DAO层的详细逻辑梳理架构
  • 客户端:客户端设计工作的细节调整以及界面优化
下面我就客户端的工作中我的工作进行介绍:


客户端

本次我的工作是编写我的好友消息功能,其中xml界面代码如下:

<?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:background="@color/activity_bg_gray"
    android:orientation="vertical">

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

        <ImageButton
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:layout_alignParentLeft="true"
            android:background="@drawable/toolbar_back_bg"
            android:onClick="myMessageFriendBack"
            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>

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/friend_msg_swipe_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="20dp">

        <ListView
            android:id="@+id/myMessageListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="20dp"
            android:background="@color/white" />
    </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>


界面如下:


相对应的Activity相关的核心实现部分MyMessageFriendActivity核心代码块为;

public void onSuccess(Response response) {
        if (response.isSuccessful()) {
            try {
                String res = response.body().string();
                JSONObject request = new JSONObject(res);
                JSONArray jsonArray = request.getJSONArray("request");
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    String nickname = jsonObject.optString("nickname");
                    String phone = jsonObject.optString("phone");
                    String message = jsonObject.optString("message");
                    String requestUid = jsonObject.optString("requestUid");
                    String agree = jsonObject.optString("agree");
                    int iconId = jsonObject.optInt("photo");

                    list.add(new TempFriendBean(nickname, phone, message, requestUid, agree, iconId));
                }
                MyMessageFriendActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        friendMessageAdapter = new FriendMessageAdapter(MyMessageFriendActivity.this, list);
                        listView.setAdapter(friendMessageAdapter);
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }

其主要功能是从服务器获取数据后的回调函数,根据请求的成功或者失败做出具体的响应。

总结

这一阶段的过程还算顺利,小组成员深刻体会到了前期需求讨论的充分以及花费了大量的时间进行计划的评估和修改,好让我们的开发过程思路清晰明了,遇到的问题也会快速解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值