阳光沙滩-课程笔记 阳光沙滩-课程笔记
首页 (opens new window)
VIP (opens new window)
  • 课程笔记

    • 《Android项目喜马拉雅FM》
    • 《Android项目领券联盟》
    • 《AndroidStudio技巧》
    • 《Android自定义控件》
    • 《Android开发基础》
    • 《Android约束布局》
    • 《AOSP安卓开源项目》
    • 《RecyclerView》
  • 《领券联盟Nuxt.js》
  • 《博客系统后台管理系统vue.js》
  • 《博客系统门户Nuxt.js》
  • 《博客系统前后端分离后台》
  • 《博客系统部署》
  • 《摸鱼君后台》
  • 《OTA升级管理系统》
  • 阳光沙滩API (opens new window)
  • 领券联盟API (opens new window)
  • 博客系统API (opens new window)
首页 (opens new window)
VIP (opens new window)
  • 课程笔记

    • 《Android项目喜马拉雅FM》
    • 《Android项目领券联盟》
    • 《AndroidStudio技巧》
    • 《Android自定义控件》
    • 《Android开发基础》
    • 《Android约束布局》
    • 《AOSP安卓开源项目》
    • 《RecyclerView》
  • 《领券联盟Nuxt.js》
  • 《博客系统后台管理系统vue.js》
  • 《博客系统门户Nuxt.js》
  • 《博客系统前后端分离后台》
  • 《博客系统部署》
  • 《摸鱼君后台》
  • 《OTA升级管理系统》
  • 阳光沙滩API (opens new window)
  • 领券联盟API (opens new window)
  • 博客系统API (opens new window)
  • Android开发基础

  • Android项目-喜马拉雅FM

  • Android项目-领券联盟

    • 领券联盟
    • 项目创建
      • 页面分析以及导航栏的实现
      • 修改样式和颜色
      • 主界面实现页面切换
      • 使用RadioGroup+RadioButton实现导航栏
      • 编写logUtils
      • 定义首页相关接口
      • 编写首页布局
    • AndroidStudio使用技巧

    • Android-Jetpack

    • ConstraintLayout

    • RecyclerView

    • 自定义控件系列

    • AOSP

    • ADB

    • 安卓
    • Android项目-领券联盟
    TrillGates
    2021-09-16
    目录

    项目创建

    # 领券联盟-项目创建

    相关文章

    • api文档 (opens new window)
    • 概述 (opens new window)

    # 创建项目

    图片描述

    这里我们还是使用java来编写,如果使用Kotlin的同学可以看已经上传的代码。

    代码地址:

    github:

    https://github.com/TrillGates/TicketUnion (opens new window)

    码云

    https://gitee.com/sunofbeaches/TicketUnion (opens new window)

    # 创建相关的包

    图片描述

    前面我们概述里提到,我们使用mvp的结构,所以从建包上我们也能很明了地看出来。

    • base 一些基类,比如说BaseApplication,BaseActivity,BaseFragment,BaseAdapter....
    • model 数据相关的,比如说Bean类
    • presenter 逻辑层相关的类
    • ui 这里指的存放activity,fragment,自定义控件,适配器这些,与后面的view不一样
    • utils 工具类相关
    • view 与前面的ui不一样,这个view是mvp的view,也就是跟回调接口相关的类

    MVP

    # 添加相关依赖

    跟项目相关的开源框架,我们在前面的概述里已经提到了,同学们可以去看前面的概述。

    • 图片加载框架:Glide (opens new window)
    • 网络请求框架:Retrofit (opens new window)、okhttp (opens new window)
    • UI注入框架:ButterKnife (opens new window)
    • 二维码框架:Zxing (opens new window)、RxTool (opens new window)
    • 刷新/加载更多UI框架:tkrefreshlayout (opens new window)
    • 导航和指示器:MaterialDesign (opens new window)

    添加仓库地址

           maven { url "https://jitpack.io" }
    
    1

    在gradle里添加

    java版本添加如下:

        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'com.google.android.material:material:1.2.0-alpha03'
        implementation 'com.squareup.retrofit2:retrofit:2.6.3'
        implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
        implementation 'com.github.bumptech.glide:glide:4.10.0'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
        implementation 'com.lcodecorex:tkrefreshlayout:1.0.7'
        implementation 'androidx.recyclerview:recyclerview:1.1.0'
        implementation 'com.jakewharton:butterknife:10.2.1'
        annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
        //基础工具库
        implementation "com.github.tamsiree.RxTool:RxKit:v2.4.1"
        //UI库
        implementation "com.github.tamsiree.RxTool:RxUI:v2.4.1"
        //(依赖RxUI库时,需要额外依赖 cardview 库)
        //noinspection GradleCompatible
        implementation 'com.android.support:cardview-v7:27.1.1'
        //功能库(Zxing扫描与生成二维码条形码 支付宝 微信)
        implementation "com.github.tamsiree.RxTool:RxFeature:v2.4.1"
        implementation 'com.google.zxing:android-core:3.3.0'
        implementation 'com.google.zxing:core:3.3.2'
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26

    kotlin版本添加如下:

        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'androidx.core:core-ktx:1.0.2'
        implementation 'com.google.android.material:material:1.2.0-alpha03'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
        implementation 'com.squareup.retrofit2:retrofit:2.6.3'
        implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
        implementation 'com.github.bumptech.glide:glide:4.10.0'
        kapt 'com.github.bumptech.glide:compiler:4.10.0'
        implementation 'com.lcodecorex:tkrefreshlayout:1.0.7'
        implementation 'androidx.recyclerview:recyclerview:1.1.0'
        implementation 'com.jakewharton:butterknife:10.2.1'
        kapt 'com.jakewharton:butterknife-compiler:10.2.1'
        //基础工具库
        implementation "com.github.tamsiree.RxTool:RxKit:v2.4.1"
        //UI库
        implementation "com.github.tamsiree.RxTool:RxUI:v2.4.1"
        //(依赖RxUI库时,需要额外依赖 cardview 库)
        //noinspection GradleCompatible
        implementation 'com.android.support:cardview-v7:27.1.1'
        //功能库(Zxing扫描与生成二维码条形码 支付宝 微信)
        implementation "com.github.tamsiree.RxTool:RxFeature:v2.4.1"
    
        implementation 'com.google.zxing:android-core:3.3.0'
        implementation 'com.google.zxing:core:3.3.2'
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    编辑 (opens new window)
    #领券联盟
    领券联盟
    页面分析以及导航栏的实现

    ← 领券联盟 页面分析以及导航栏的实现→

    Theme by Vdoing | Copyright © 2022-2022 sunofbeach.net
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式