iis服务器助手广告广告
返回顶部
首页 > 资讯 > 移动开发 >Android studio课程设计开发实现---日记APP
  • 449
分享到

Android studio课程设计开发实现---日记APP

androidstudioandroidide 2023-09-23 09:09:19 449人浏览 八月长安
摘要

Android studio课程设计开发实现—日记APP 文章目录 Android studio课程设计开发实现---日记APP前言一、效果二、功能介绍1.主要功能2.涉及知识点 三、实

Android studio课程设计开发实现—日记APP


文章目录


前言

你们好,我是oy,介绍一个简易日记APP。

一、效果

启动页、引导页及登陆注册
在这里插入图片描述
2.日记相关功能
在这里插入图片描述
3.个人中心界面
在这里插入图片描述

二、功能介绍

1.主要功能

  1. 实现应用启动页及引导页
  2. 实现设置密码进入APP,对密码进行加密处理
  3. 实现底部导航栏,分为日记列表,新建日记,个人中心模块
  4. 实现对日记删除、修改、新增的基础功能
  5. 实现圆形头像,通过相册及拍照并裁剪图片设置头像。可实时保存。
  6. 实现网络更新个人中心美图。
  7. 对密码展示及关闭,跳转应用设置界面
  8. 动态获取拍照及相册访问权限

2.涉及知识点

  1. activity与fragment数据传递、页面更新、相互跳转。
  2. SharedPrefrenced存储、文件存储、文件加密。
  3. Android应用权限获取及设置
  4. 控件的使用:Button、EditText、AlertDialog、Imageview、ImageButton、viewPager2、Toolbar、RecycleView、NavigationButton等
  5. 布局的使用:LinearLayout、ConstraintLayout、RelativeLayout等
  6. 调用Android系统应用
  7. 自定义View:底部弹窗(比较复杂)、圆形头像
  8. Glide框架使用:网络加载图片
  9. Android框架:mvc

三、实现思路

  1. MainActivity中使用BottomNavigationView、ViewPager2、Toolbar实现。
