Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://raw.githubusercontent.com/getActivity/Donate/master/picture/pay_ali.png
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template_bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: 提交 Bug
about: 请告诉我框架存在的问题,我会协助你解决此问题!
labels: bug
assignees: getActivity

---

## 【警告:请务必按照 issue 模板填写,不要抱有侥幸心理,一旦发现 issue 没有按照模板认真填写,一律直接关闭】

## 问题描述

* 框架版本【必填】:XXX

* 问题描述【必填】:XXX

* 复现步骤【必填】:XXX

* 是否必现【必填】:填是/否

* 出现问题的手机信息【必填】:请填写出现问题的品牌和机型

* 出现问题的安卓版本【必填】:请填写出现问题的 Android 版本

## 请回答

* 是部分机型还是所有机型都会出现【必答】:部分/全部(例如:某为,某 Android 版本会出现)

* AndroidProject 最新的版本是否存在这个问题【必答】:是/否(如果用的是旧版本的话,建议升级看问题是否还存在)

* 是否已经查阅框架文档还未能解决的【必答】:是/否(文档会提供最常见的问题解答,可以看看是否有自己想要的)

* issue 是否有人曾提过类似的问题【必答】:是/否(看看曾经有人提过类似的问题,先参考一下别人是怎么解决的)

* 是否可以通过 AndroidProject 工程来复现该问题【必答】:是/否(排查一下是不是自己的项目代码写得有问题导致的)

* 使用原生的权限 API 是否会出现该问题【必答】:是/否(排查一下是不是 AndroidProject 的代码存在问题导致的)

## 其他

* 提供报错堆栈(如果有报错的话必填,注意不要拿被混淆过的代码堆栈上来)

* 提供截图或视频(根据需要提供,此项不强制)

* 提供解决方案(如果已经解决了的话,此项不强制)
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template_suggest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: 提交建议
about: 请告诉我框架的不足之处,让我做得更好!
labels: help wanted
assignees: getActivity

---

## 【警告:请务必按照 issue 模板填写,不要抱有侥幸心理,一旦发现 issue 没有按照模板认真填写,一律直接关闭】

## 建议收集

* issue 是否有人曾提过类似的问题?【必答】(一旦出现重复提问我将不会再次解答)

* 你觉得框架有什么不足之处?【必答】(你可以描述框架有什么令你不满意的地方)

* 你觉得该怎么去完善会比较好?【非必答】(你可以提供一下自己的想法或者做法供作者参考)
17 changes: 17 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Android CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: ./gradlew build aR
Binary file removed AndroidProject.apk
Binary file not shown.
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

* AndroidProject 已维护三年多的时间,几乎耗尽我所有的业余时间,里面的代码改了再改,改了又改,不断 Review、不断创新、不断改进、不断测试、不断优化,每天都在重复这些枯燥的步骤,但是只有这样才能把这件事做好,因为我相信把同样一件事重复做,迟早有一天可以做好。

