• Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    Java
  • Created over 9 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Corepage is a page switch framework based on Fragment

Corepage is a page switch framework based on Fragment

Download
A page switch framework based on Fragment, you can open a page use just a method.It can be used in both Activity andFragment if you make your custom Activity extends BaseActivity and your custom Fragment extends BaseFragment.And use BaseApplication as your Application.

Changelog

Current version 0.0.5 released on 21th August 2015

See details in CHANGELOG

Notices

  • All your Activity must extends BaseActivity,All your Fragment must extends BaseFragment,use package.YourApplication as your Application name and use CoreConfig.init() in the override method onCreate() to init.
  • Your entry Activity doesn't need use setContentView method to set a view,all your views should be set in your Fragments.
  • Page jump based on method openpage,you can set an animation type ,weather add to back stack,open a new activity or not.
  • If you need the page return a result ,you should use openPageForResult to open page,then use setFragmentResult to set result and use popToBack to retuen. Override onFragmentResult method to get the return result.
  • All your fragment pages need configed in assets/page.json,page name and class is required,page params is option,the params will be used through Bundle
  • Full details and documentation can be found in the library project

Examples

I have provided a sample .
See samples here on Github
To run Sample application, simply clone the repository and use android studio to compile, install it on connected device

Usage

Gradle

dependencies {
  compile 'cn.edu.zafu:corepage:0.0.5'
}

config in assets/page.json

[
  {
    "name": "page1",
    "class": "cn.edu.zafu.corepage.sample.PageFragment1",
    "params": ""
  },
  {
    "name": "page2",
    "class": "cn.edu.zafu.corepage.sample.PageFragment2",
    "params": {
      "key1":"value1",
      "key2":"value2"
    }
  }
]

init config

public class YourApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        CoreConfig.init(this);
    }
}
 <application
        android:name=".YourApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    </application>

open a page

openPage(pageName,bundle,coreAnim);
// CoreAnim.slide, CoreAnim.fade, CoreAnim.present, CoreAnim.none
openPage(pageName,bundle,coreAnim,isAddToBackStack);
openPage(pageName,bundle,coreAnim,isAddToBackStack,isNewActivity);

open a page for result

//call this in the opener fragment
openPageForResult(pageName,bundle,coreAnim,requestCode);

//call this in the opened fragment to set result and return
setFragmentResult(500,intent);
popToBack(); 

//Override this method in the opener fragment to get the result
public void onFragmentResult(int requestCode, int resultCode, Intent data) {
 super.onFragmentResult(requestCode, resultCode, data);
} 

support OpenAtlas

if you need to support OpenAtlas,before you call the method such as openPage,you need to set a bundle classloader

ClassLoader bundleClassLoader = Atlas.getInstance().getBundleClassLoader(bundlepkgName);
CoreConfig.setIsOpenAtlas(true);
CoreConfig.setBundleClassLoader(bundleClassLoader);

custom animation

if you need to support custom animation,you can use it this way

int anim[]= {R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right};
openPage("test1",null, anim);

read extra page json

private String pageJson="[" +
            "  {" +
            "    'name': 'test4'," +
            "    'class': 'cn.edu.zafu.corepage.sample.TestFragment4'," +
            "    'params': ''" +
            "  }]";
CoreConfig.readConfig(pageJson);

or init with the json,this will read both the page.json in directory assets and the String you given

private String pageJson="[" +
            "  {" +
            "    'name': 'test4'," +
            "    'class': 'cn.edu.zafu.corepage.sample.TestFragment4'," +
            "    'params': ''" +
            "  }]";
CoreConfig.init(this, pageJson);

License

Copyright 2015 ZhangQu Li

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.

More Repositories

1

CoreLink

Android 开发中的日常积累
Java
2,724
star
2

CoreProgress

OkHttp upload and download progress support
Java
517
star
3

Camera

二代身份证信息识别
Java
370
star
4

PinyinIME

google 拼音输入法 android studio可编译
C++
196
star
5

dlfcn_compat

兼容Android 7.0 dlfcn(dlopen、dlsym、dlclose、dlerror)
C++
141
star
6

cronet

cronet is a framework that using chromium net to send network request for android
Java
135
star
7

CoreUtil

CoreUtil is an android tools library which contains some useful utilities
Java
113
star
8

AndroidGradlePluginCodeViewer

83
star
9

QuickMultidex

一种在Dalvik虚拟机上多Dex首次加载的优化方案,支持4.1~4.4
Java
74
star
10