public class MainActivity extends AppCompatActivity {    private BottomNavigationView bottomNavigationView;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        initToolbar();        initFragment();        initNavigationBottom();    }    @SuppressLint("ResourceAsColor")    private void initNavigationBottom() {        bottomNavigationView = findViewById(R.id.navigation_bottom);        bottomNavigationView.setItemIconTintList(null);        bottomNavigationView.setOnNavigationItemSelectedListener(itemSelectedListener);    }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        return super.onCreateOptionsMenu(menu);    }    private void initFragment() {        DiariesFragment diariesFragment = getDiariesFragment();        if (diariesFragment == null) {            diariesFragment = new DiariesFragment();            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), diariesFragment, R.id.content);        }    }    private DiariesFragment getDiariesFragment() {        return (DiariesFragment) getSupportFragmentManager().findFragmentById(R.id.content);    }    private void initToolbar() {        //设置顶部状态栏为透明        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);        Toolbar toolbar = findViewById(R.id.toolbar);        setSupportActionBar(toolbar);    }    private final BottomNavigationView.OnNavigationItemSelectedListener itemSelectedListener = item -> {        switch (item.getItemId()) {            case R.id.menu_diary:                MeController.setToolbarVisibility(this);                ActivityUtils.removeFragmentTOActivity(getSupportFragmentManager(), getSupportFragmentManager().findFragmentById(R.id.content));                ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), new DiariesFragment(), R.id.content);                break;            case R.id.menu_me:                findViewById(R.id.toolbar).setVisibility(View.GoNE);                ActivityUtils.removeFragmentTOActivity(getSupportFragmentManager(), getSupportFragmentManager().findFragmentById(R.id.content));                ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), new MeFragment(), R.id.content);                break;            case R.id.menu_new:                bottomNavigationView.setVisibility(View.GONE);                MeController.setToolbarVisibility(this);                ActivityUtils.removeFragmentTOActivity(getSupportFragmentManager(), getSupportFragmentManager().findFragmentById(R.id.content));                ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), new ADDDiaryFragment(), R.id.content);                break;        }        return true;    };}

MainActivity的layout

<LinearLayout    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"    android:orientation="vertical"    tools:context=".MainActivity">    <com.google.android.material.appbar.AppBarLayout        android:layout_width="match_parent"        android:layout_height="wrap_content">        <androidx.appcompat.widget.Toolbar            android:id="@+id/toolbar"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:background="?attr/colorPrimary"            android:minHeight="?attr/actionBarSize"            android:fitsSystemwindows="true"            android:theme="@style/Widget.AppCompat.Toolbar"            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>    com.google.android.material.appbar.AppBarLayout>    <FrameLayout        android:id="@+id/content"        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="1"/>    <com.google.android.material.bottomnavigation.BottomNavigationView        android:id="@+id/navigation_bottom"        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:menu="@menu/menu_navigation"        android:background="?android:attr/windowBackground"/>LinearLayout>
  1. ViewPager2中切换不同fragment,对应导航栏新增日记、个人中心及日记列表。
public class DiariesFragment extends Fragment {    private DiariesController mController;    @Override    public void onCreate(@Nullable Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        mController = new DiariesController(this);    }        @Nullable    @Override    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {        View root = inflater.inflate(R.layout.fragment_diaries, container, false);        mController.setDiariesList(root.findViewById(R.id.diaries_list));        return root;    }    @Override    public void onResume() {        super.onResume();        mController.loadDiaries();    }}

DiariesFragment的layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent" android:layout_height="match_parent"    android:orientation="vertical">    <androidx.recyclerview.widget.RecyclerView        android:id="@+id/diaries_list"        android:layout_width="match_parent"        android:layout_height="wrap_content"/>RelativeLayout>
public class AddDiaryFragment extends Fragment implements View.OnClickListener {    private AddDiaryController mController;    private View edit_layout;    private Button btn_confirm;    private EditText edit_title;    private EditText edit_desc;    @Override    public void onCreate(@Nullable Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        mController = new AddDiaryController(this);    }    private void initView(View view) {        btn_confirm = view.findViewById(R.id.add_diary_confirm);        btn_confirm.setOnClickListener(this);        edit_title = view.findViewById(R.id.edit_add_title);        edit_desc = view.findViewById(R.id.edit_add_desc);        edit_layout = view.findViewById(R.id.edit_layout);        edit_layout.setOnClickListener(this);    }    @Override    public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {        inflater.inflate(R.menu.menu_cancel, menu);    }    @Override    public boolean onOptionsItemSelected(@NonNull MenuItem item) {        switch (item.getItemId()) {            case R.id.menu_cancel:                mController.closeWriteDiary(getActivity().getSupportFragmentManager(), this);                mController.setNavigationVisibility();                return true;        }        return false;    }    @Nullable    @Override    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {        View root = inflater.inflate(R.layout.fragment_add_diary, container, false);        initView(root);        return root;    }    @Override    public void onDestroy() {        super.onDestroy();    }    @Override    public void onClick(View view) {        switch (view.getId()) {            case R.id.add_diary_confirm:                mController.addDiaryToRepository(edit_title.getText().toString().trim(), edit_desc.getText().toString().trim());                mController.setNavigationVisibility();                mController.closeWriteDiary(getActivity().getSupportFragmentManager(), this);                break;            case R.id.edit_layout:                mController.changeFocus(edit_desc);                break;        }    }}

AddDiaryFragment的layout

<LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginTop="10dp"        android:layout_marginStart="10dp"        android:layout_marginEnd="10dp"        android:orientation="vertical">        <EditText            android:id="@+id/edit_add_title"            android:hint="@string/add_title_hint"            android:minLines="1"            android:layout_width="match_parent"            android:layout_height="wrap_content" />    LinearLayout>    <LinearLayout        android:id="@+id/edit_layout"        android:layout_width="match_parent"        android:layout_height="0dp"        android:layout_weight="1"        android:layout_marginTop="5dp"        android:layout_marginStart="10dp"        android:layout_marginEnd="10dp"        android:layout_marginBottom="10dp">        <LinearLayout            android:layout_width="match_parent"            android:layout_height="match_parent"            android:paddingStart="5dp"            android:paddingTop="5dp"            android:paddingEnd="5dp"            android:paddingBottom="5dp"            android:background="@drawable/edit_background">            <EditText                android:id="@+id/edit_add_desc"                android:hint="@string/add_title_description"                android:gravity="top"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:scrollbars="vertical"                android:background="@null"/>        LinearLayout>    LinearLayout>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:gravity="center"        android:orientation="horizontal">        <Button            android:id="@+id/add_diary_confirm"            android:text="@string/btn_ok"            android:layout_width="wrap_content"            android:layout_height="wrap_content"/>    LinearLayout>LinearLayout>
  1. 将应用密码加密保存与文件中。每次登陆获取密码并对比。
public class LoginDirectActivity extends AppCompatActivity implements View.OnClickListener {    private EditText edit_input_text;    private Button btn_comeIn;    private TextView tv_setPsw;    private static final String TAG = "Login2Activity";    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_direct_login);        bindView();    }    private void bindView() {        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);        edit_input_text = findViewById(R.id.edit_login2_input_text);        btn_comeIn = findViewById(R.id.btn_login2_comeIn);        btn_comeIn.setOnClickListener(this);        tv_setPsw = findViewById(R.id.tv_setPsw);        tv_setPsw.setOnClickListener(this);    }    @Override    public void onClick(View v) {        switch (v.getId()) {            case R.id.tv_setPsw:                Intent setPsw_intent = new Intent(LoginDirectActivity.this, LoginActivity.class);                startActivity(setPsw_intent);                LoginDirectActivity.this.finish();//                overridePendingTransition(R.anim.out_to_left,R.anim.in_from_right);                break;            case R.id.btn_login2_comeIn:                String psw = edit_input_text.getText().toString().trim();                if (psw.isEmpty()) {                    Toast.makeText(this, "密码不能为空!", Toast.LENGTH_SHORT).show();                    return;                }                String readInfoByContext = FileUtils.readInfoByContext(this);                if (psw.equals(readInfoByContext)) {                    Toast.makeText(this, "登录成功!", Toast.LENGTH_SHORT).show();                    Intent intent = new Intent(this, MainActivity.class);                    startActivity(intent);//                    overridePendingTransition(R.anim.out_to_left,R.anim.in_from_right);                } else {                    Toast.makeText(this, "密码不正确!", Toast.LENGTH_SHORT).show();                }                break;        }    }}

LoginDirectActivity 的layout

<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=".view.LoginDirectActivity">    <Button        android:id="@+id/btn_login2_comeIn"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginStart="40dp"        android:layout_marginEnd="40dp"        android:text="进入"        app:layout_constraintBottom_toTopOf="@+id/guideline5"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent" />    <LinearLayout        android:id="@+id/linearLayout"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginStart="40dp"        android:layout_marginEnd="40dp"        android:gravity="center_vertical"        android:orientation="horizontal"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="@+id/guideline7">        <ImageView            android:layout_width="32dp"            android:layout_height="32dp"            android:src="@mipmap/come_in_key" />        <EditText            android:id="@+id/edit_login2_input_text"            android:hint="输入您的密码"            android:inputType="textPassWord"            android:layout_width="match_parent"            android:layout_height="wrap_content" />    LinearLayout>    <androidx.constraintlayout.widget.Guideline        android:id="@+id/guideline4"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:orientation="horizontal"        app:layout_constraintGuide_percent="0.22" />    <androidx.constraintlayout.widget.Guideline        android:id="@+id/guideline5"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:orientation="horizontal"        app:layout_constraintGuide_percent="0.58" />    <TextView        android:id="@+id/tv_login2_password_title"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:gravity="center"        android:text="输入密码"        android:textSize="30sp"        android:textStyle="bold"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="@+id/guideline4" />    <androidx.constraintlayout.widget.Guideline        android:id="@+id/guideline7"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:orientation="horizontal"        app:layout_constraintGuide_percent="0.4" />    <TextView        android:id="@+id/tv_setPsw"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="设置密码"        android:textStyle="bold"        app:layout_constraintEnd_toEndOf="@+id/linearLayout"        app:layout_constraintTop_toBottomOf="@+id/linearLayout" />androidx.constraintlayout.widget.ConstraintLayout>
  1. 使用SharedPrefrenced存储日记内容及标题。
public final class SharedPreferencesUtils {    private static final SimpleArrayMap<String, SharedPreferencesUtils> mCaches = new SimpleArrayMap<>();    private SharedPreferences mSharedPreferences;    private SharedPreferencesUtils(final String spName, final int mode) {        mSharedPreferences = YyApplication.get().getSharedPreferences(spName, mode);    }    public static SharedPreferencesUtils getInstance(String spName) {        SharedPreferencesUtils utils = mCaches.get(spName);        if (utils == null) {            utils = new SharedPreferencesUtils(spName, Context.MODE_PRIVATE);        }        return utils;    }    public void put(final String key, final String value) {        mSharedPreferences.edit().putString(key, value).apply();    }    public String get(final String key) {        return mSharedPreferences.getString(key, "");    }    public void remove(final String key) {        mSharedPreferences.edit().remove(key).apply();    }}

总结

以上就是今天讲的内容,本文仅仅简单介绍了Android日记APP,需要掌握上述知识点,能够较好的理解此应用逻辑。

来源地址:https://blog.csdn.net/m0_49534667/article/details/128087389

--结束END--

本文标题: Android studio课程设计开发实现---日记APP

本文链接: https://www.lsjlt.com/news/416313.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Android studio课程设计开发实现---日记APP
    Android studio课程设计开发实现—日记APP 文章目录 Android studio课程设计开发实现---日记APP前言一、效果二、功能介绍1.主要功能2.涉及知识点 三、实...
    99+
    2023-09-23
    android studio android ide
  • Android笔记设计范例之日记APP实现全流程
    目录前言一、效果二、功能介绍1.主要功能2.涉及知识点三、实现思路总结前言 你们好,我是oy,介绍一个简易日记APP。 一、效果 1.启动页、引导页及登陆注册 2.日记相关功能 ...
    99+
    2023-01-28
    Android日记APP Android毕业设计实例 Android毕业设计
  • android studio开发app实例
    以下是一个简单的Android Studio开发App的实例: 打开Android Studio,并创建一个新项目。 选择一个适当的应用程序名称和包名称,然后选择目标API级别和默认Activity的模板。 在MainActivity...
    99+
    2023-09-05
    android studio android ide
  • Android Studio实现简单计算器开发
    本文实例为大家分享了Android Studio实现简单计算器开的具体代码,供大家参考,具体内容如下 效果展示: 路径和文件: AndroidManifest.xml <...
    99+
    2024-04-02
  • Android studio开发实现计算器功能
    Android移动开发实现简单计算器功能,供大家参考,具体内容如下 前言 android 开发小实验android 移动开发实现 简易计算器功能小白也能轻松上手,复制粘贴就可使用 使...
    99+
    2024-04-02
  • Android Studio怎么实现简易计算器App
    本篇内容主要讲解“Android Studio怎么实现简易计算器App”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Android Studio怎么实现简易计算器App”吧!...
    99+
    2023-06-30
  • Android Studio开发实现简单计算器功能
    本文实例为大家分享了Android Studio开发实现简单计算器的具体代码,供大家参考,具体内容如下 代码: activity_3.xml <xml version="1.0...
    99+
    2024-04-02
  • Android studio开发怎么实现计算器功能
    这篇文章主要介绍“Android studio开发怎么实现计算器功能”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Android studio开发怎么实现计算器功能”文章能帮助大...
    99+
    2023-06-30
  • Android Studio实现简易计算器设计
    本文实例为大家分享了Android Studio实现简易计算器的具体代码,供大家参考,具体内容如下 一、题目 1、如图所示(实际设计,类似此界面样式即可,全屏时,按钮将会纵向拉伸),...
    99+
    2024-04-02
  • [Android Studio]开发APP应用出现软件程序打开闪退的排错
         🟧🟨🟩🟦🟪 Android Debug🟧🟨🟩🟦🟪 Topic  发布...
    99+
    2023-09-05
    android studio android ide
  • Android Studio:一个简单的计算器app的实现过程<初级>
    📌Android Studio 专栏正在持续更新中,案例的原理图解析、各种模块分析💖这里都有哦,同时也欢迎大家订阅专栏,获取更多详细信息哦✊✊✊ ✨个人主页:零小唬...
    99+
    2023-10-10
    android studio android java
  • Android手机开发设计之记事本功能怎么实现
    这篇文章主要介绍“Android手机开发设计之记事本功能怎么实现”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Android手机开发设计之记事本功能怎么实现”文章能帮助大家解决问题。一、需求分析1....
    99+
    2023-06-30
  • Android开发中怎么实现给app设置铃声
    这篇文章给大家介绍Android开发中怎么实现给app设置铃声,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。一、本篇文章的大致内容是调用系统铃声界面选择铃声;播放该选择的铃声;再次调用系统铃声界面时,默认勾选之前已经选...
    99+
    2023-05-31
    android app pp
  • Android Studio怎么实现简易计算器设计
    今天小编给大家分享一下Android Studio怎么实现简易计算器设计的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下...
    99+
    2023-06-30
  • Android手机开发设计之记事本功能
    本文实例为大家分享了Android手机开发设计之记事本功能,供大家参考,具体内容如下 一、需求分析 1.1业务需求分析 近年来,随着生活节奏的加快,工作和生活的双重压力全面侵袭着人们...
    99+
    2024-04-02
  • java实现连连看游戏课程设计
    本文为大家分享了JAVA语言课程设计:连连看小游戏,供大家参考,具体内容如下 1.设计内容 界面中有5*10的界面,图中共有6种不同的图片,每两个相同的图片连接在一起,如果连线中转折...
    99+
    2024-04-02
  • Android开发中如何实现强制更新APP
    这篇文章给大家介绍Android开发中如何实现强制更新APP,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。Android应用强制更新的用途十分广泛,特别上刚上线的应用肯定会存在或多或少的bug,特别是涉及移动支付这一块...
    99+
    2023-05-31
    android pp roi
  • C++实现航空订票系统课程设计
    本文实例为大家分享了C++实现航空订票系统的具体代码,供大家参考,具体内容如下 一、题目 1.录入功能 可以录入航班信息(如航班号,起飞降落时间,城市,座位数,票价) 2.查询功能 ...
    99+
    2024-04-02
  • C++实现图书管理系统课程设计
    本文实例为大家分享了C++实现图书管理系统的具体代码,供大家参考,具体内容如下 大一 C++课设,没有用分文件的形式,只是把菜单页面单独分开了。用的是链表,都是一些基础的东西。另外采...
    99+
    2024-04-02
  • C++实现班车管理系统课程设计
    本文实例为大家分享了C++实现班车管理系统的具体代码,供大家参考,具体内容如下 课程设计要求: 一交通公司,班车系统的数据包括如下两部分: ①班车信息:班交及车号、最大载客数、起点、...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作