Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
youth5201314 committed Feb 13, 2017
1 parent 23aa457 commit aaa1430
Show file tree
Hide file tree
Showing 139 changed files with 11,025 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ captures/

# Keystore files
*.jks
/.idea
/gradle
/gradle.properties
/gradlew
/gradlew.bat
/app/app.iml
/xframe/xframe.iml
89 changes: 89 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

#XFrame Android快速开发框架

>从小的功能做起,只做必要的封装,让开发更加简单 ———— XFrame
## XFrame简介

**XFrame**你可以理解成是一个Android开发的工具集合。我在写XFrame时就明确了方向,我不会去封装http、图片加载、ioc、orm 等这些听起来非常不错的想法。
为什么呢?这些功能现在都有很强大的框架,我也做不到那么好,而且更新很快,隔段时间就有新的框架出现,每个人都有自己的选择,我不想使用者因为这个局限大家。
我的本意是为了通过封装Android中一些的复杂操作而达到简化Android应用级开发的成本,用最少的代码实现更多的功能,我们只封装那些大部分应用必须用到但有总是增加我们繁琐的工作量。也许市面上单个功能模块有现成,而且很多!我们总是需要去挨着选择,但他们之间并不一定兼容,我们需要浪费在每个项目中的修改、拷贝、维护时间,而XFrame算是你还不错的选择对象!