* 已经正式投入到多个公司项目实践中,暂时没有发现任何问题或者 Bug,[点击下载 Apk 体验](AndroidProject.apk),又或者扫码下载
* 已经正式投入到多个公司项目实践中,暂时没有发现任何问题或者 Bug,[点击下载 Apk 体验](https://github.com/getActivity/AndroidProject/releases/download/13.1/AndroidProject.apk),又或者扫码下载

![](picture/demo_code.png)

Expand Down Expand Up @@ -96,27 +96,39 @@

#### [代码规范文档请点击这里查看](https://github.com/getActivity/AndroidCodeStandard)

#### [版本适配文档请点击这里查看](https://github.com/getActivity/AndroidVersionAdapter)

#### [常见问题解答请点击这里查看](HelpDoc.md)

#### 作者的其他开源项目

* 网络框架:[EasyHttp](https://github.com/getActivity/EasyHttp) (已集成)
* 权限框架:[XXPermissions](https://github.com/getActivity/XXPermissions) ![](https://img.shields.io/github/stars/getActivity/XXPermissions.svg) ![](https://img.shields.io/github/forks/getActivity/XXPermissions.svg)

* 吐司框架:[ToastUtils](https://github.com/getActivity/ToastUtils) ![](https://img.shields.io/github/stars/getActivity/ToastUtils.svg) ![](https://img.shields.io/github/forks/getActivity/ToastUtils.svg)

* 网络框架:[EasyHttp](https://github.com/getActivity/EasyHttp) ![](https://img.shields.io/github/stars/getActivity/EasyHttp.svg) ![](https://img.shields.io/github/forks/getActivity/EasyHttp.svg)

* 标题栏框架:[TitleBar](https://github.com/getActivity/TitleBar) ![](https://img.shields.io/github/stars/getActivity/TitleBar.svg) ![](https://img.shields.io/github/forks/getActivity/TitleBar.svg)

* 悬浮窗框架:[XToast](https://github.com/getActivity/XToast) ![](https://img.shields.io/github/stars/getActivity/XToast.svg) ![](https://img.shields.io/github/forks/getActivity/XToast.svg)

* Shape 框架:[ShapeView](https://github.com/getActivity/ShapeView) ![](https://img.shields.io/github/stars/getActivity/ShapeView.svg) ![](https://img.shields.io/github/forks/getActivity/ShapeView.svg)

* 权限框架:[XXPermissions](https://github.com/getActivity/XXPermissions) (已集成)
* 语种切换框架:[MultiLanguages](https://github.com/getActivity/MultiLanguages) ![](https://img.shields.io/github/stars/getActivity/MultiLanguages.svg) ![](https://img.shields.io/github/forks/getActivity/MultiLanguages.svg)

* 吐司框架:[ToastUtils](https://github.com/getActivity/ToastUtils) (已集成)
* Gson 解析容错:[GsonFactory](https://github.com/getActivity/GsonFactory) ![](https://img.shields.io/github/stars/getActivity/GsonFactory.svg) ![](https://img.shields.io/github/forks/getActivity/GsonFactory.svg)

* 标题栏框架:[TitleBar](https://github.com/getActivity/TitleBar) (已集成)
* 日志查看框架:[Logcat](https://github.com/getActivity/Logcat) ![](https://img.shields.io/github/stars/getActivity/Logcat.svg) ![](https://img.shields.io/github/forks/getActivity/Logcat.svg)

* Gson 解析容错:[GsonFactory](https://github.com/getActivity/GsonFactory) (已集成)
* Android 版本适配:[AndroidVersionAdapter](https://github.com/getActivity/AndroidVersionAdapter) ![](https://img.shields.io/github/stars/getActivity/AndroidVersionAdapter.svg) ![](https://img.shields.io/github/forks/getActivity/AndroidVersionAdapter.svg)

* Shape 框架:[ShapeView](https://github.com/getActivity/ShapeView) (已集成)
* Android 代码规范:[AndroidCodeStandard](https://github.com/getActivity/AndroidCodeStandard) ![](https://img.shields.io/github/stars/getActivity/AndroidCodeStandard.svg) ![](https://img.shields.io/github/forks/getActivity/AndroidCodeStandard.svg)

* 悬浮窗框架:[XToast](https://github.com/getActivity/XToast) (未集成)
* Studio 精品插件:[StudioPlugins](https://github.com/getActivity/StudioPlugins) ![](https://img.shields.io/github/stars/getActivity/StudioPlugins.svg) ![](https://img.shields.io/github/forks/getActivity/StudioPlugins.svg)

* 国际化框架:[MultiLanguages](https://github.com/getActivity/MultiLanguages) (未集成)
* 表情包大集合:[EmojiPackage](https://github.com/getActivity/EmojiPackage) ![](https://img.shields.io/github/stars/getActivity/EmojiPackage.svg) ![](https://img.shields.io/github/forks/getActivity/EmojiPackage.svg)

* 日志查看框架:[Logcat](https://github.com/getActivity/Logcat) (未集成)
* 省市区 Json 数据:[ProvinceJson](https://github.com/getActivity/ProvinceJson) ![](https://img.shields.io/github/stars/getActivity/ProvinceJson.svg) ![](https://img.shields.io/github/forks/getActivity/ProvinceJson.svg)

#### 微信公众号:Android轮子哥

Expand Down
20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ android {
])
// 调试模式下只保留一种架构的 so 库,提升打包速度
ndk {
abiFilters 'armeabi-v7a'
abiFilters 'armeabi-v7a','x86_64'
}
}

Expand Down Expand Up @@ -95,7 +95,7 @@ android {
// armeabi:万金油架构平台(占用率:0%)
// armeabi-v7a:曾经主流的架构平台(占用率:10%)
// arm64-v8a:目前主流架构平台(占用率:95%)
abiFilters 'armeabi-v7a', 'arm64-v8a'
abiFilters 'armeabi-v7a', 'arm64-v8a','x86_64'
}
}
}
Expand Down Expand Up @@ -139,16 +139,16 @@ dependencies {
implementation project(':library:umeng')

// 权限请求框架:https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:12.3'
implementation 'com.github.getActivity:XXPermissions:20.0'

// 标题栏框架:https://github.com/getActivity/TitleBar
implementation 'com.github.getActivity:TitleBar:9.2'
implementation 'com.github.getActivity:TitleBar:10.5'

// 吐司框架:https://github.com/getActivity/ToastUtils
implementation 'com.github.getActivity:ToastUtils:9.5'
// 吐司框架:https://github.com/getActivity/Toaster
implementation 'com.github.getActivity:Toaster:12.6'

// 网络请求框架:https://github.com/getActivity/EasyHttp
implementation 'com.github.getActivity:EasyHttp:10.2'
implementation 'com.github.getActivity:EasyHttp:13.0'
// OkHttp 框架:https://github.com/square/okhttp
// noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
Expand All @@ -159,7 +159,7 @@ dependencies {
implementation 'com.github.getActivity:GsonFactory:5.2'

// Shape 框架:https://github.com/getActivity/ShapeView
implementation 'com.github.getActivity:ShapeView:6.0'
implementation 'com.github.getActivity:ShapeView:9.3'

// AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt
implementation 'org.aspectj:aspectjrt:1.9.6'
Expand All @@ -170,7 +170,7 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'

// 沉浸式框架:https://github.com/gyf-dev/ImmersionBar
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'

// 手势 ImageView:https://github.com/Baseflow/PhotoView
implementation 'com.github.Baseflow:PhotoView:2.3.0'
Expand All @@ -194,7 +194,7 @@ dependencies {
implementation 'me.relex:circleindicator:2.1.6'

// 腾讯 MMKV:https://github.com/Tencent/MMKV
implementation 'com.tencent:mmkv-static:1.2.10'
implementation 'com.tencent:mmkv:2.0.2'

// 内存泄漏监测框架:https://github.com/square/leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hjq/demo/action/StatusAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ default void showError(StatusLayout.OnRetryListener listener) {
NetworkInfo info = manager.getActiveNetworkInfo();
// 判断网络是否连接
if (info == null || !info.isConnected()) {
showLayout(R.drawable.status_nerwork_ic, R.string.status_layout_error_network, listener);
showLayout(R.drawable.status_network_ic, R.string.status_layout_error_network, listener);
return;
}
}
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/hjq/demo/action/TitleBarAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ public interface TitleBarAction extends OnTitleBarListener {
/**
* 左项被点击
*
* @param view 被点击的左项View
* @param titleBar 被点击的左项View
*/
@Override
default void onLeftClick(View view) {}
default void onLeftClick(TitleBar titleBar) {}

/**
* 标题被点击
*
* @param view 被点击的标题View
* @param titleBar 被点击的标题View
*/
@Override
default void onTitleClick(View view) {}
default void onTitleClick(TitleBar titleBar) {}

/**
* 右项被点击
*
* @param view 被点击的右项View
* @param titleBar 被点击的右项View
*/
@Override
default void onRightClick(View view) {}
default void onRightClick(TitleBar titleBar) {}

/**
* 设置标题栏的标题
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/com/hjq/demo/action/ToastAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import androidx.annotation.StringRes;

import com.hjq.toast.ToastUtils;
import com.hjq.toast.Toaster;


/**
* author : Android 轮子哥
Expand All @@ -13,14 +14,14 @@
public interface ToastAction {

default void toast(CharSequence text) {
ToastUtils.show(text);
Toaster.show(text);
}

default void toast(@StringRes int id) {
ToastUtils.show(id);
Toaster.show(id);
}

default void toast(Object object) {
ToastUtils.show(object);
Toaster.show(object);
}
}
5 changes: 3 additions & 2 deletions app/src/main/java/com/hjq/demo/aop/CheckNetAspect.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import com.hjq.demo.R;
import com.hjq.demo.manager.ActivityManager;
import com.hjq.toast.ToastUtils;

import com.hjq.toast.Toaster;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
Expand Down Expand Up @@ -42,7 +43,7 @@ public void aroundJoinPoint(ProceedingJoinPoint joinPoint, CheckNet checkNet) th
NetworkInfo info = manager.getActiveNetworkInfo();
// 判断网络是否连接
if (info == null || !info.isConnected()) {
ToastUtils.show(R.string.common_network_hint);
Toaster.show(R.string.common_network_hint);
return;
}
}
Expand Down
45 changes: 21 additions & 24 deletions app/src/main/java/com/hjq/demo/app/AppActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.hjq.demo.action.ToastAction;
import com.hjq.demo.http.model.HttpData;
import com.hjq.demo.ui.dialog.WaitDialog;
import com.hjq.http.config.IRequestApi;
import com.hjq.http.listener.OnHttpListener;

import okhttp3.Call;
Expand Down Expand Up @@ -178,7 +179,7 @@ public TitleBar getTitleBar() {
}

@Override
public void onLeftClick(View view) {
public void onLeftClick(TitleBar titleBar) {
onBackPressed();
}

Expand All @@ -194,33 +195,29 @@ public void finish() {
overridePendingTransition(R.anim.left_in_activity, R.anim.left_out_activity);
}

/**
* {@link OnHttpListener}
*/
@Override
public void onHttpStart(@NonNull IRequestApi api) {
showDialog();
}

@Override
public void onStart(Call call) {
showDialog();
}
@Override
public void onHttpSuccess(@NonNull Object result) {
if (result instanceof HttpData) {
toast(((HttpData<?>) result).getMessage());
}
}

@Override
public void onSucceed(Object result) {
if (result instanceof HttpData) {
toast(((HttpData<?>) result).getMessage());
}
}
@Override
public void onHttpFail(@NonNull Throwable throwable) {
toast(throwable.getMessage());
}

@Override
public void onFail(Exception e) {
toast(e.getMessage());
}

@Override
public void onEnd(Call call) {
hideDialog();
}
@Override
public void onHttpEnd(@NonNull IRequestApi api) {
hideDialog();
}

@Override
@Override
protected void onDestroy() {
super.onDestroy();
if (isShowDialog()) {
Expand Down
Loading