Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
youth5201314 committed Mar 23, 2017
1 parent 2f3f48b commit 808843e
Show file tree
Hide file tree
Showing 33 changed files with 1,399 additions and 153 deletions.
11 changes: 6 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#XFrame — Android快速开发框架(还在整理中,可以先star,先不要用于量产模式)
##### XFrame — Android快速开发框架(还在整理中,可以先star,先不要用于量产模式)

>从小的功能做起,只做必要的封装,让开发更加简单 ———— XFrame
Expand All @@ -24,23 +24,23 @@
- [x] `XRecyclerViewAdapter`:一个用于RecyclerView Adapter的开发库,包含添加Header,Footer,加载更多,加载失败,加载到底和支持多种布局
<!-- * `XUpdateApp`:检测更新App,后台下载,应用自动安装 -->
<!-- * `XRouter`:组件化路由框架 -->
<!-- * `XCache`:缓存 -->
<!-- * `XCrash`:异常崩溃统一管理 -->
<!-- * `XTabPage`:Tab+Fragment快速实现 -->
<!-- * `XWebView`:WebView UI与常见的功能封装 -->
- [x] `XWebView`:WebView UI与常见的功能封装
- [x] `XCache`:缓存
- [x] `XStatusBar`:实现沉浸式状态栏
- [x] `XSplashView`:闪屏页或者广告页
- [x] `XToast`:简单的吐司使用
- [x] `Utils工具类集合`:内置常用工具类
- [x] `自定义View`:内置常用自定义控件

##使用步骤
## 使用步骤

