MyFlag Step13:后台代码编写、客户端具体功能实现以及界面优化
来源:互联网 发布:单类信息发布源码 编辑:程序博客网 时间:2024/06/04 23:32
引言
在这半周的工作中,我们小组仍然主要进行后台客户端的代码编写工作以及界面的优化,在这里,我对自己主要从事的工作,即客户端的关于我们和退出登录功能的实现,做一个重点的介绍。
一、界面编写
在之前的界面设计中,已经完成了关于我们界面的设计。该界面比较简单,在最外层使用一个纵向的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>
根据该代码生成的预览效果如下所示,可以看到是符合预期的。
退出登录的功能是集成在设置界面里边的,故不需要单独编写界面。
二、内部逻辑实现
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();}
在这两个功能完成之后,我进行了白盒测试。因为代码比较简单的缘故,测试没有发现问题,顺利通过。
总结
这半周实现了两个功能,但因为比较简单,进行得也比较顺利。到目前为止,客户端的代码编写工作已经接近尾声,预计再有半周的时间就可以编写完成,随后进入最后的测试阶段。目前的进度还是不错的,按照目前的情况是可以按照计划完成的。
阅读全文
0 0
- MyFlag Step13:后台代码编写、客户端具体功能实现以及界面优化
- MyFlag Step11:后台代码编写与客户端具体功能实现以及界面优化
- MyFlag Step12:后台代码编写、客户端具体功能实现以及界面优化
- MyFlag Step14:后台代码编写、客户端具体功能实现以及界面优化
- MyFlag Step11:后台代码编写、客户端具体功能实现与界面优化
- MyFlag Step12:后台代码编写、客户端具体功能实现与界面优化
- myflag step 13:后台代码编写、客户端具体功能实现与界面优化
- 第六周(1) 后台代码编写与客户端具体功能实现以及界面优化
- 第六周(2) 后台代码编写、客户端具体功能实现与界面优化
- 第七周(1) 后台代码编写、客户端具体功能实现与界面优化
- MyFlag Step10:后台代码解耦与客户端具体功能实现
- MyFlag Step10:后台代码解耦与客户端具体功能设计
- MyFlag Step10:后台代码解耦与客户端具体功能设计
- MyFlag Step13:打卡功能的初步讨论
- myflag step13:接口的完成
- MyFlag Step12:menupath界面跳转测试以及其他优化
- MyFlag Step14: 打卡功能界面的初步
- MYSQL主从配置以及客户端代码实现读写分离功能
- xhsell 配置虚拟主机重要一步
- OpenCV学习笔记(一)
- TypeScript开发环境搭建-Visual Studio Code
- 一个使用公钥签名与加密,使用密钥解密的案例。。。
- 来说说(Strategy)策略模式
- MyFlag Step13:后台代码编写、客户端具体功能实现以及界面优化
- 使用PyQt来编写第一个Python GUI程序
- java 模拟窗口排队
- ajax异步请求
- Kotlin入门资料搜集
- 大型网站技术架构:核心原理与案例分析
- [LibreOJ β Round]ZQC的游戏
- Python的字符串处理
- 某公司SQL Server 数据库备份方案