android-bundle-support

增强型apk analyzer,支持ap_, ap, aar, aab, jar, so, awb, aab, apks等zip文件使用apk analyzer打开, android studio插件
Java
60
star
11

plugin-veridex

android 私有api调用检测
Groovy
56
star
12

AndroidGradlePluginCompat

android gradle plugin兼容库
Groovy
55
star
13

TensorflowLite

Tensorflow Lite Android Library
Java
41
star
14

OpenAtlasDemo

OpenAtlasDemo
Java
33
star
15

NDKMemoryLeakSample

NDK内存泄露检测
C++
32
star
16

aapt-cmake-buildscript

aapt cmake构建系统,支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows版本,支持x86和x86_64构建
CMake
29
star
17

android-gradle-plugin-transform-patch

android gradle plugin transform patch
Groovy
28
star
18

VoiceAndVideo

即时音视频解决方案
Java
24
star
19

dexdeps

查看dex中class, field, method内部与外部依赖
Java
24
star
20

zafu_jwc

正方教务课程表抓取
Java
23
star
21

MultiChannel

多渠道打包Gradle插件
Groovy
22
star
22

AndroidScreenAdapter

a tool which adapts android screens
Java
22
star
23

HttpDNS

修改自新浪HttpDNSLib,改项目结构为Android Studio gradle项目,底层请求使用OkHTTP
Java
22
star
24

flutter_lldb

flutter engine remote debug with lldb
Python
22
star
25

plugin-flutter-patch

flutter patch generator in gradle
Java
22
star
26

QFix

Java
20
star
27

plugin-flutter-armeabi

flutter armeabi兼容
Groovy
20
star
28

flutter_engine_build

Flutter Engine构建产物归档
Python
19
star
29

PriorityOkHttp

支持优先级调度的OkHttp
Java
19
star
30

CorePublish

maven发布插件和bintray发布插件
Groovy
18
star
31

CorePatch

An universal patch generator and applier such as using BsDiff/BsPatch and Google Archive Patch
Java
17
star
32

aapt-repo-manifest

aapt cmake 构建 核心repo manifest, 支持mac和linux(ubuntu 16.0.4)构建,支持linux(ubuntu 16.0.4)交叉编译windows的版本
17
star
33

Base

a library for some base code,such as BaseAdapter,BaseActivity,BaseFragement
Java
15
star
34

FrescoLoader

FrescoLoader is a framework which use fresco to load image into android.widget.ImageView.
Java
14
star
35

CurlForAndroid

curl 移植到andorid ,支持https和http2.0
C++
14
star
36

NativeCompile

android 动态库远程依赖
Groovy
13
star
37

FastMultidex

multidex debug 构建提速
Groovy
12
star
38

plugin-api-detect

通用的api调用检测
Java
9
star
39

flutter_app_for_lldb

调试用demo
Dart
8
star
40

plugin-apache-httpclient-detect

a plugin to detect apache httpclient class calling
Groovy
8
star
41

netease

高仿网易新闻客户端主界面,使用DrawerLayout+ToolBar实现双向侧滑
Java
7
star
42

support-application

Global Application Getter Support, Env Support, Lifecycle Support And Route Support
Java
7
star
43

gradleJNI

使用Gradle与JNI结合的项目
Java
6
star
44

R8BugTest

reproduce r8 bug
Java
6
star
45

lizhangqu.github.io

个人博客
HTML
6
star
46

gradle-wrapper

自定义的gradle-wrapper
Java
5
star
47

ZafuNews

浙江农林大学新闻网客户端阅读器,http://news.zafu.edu.cn
Java
5
star
48

SimpleHtmlDom

php使用simple_html_dom抓取网页数据的一个Demo
PHP
4
star
49

ClassRemapper

class's package name remapper using javassist
Java
3
star
50

libuvSample

C++
2
star
51

LearningGradle

Gradle学习历程
2
star
52

common-gradle

gradle 公共脚本
2
star
53

spring-boot-study

spring boot 学习项目
Java
1
star
54

booster-test

booster 测试
Java
1
star
55

AndroidTools

安卓工具类
Java
1
star
56

CoreJNI

Android JNI开发积累
C++
1
star
57

Stetho

安卓 debug工具的使用
Java
1
star
58

EngineerCar

华立工程车项目,基于nfc刷卡路检
Java
1
star
59

AndroidGradlePluginSamples

Android Gradle Plugin代码碎片
Groovy
1
star