#### Step 1.依赖XFrame
Gradle
```groovy
dependencies{
compile 'com.youth.xframe:xframe:1.0.1'
compile 'com.youth.xframe:xframe:1.0.2'
}
```
或者引用本地lib
Expand All @@ -62,6 +62,7 @@ compile project(':xframe')
- [Jude95/EasyRecyclerView](https://github.com/Jude95/EasyRecyclerView)
- [jkyeo/Android-SplashView](https://github.com/jkyeo/Android-SplashView)
- [czy1121/loadinglayout](https://github.com/czy1121/loadinglayout)
- [yangfuhai/ASimpleCache](https://github.com/yangfuhai/ASimpleCache)



Expand Down
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':xframe')
compile 'com.android.support:design:25+'
compile 'com.android.support:design:25.2.0'
compile 'com.youth.banner:banner:+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'cat.ereza:customactivityoncrash:1.5.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<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 android:name=".ui.demo.XLoadingViewActivity2" />
<activity android:name=".ui.demo.XCacheActivity"></activity>
</application>

</manifest>
4 changes: 4 additions & 0 deletions app/src/main/java/com/youth/xf/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import com.youth.xframe.base.XApplication;
import com.youth.xframe.XFrame;

import cat.ereza.customactivityoncrash.CustomActivityOnCrash;

public class App extends XApplication {
@Override
public void onCreate() {
super.onCreate();
CustomActivityOnCrash.install(this);

XFrame.initXLog();
XFrame.initXLoadingView()
.setErrorViewResId(R.layout._loading_layout_error);
Expand Down
28 changes: 20 additions & 8 deletions app/src/main/java/com/youth/xf/bean/News.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.youth.xf.bean;

/**
* Created by Administrator on 2017/1/17.
*/
import java.io.Serializable;

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

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

private int newsType;
private String title;
Expand Down Expand Up @@ -70,4 +73,13 @@ public String getTitle() {
public void setTitle(String title) {
this.title = title;
}

@Override
public String toString() {
return "newsType=" + newsType + "\n" +
"title =" + title + "\n" +
"imageUrl =" + imageUrl + "\n" +
"author =" + author + "\n" +
"time = " + time;
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/youth/xf/ui/DemoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.youth.xf.BaseFragment;
import com.youth.xf.R;
import com.youth.xf.ui.demo.XCacheActivity;
import com.youth.xf.ui.demo.XLoadingDialogActivity;
import com.youth.xf.ui.demo.XLoadingViewActivity;
import com.youth.xf.ui.demo.XLogDemoActivity;
Expand Down Expand Up @@ -60,6 +61,9 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
case 5:
intent.setClass(getActivity(),XLoadingViewActivity.class);
break;
case 6:
intent.setClass(getActivity(),XCacheActivity.class);
break;
}
intent.putExtra("title",demo[position]);
startActivity(intent);
Expand Down
73 changes: 73 additions & 0 deletions app/src/main/java/com/youth/xf/ui/demo/XCacheActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.youth.xf.ui.demo;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.youth.xf.BaseActivity;
import com.youth.xf.R;
import com.youth.xf.bean.News;
import com.youth.xframe.cache.XCache;
import com.youth.xframe.utils.XOutdatedUtils;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Arrays;

public class XCacheActivity extends BaseActivity {

TextView cacheText;
ImageView cacheImage;
XCache xCache;

@Override
public int getLayoutId() {
return R.layout.activity_xcache;
}

@Override
public void initData(Bundle savedInstanceState) {

}

@Override
public void initView() {
cacheText = (TextView) findViewById(R.id.cacheText);
cacheImage = (ImageView) findViewById(R.id.cacheImage);
xCache=XCache.get(this);
xCache.put("string","缓存普通字符串");
News news=new News(News.TYPE_SINGLE_PICTURE,"智能手机行业正处于关键转折点,下一战场会在哪里?","https://pic.36krcnd.com/avatar/201701/17062818/1ucsedy4pdb4aqyu.jpg!heading","缪定纯•明星公司","58分钟前");
xCache.put("news",news);//保存序列化对象
xCache.put("bitmap", BitmapFactory.decodeResource(getResources(), R.mipmap.computer));
xCache.put("drawable", XOutdatedUtils.getDrawable(R.mipmap.computer));
xCache.put("byte", "缓存byte".getBytes());//字节数组,使用场景很多,这里只做测试
/**
* 关于实体类保存,建议用json字符串保存,效果更佳,兼容性更好
*/
}

public void onClick(View v) {
switch (v.getId()){
case R.id.button1:
cacheText.setText(xCache.getAsString("string"));
break;
case R.id.button2:
cacheImage.setImageBitmap(xCache.getAsBitmap("bitmap"));
break;
case R.id.button3:
cacheImage.setImageDrawable(xCache.getAsDrawable("drawable"));
break;
case R.id.button4:
cacheText.setText(((News)xCache.getAsObject("news")).toString());
break;
case R.id.button5:
cacheText.setText(new String(xCache.getAsBinary("byte")));
break;
}
}

}
21 changes: 19 additions & 2 deletions app/src/main/java/com/youth/xf/ui/demo/XLoadingDialogActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.youth.xf.ui.demo;

import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -42,11 +43,27 @@ public void show(View view) {
break;
case R.id.loading2:
Toast.makeText(this,"3秒后自动取消",Toast.LENGTH_SHORT).show();
XLoadingDialog.with(this).setCanceled(false).show();
XLoadingDialog.with(this)
.setBackgroundColor(Color.parseColor("#aa000000"))
.setMessageColor(Color.WHITE)
.setCanceled(false)
.show();
handler.sendEmptyMessageDelayed(1,3000);
break;
case R.id.loading3:
XLoadingDialog.with(this).setMessage("我正在加载中...").show();
XLoadingDialog.with(this)
.setOrientation(XLoadingDialog.HORIZONTAL)
.setMessage("我正在加载中...")
.show();
break;
case R.id.loading4:
XLoadingDialog.with(this)
.setCanceled(false)
.setOrientation(XLoadingDialog.HORIZONTAL)
.setBackgroundColor(Color.parseColor("#aa000000"))
.setMessageColor(Color.WHITE)
.setMessage("我正在加载中...")
.show();
break;
}

Expand Down
Loading

0 comments on commit 808843e

Please sign in to comment.