[详细文档请前往wiki](https://github.com/youth5201314/XFrame/wiki)

## 特性

**XFrame**主要有这些功能:

- [x] `XLog`:可输出漂亮容易查看的日志,支持Json、Xml、Map、List等格式输出,可全局配置
- [x] `XLoadingView`:简单实用的页面状态统一管理 ,加载中、无网络、无数据、出错等状态的随意切换
- [x] `XLoadingDialog`:简单实现加载等待对话框
- [x] `XPermission`:简化Android 6.0 动态权限管理的操作
- [x] `XRecyclerViewAdapter`:一个用于RecyclerView Adapter的开发库,包含添加Header,Footer,加载更多,加载失败,加载到底和支持多种布局
* `XUpdateApp`:检测更新App,后台下载,应用自动安装
* `XRouter`:组件化路由框架
* `XCache`:缓存
* `XCrash`:异常崩溃统一管理
* `XTabPage`:Tab+Fragment快速实现
* `XWebView`:WebView UI与常见的功能封装
- [x] `XStatusBar`:实现沉浸式状态栏
- [x] `XSplashView`:闪屏页或者广告页
- [x] `XToast`:简单的吐司使用
- [x] `Utils工具类集合`:内置常用工具类
- [x] `自定义View`:内置常用自定义控件


## Thanks

感谢以下开源项目的作者,本项目中有些功能受你们项目灵感的启发,有些功能也用到你们的代码完成。对此如果有什么意见请与我联系!再次感谢!

- [orhanobut/logger](https://github.com/orhanobut/logger)
- [laobie/StatusBarUtil](https://github.com/laobie/StatusBarUtil)
- [GrenderG/Toasty](https://github.com/GrenderG/Toasty)
- [Blankj/AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode)
- [l123456789jy/Lazy](https://github.com/l123456789jy/Lazy)
- [Jude95/EasyRecyclerView](https://github.com/Jude95/EasyRecyclerView)
- [jkyeo/Android-SplashView](https://github.com/jkyeo/Android-SplashView)
- [czy1121/loadinglayout](https://github.com/czy1121/loadinglayout)

























## License

```
Copyright 2017 youth5201314
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
27 changes: 27 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.youth.xf"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':xframe')
compile 'com.android.support:design:25+'
compile 'com.youth.banner:banner:+'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\android\android-sdk-windows/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.youth.xframe;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.youth.baseframe", appContext.getPackageName());
}
}
36 changes: 36 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.youth.xf">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.demo.XLogDemoActivity" />
<activity android:name=".ui.demo.XPermissionDemoActivity" />
<activity android:name=".ui.demo.XRecyclerViewAdapterActivity" />
<activity android:name=".ui.demo.XMultiTypeAdapterActivity" />
<activity android:name=".ui.demo.XLoadingDialogActivity" />
<activity android:name=".ui.demo.XToastActivity" />
<activity android:name=".ui.demo.XLoadingViewActivity" />
<activity android:name=".ui.demo.XLoadingViewActivity2"></activity>
</application>

</manifest>
12 changes: 12 additions & 0 deletions app/src/main/java/com/youth/xf/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.youth.xf;

import com.youth.xframe.base.XApplication;
import com.youth.xframe.XFrame;

public class App extends XApplication {
@Override
public void onCreate() {
super.onCreate();
XFrame.initXLog().setTag("Test");
}
}
49 changes: 49 additions & 0 deletions app/src/main/java/com/youth/xf/BaseActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.youth.xf;

import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.MenuItem;

import com.youth.xframe.base.XActivity;
import com.youth.xframe.utils.statusbar.XStatusBar;

/**
* 必须继承XActivity,你也可以每个都继承XActivity,这里进行再次封装是为了便于你维护和增加你需要的方法
*/
public abstract class BaseActivity extends XActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String title=getIntent().getStringExtra("title");
if (TextUtils.isEmpty(title))
title=getString(R.string.app_name);
ActionBar bar=getSupportActionBar();
bar.setTitle(title);
if (!title.equals(getString(R.string.app_name)))
bar.setDisplayHomeAsUpEnabled(true);
}

@Override
public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
setStatusBar();
}

protected void setStatusBar() {
XStatusBar.setColor(this, getResources().getColor(R.color.colorPrimary));
}

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
if(item.getItemId() == android.R.id.home)
{
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/youth/xf/BaseFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.youth.xf;


import com.youth.xframe.base.XFragment;


public abstract class BaseFragment extends XFragment {
}
73 changes: 73 additions & 0 deletions app/src/main/java/com/youth/xf/bean/News.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.youth.xf.bean;

/**
* Created by Administrator on 2017/1/17.
*/

public class News {
/** 单图布局样式 */
public static final int TYPE_SINGLE_PICTURE = 0;
/** 无图布局样式 */
public static final int TYPE_NONE_PICTURE = 1;

private int newsType;
private String title;
private String imageUrl;
private String author;
private String time;

public News(int newsType, String title, String imageUrl, String author, String time) {
this.newsType = newsType;
this.title = title;
this.imageUrl = imageUrl;
this.author = author;
this.time = time;
}

public News(int newsType, String title, String author, String time) {
this.newsType = newsType;
this.title = title;
this.author = author;
this.time = time;
}

public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public String getTime() {
return time;
}

public void setTime(String time) {
this.time = time;
}

public String getImageUrl() {
return imageUrl;
}

public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}

public int getNewsType() {
return newsType;
}

public void setNewsType(int newsType) {
this.newsType = newsType;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}
}
30 changes: 30 additions & 0 deletions app/src/main/java/com/youth/xf/data/NewDataSource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.youth.xf.data;

import com.youth.xf.bean.News;

import java.util.ArrayList;

public class NewDataSource {
private static ArrayList<News> newsList;

//测试数据
public static ArrayList<News> getNewsList(){
if(null==newsList || newsList.isEmpty()){
newsList = new ArrayList<>();
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"智能手机行业正处于关键转折点,下一战场会在哪里?","https://pic.36krcnd.com/avatar/201701/17062818/1ucsedy4pdb4aqyu.jpg!heading","缪定纯•明星公司","58分钟前"));
newsList.add(new News(News.TYPE_NONE_PICTURE,"创始团队如何保持对公司的控制权?Snapchat这里可能有一份指南","36kr","2017.02.04"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"创投机构回应上海政府风投补偿:返税意义更大","http://n.sinaimg.cn/tech/transform/20160126/KR43-fxnuvxc1994221.jpg","投资,职场","2017-01-16 10:36"));
newsList.add(new News(News.TYPE_NONE_PICTURE,"上海新规:天使投资有损失可获补偿 最高补六成","段旭","2017.02.04"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"马云说新零售是在拯救线下 实业大佬会同意吗","https://pic.36krcnd.com/avatar/201701/12073251/vw1wo7bw0l73j8zp.jpg","早期项目","2017-01-16 10:36 "));
newsList.add(new News(News.TYPE_NONE_PICTURE,"中国万吨巡洋舰开始下饺子,俄海军却至少还要等十年","译东西","2017.02.04"));
newsList.add(new News(News.TYPE_NONE_PICTURE,"高管集体离职致Twitter股价开盘跳水逾6%","社交媒体","2016.02.04"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"传格力为推自家手机与门禁联动 员工不买难进门","http://p2.qhimg.com/t019db1294a2e7eb1db.jpg?size=600x400","前沿科技","2017-01-16 10:36"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"安检繁琐无用?来看看这些缴获的违禁品","http://p9.qhimg.com/t01c2084745dc313fd1.jpg","投资,职场","2013.02.04"));
newsList.add(new News(News.TYPE_NONE_PICTURE,"清华控股将收购两家半导体制造公司","36kr","2017.02.04"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"雷军称小米今年目标破千亿,是实力还是吹牛皮?","http://p7.qhimg.com/t0139528269ae1ac5a0.jpg","前沿科技","2017-01-16 10:36"));
newsList.add(new News(News.TYPE_NONE_PICTURE,"平安银行陷年终奖风波 最悲伤年终奖——1.5元","社交媒体","2017.01.04"));
newsList.add(new News(News.TYPE_SINGLE_PICTURE,"人工智能会取代人类?别担心,你想多了","http://p7.qhimg.com/t01e82f909e7c2c350c.jpg","36kr","2017.02.04"));
}
return newsList;
}
}
Loading

0 comments on commit aaa1430

Please sign in to comment.