7 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | KJLibraryExample
5 | Hello world!
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/KJFrame/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jun 22 08:02:06 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
7 |
--------------------------------------------------------------------------------
/doc/命名规则/Google Java编程风格指南_files/css.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Yanone Kaffeesatz';
3 | font-style: normal;
4 | font-weight: 400;
5 | src: local('Yanone Kaffeesatz Regular'), local('YanoneKaffeesatz-Regular'), url(http://fonts.gstatic.com/s/yanonekaffeesatz/v7/YDAoLskQQ5MOAgvHUQCcLQa6gm6bS00u2Qn-iPLo1Go.woff) format('woff');
6 | }
7 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #ff00ddff
5 | #ffffbb33
6 | #ffff4444
7 | #ffaa66cc
8 |
9 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 64dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/grid_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/aty_kjlistview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/KJFrame/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.9.21'
3 | repositories {
4 | maven { url 'https://maven.therouter.cn:8443/repository/maven-public/' }
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:7.4.2'
8 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | maven { url 'https://maven.therouter.cn:8443/repository/maven-public/' }
15 | }
16 | }
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/aty_oom.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/frag_plugin.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
11 |
12 |
16 |
17 |
--------------------------------------------------------------------------------
/KJFrame/demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kymjs/developer/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/layout_main_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/java/org/kymjs/kjframe/demo/bean/PluginBean.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.demo.bean;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | public class PluginBean {
6 |
7 | private String name;
8 | private Drawable icon;
9 | private String path;
10 |
11 | public String getName() {
12 | return name;
13 | }
14 |
15 | public void setName(String name) {
16 | this.name = name;
17 | }
18 |
19 | public Drawable getIcon() {
20 | return icon;
21 | }
22 |
23 | public void setIcon(Drawable icon) {
24 | this.icon = icon;
25 | }
26 |
27 | public String getPath() {
28 | return path;
29 | }
30 |
31 | public void setPath(String path) {
32 | this.path = path;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/plugin_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/KJFrame/demo/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 |
6 | android {
7 | namespace 'org.kymjs.kjframe.demo'
8 | compileSdk 33
9 |
10 | defaultConfig {
11 | applicationId "org.kymjs.kjframe.demo"
12 | minSdk 17
13 | targetSdk 35
14 | versionCode 1
15 | versionName "1.0"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_11
25 | targetCompatibility JavaVersion.VERSION_11
26 | }
27 | aaptOptions {
28 | noCompress "mp4"
29 | }
30 | }
31 |
32 | dependencies {
33 | implementation 'androidx.appcompat:appcompat:1.3.1'
34 | implementation project(':kjframe')
35 | }
36 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/bitmap/Persistence.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015, 张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.bitmap;
17 |
18 | /**
19 | * Request类如果继承(实现)了本接口,则无视httpconfig.cachetime的时长,缓存永久有效
20 | *
21 | * @author kymjs (http://www.kymjs.com/) on 10/15/15.
22 | */
23 | public interface Persistence {
24 | }
25 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/scale_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/doc/命名规则/Google Java编程风格指南_files/jiathis_utility.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | JiaThis Utility Frame
4 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/ui/KJFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.ui;
17 |
18 | /**
19 | * Fragment's framework
20 | * 创建时间 2014-3-1
21 | * 最后修改时间 2014-5-30
22 | *
23 | * @author kymjs (https://github.com/kymjs)
24 | * @version 1.6
25 | */
26 | public abstract class KJFragment extends SupportFragment {
27 | }
28 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/http.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
--------------------------------------------------------------------------------
/doc/wiki/DBLibrary.md:
--------------------------------------------------------------------------------
1 | #DBLibrary Summary
2 | in android orm framework. Make use of sqlite handle. one line just to add/delete/update/query. holder one-more,more-one entity
3 |
4 | ```java
5 | // data file
6 | KJDB db = KJDB.create(this);
7 | User ugc = new User(); //warn: The ugc must have id field or @ID annotate
8 | ugc.setEmail("kymjs123@gmail.com");
9 | ugc.setName("kymjs");
10 | db.save(ugc);
11 | ```
12 |
13 | ```java
14 | //one - many
15 | public class Parent{ //JavaBean
16 | private int id;
17 | @OneToMany(manyColumn = "parentId")
18 | private OneToManyLazyLoader children;
19 | /*....*/
20 | }
21 |
22 | public class Child{ //JavaBean
23 | private int id;
24 | private String text;
25 | @ManyToOne(column = "parentId")
26 | private Parent parent;
27 | /*....*/
28 | }
29 |
30 | List all = db.findAll(Parent.class);
31 | for( Parent item : all){
32 | if(item.getChildren ().getList().size()>0)
33 | Toast.makeText(this,item.getText() + item.getChildren().getList().get(0).getText(),Toast.LENGTH_LONG).show();
34 | }
35 |
36 | ```
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/utils/Id.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.utils;
18 |
19 | /**
20 | * 主键,一个特殊的属性
21 | *
22 | * 创建时间 2014-8-15
23 | *
24 | * @author kymjs (http://www.kymjs.com)
25 | * @author 杨福海 (http://www.yangfuhai.com)
26 | * @version 1.0
27 | */
28 | public class Id extends Property {
29 | }
30 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/java/org/kymjs/kjframe/demo/bean/User.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.demo.bean;
2 |
3 | import org.kymjs.kjframe.database.annotate.Id;
4 |
5 | public class User {
6 |
7 | // 将id属性设置为主键,必须有一个主键,
8 | // 其实如果变量名为:'id'或'_id'默认就是主键
9 | // 也就是在一个JavaBean里面必须有'id'或'_id'或'@Id()'注解,否则会报错
10 | @Id()
11 | private int id;
12 | private int age;
13 | private String Name;
14 | private String field;
15 |
16 | /************* getter and setter 必须有 *******************/
17 |
18 | public int getId() {
19 | return id;
20 | }
21 |
22 | public void setId(int id) {
23 | this.id = id;
24 | }
25 |
26 | public int getAge() {
27 | return age;
28 | }
29 |
30 | public void setAge(int age) {
31 | this.age = age;
32 | }
33 |
34 | public String getName() {
35 | return Name;
36 | }
37 |
38 | public void setName(String name) {
39 | Name = name;
40 | }
41 |
42 | public String getField() {
43 | return field;
44 | }
45 |
46 | public void setField(String field) {
47 | this.field = field;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/ui/I_BroadcastReg.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.ui;
17 |
18 | /**
19 | * 规范Activity中广播接受者注册的接口协议
20 | *
21 | * 创建时间 2014-7-11
22 | *
23 | * @author kymjs (http://www.kymjs.com/) .
24 | * @version 1.0
25 | */
26 | public interface I_BroadcastReg {
27 | /**
28 | * 注册广播
29 | */
30 | void registerBroadcast();
31 |
32 | /**
33 | * 解除注册广播
34 | */
35 | void unRegisterBroadcast();
36 | }
37 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/aty_new_listview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
14 |
18 |
19 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | group = 'com.github.kymjs'
7 | version = "3.0.2"
8 |
9 | android {
10 | namespace = 'org.kymjs.kjframe'
11 | compileSdk 33
12 | resourcePrefix "kjframe_"
13 |
14 | defaultConfig {
15 | minSdk 17
16 | targetSdk 35
17 | versionCode version.replace('.', '').toInteger()
18 | versionName version
19 | buildConfigField "String", "VERSION", "\"${project.version}\""
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 | }
28 |
29 | dependencies {
30 | implementation 'androidx.appcompat:appcompat:1.3.1'
31 | }
32 |
33 | apply plugin: 'maven-publish'
34 |
35 | afterEvaluate {
36 | publishing {
37 | publications {
38 | release(MavenPublication) {
39 | from components.release
40 | groupId = group
41 | artifactId = project.name
42 | version = version
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/aty_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
19 |
20 |
25 |
26 |
27 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/java/org/kymjs/kjframe/demo/widget/KJSlidingMenuDemo.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.demo.widget;
import org.kymjs.kjframe.KJActivity;
import org.kymjs.kjframe.demo.R;
import org.kymjs.kjframe.ui.BindView;
import org.kymjs.kjframe.ui.ViewInject;
import org.kymjs.kjframe.widget.KJSlidingMenu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class KJSlidingMenuDemo extends KJActivity {
@BindView(id = R.id.textview, click = true)
private TextView mText;
@BindView(id = R.id.anim_switch, click = true)
private Button mSwitch;
@BindView(id = R.id.main_group)
private KJSlidingMenu mSliding;
@Override
public void setRootView() {
setContentView(R.layout.aty_main);
}
@Override
public void initWidget() {
super.initWidget();
mSwitch.setText("是否打开伪3D效果" + mSliding.isShowAnim());
}
@Override
public void widgetClick(View v) {
super.widgetClick(v);
switch (v.getId()) {
case R.id.textview:
ViewInject.toast("hello");
break;
case R.id.anim_switch:
mSliding.setShowAnim(true);
mSwitch.setText("伪3D效果已打开");
break;
default:
break;
}
}
}
--------------------------------------------------------------------------------
/KJFrame/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/ui/BindView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.ui;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * 注解式绑定控件
25 | * 创建时间 2014-7-11
26 | *
27 | * @author kymjs (https://github.com/kymjs)
28 | * @version 1.0
29 | */
30 | @Target(ElementType.FIELD)
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface BindView {
33 | int id();
34 |
35 | boolean click() default false;
36 | }
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/bitmap/BitmapConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.bitmap;
17 |
18 | import org.kymjs.kjframe.bitmap.ImageDisplayer.ImageCache;
19 | import org.kymjs.kjframe.utils.KJLoger;
20 |
21 | /**
22 | * Bitmap配置器
23 | *
24 | * @author kymjs (https://github.com/kymjs)
25 | */
26 | public final class BitmapConfig {
27 |
28 | public static boolean isDEBUG = KJLoger.DEBUG_LOG;
29 |
30 | /**
31 | * 缓存器
32 | **/
33 | public static ImageCache mMemoryCache;
34 |
35 | public int cacheTime = 1440000;
36 | // 为了防止网速很快的时候速度过快而造成先显示加载中图片,然后瞬间显示网络图片的闪烁问题
37 | public long delayTime = 0;
38 | }
39 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/HttpStack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.kymjs.kjframe.http;
18 |
19 | import java.io.IOException;
20 | import java.util.Map;
21 |
22 | /**
23 | * Http请求端,已知实现类:
24 | *
25 | * @author kymjs (http://www.kymjs.com/) .
26 | * @see HttpConnectStack
27 | * 过时移除 HttpClientStack
28 | */
29 | public interface HttpStack {
30 | /**
31 | * 让Http请求端去发起一个Request
32 | *
33 | * @param request 一次实际请求集合
34 | * @param additionalHeaders Http请求头
35 | * @return 一个Http响应
36 | */
37 | KJHttpResponse performRequest(Request> request,
38 | Map additionalHeaders) throws IOException;
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/utils/OneToMany.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.utils;
18 |
19 | /**
20 | * 一对多的字段
21 | *
22 | * 创建时间 2014-8-15
23 | *
24 | * @author kymjs (http://www.kymjs.com)
25 | * @author 杨福海 (http://www.yangfuhai.com)
26 | * @version 1.0
27 | */
28 | public class OneToMany extends Property {
29 |
30 | private Class> oneClass;
31 |
32 | public Class> getOneClass() {
33 | return oneClass;
34 | }
35 |
36 | public void setOneClass(Class> oneClass) {
37 | this.oneClass = oneClass;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/utils/ManyToOne.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.utils;
18 |
19 | /**
20 | * 多对一的字段
21 | *
22 | * 创建时间 2014-8-15
23 | *
24 | * @author kymjs (http://www.kymjs.com)
25 | * @author 杨福海 (http://www.yangfuhai.com)
26 | * @version 1.0
27 | */
28 | public class ManyToOne extends Property {
29 |
30 | private Class> manyClass;
31 |
32 | public Class> getManyClass() {
33 | return manyClass;
34 | }
35 |
36 | public void setManyClass(Class> manyClass) {
37 | this.manyClass = manyClass;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/bitmap/BitmapCallBack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.bitmap;
17 |
18 | import android.graphics.Bitmap;
19 |
20 | /**
21 | * BitmapLibrary中的回调方法
22 | *
23 | * @author kymjs (https://github.com/kymjs)
24 | *
25 | */
26 | public abstract class BitmapCallBack {
27 | /** 载入前回调 */
28 | public void onPreLoad() {}
29 |
30 | /** bitmap载入完成将回调 */
31 | public void onSuccess(final Bitmap bitmap) {}
32 |
33 | /** bitmap载入失败将回调 */
34 | public void onFailure(final Exception e) {}
35 |
36 | /** bitmap载入完成不管成功失败 */
37 | public void onFinish() {}
38 |
39 | /** bitmap开始加载网络图片 */
40 | public void onDoHttp() {}
41 | }
42 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/Transient.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * 检测 字段是否已经被标注为 非数据库字段
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | *
30 | * @author kymjs (http://www.kymjs.com)
31 | * @author 杨福海 (http://www.yangfuhai.com)
32 | * @version 1.0
33 | */
34 | @Target(ElementType.FIELD)
35 | @Retention(RetentionPolicy.RUNTIME)
36 | public @interface Transient {
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/ManyToOne.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * 标识多对一的属性列
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | * @author kymjs (http://www.kymjs.com)
30 | * @author 杨福海 (http://www.yangfuhai.com)
31 | * @version 1.0
32 | */
33 | @Target(ElementType.FIELD)
34 | @Retention(RetentionPolicy.RUNTIME)
35 | public @interface ManyToOne {
36 | public String column() default "";
37 | }
38 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/OneToMany.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * 标识一对多的属性列
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | * @author kymjs (http://www.kymjs.com)
30 | * @author 杨福海 (http://www.yangfuhai.com)
31 | * @version 1.0
32 | */
33 | @Target(ElementType.FIELD)
34 | @Retention(RetentionPolicy.RUNTIME)
35 | public @interface OneToMany {
36 |
37 | public String manyColumn();
38 | }
39 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/Table.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * 表名注解
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | * @author kymjs (http://www.kymjs.com)
30 | * @author 杨福海 (http://www.yangfuhai.com)
31 | * @version 1.0
32 | */
33 | @Target(ElementType.TYPE)
34 | @Retention(RetentionPolicy.RUNTIME)
35 | public @interface Table {
36 | /**
37 | * 表名
38 | */
39 | public String name();
40 | }
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/Property.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * 可以设置默认值的属性列
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | * @author kymjs (http://www.kymjs.com)
30 | * @author 杨福海 (http://www.yangfuhai.com)
31 | * @version 1.0
32 | */
33 | @Target(ElementType.FIELD)
34 | @Retention(RetentionPolicy.RUNTIME)
35 | public @interface Property {
36 | public String column() default "";
37 |
38 | public String defaultValue() default "";
39 | }
40 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
16 |
17 |
22 |
23 |
28 |
29 |
34 |
35 |
40 |
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/utils/KJConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.utils;
17 |
18 | /**
19 | * @author kymjs (https://github.com/kymjs)
20 | */
21 | public final class KJConfig {
22 |
23 | public static final double VERSION = 3.02;
24 |
25 | /**
26 | * 错误处理广播
27 | */
28 | public static final String RECEIVER_ERROR = KJConfig.class.getName()
29 | + "org.kymjs.android.frame.error";
30 | /**
31 | * 无网络警告广播
32 | */
33 | public static final String RECEIVER_NOT_NET_WARN = KJConfig.class.getName()
34 | + "org.kymjs.android.frame.notnet";
35 | /**
36 | * preference键值对
37 | */
38 | public static final String SETTING_FILE = "kjframe_preference";
39 | public static final String ONLY_WIFI = "only_wifi";
40 | }
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/annotate/Id.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.annotate;
18 |
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Id主键配置,不配置的时候默认找类的id或_id字段作为主键,column不配置的是默认为字段名
26 | *
27 | * 创建时间 2014-8-15
28 | *
29 | * @author kymjs (http://www.kymjs.com)
30 | * @author 杨福海 (http://www.yangfuhai.com)
31 | * @version 1.0
32 | */
33 | @Target(ElementType.FIELD)
34 | @Retention(RetentionPolicy.RUNTIME)
35 | public @interface Id {
36 | /**
37 | * 设置为主键
38 | *
39 | * @return
40 | */
41 | public String column() default "";
42 | }
43 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/ui/I_KJActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.ui;
17 |
18 | import android.view.View;
19 |
20 | /**
21 | * KJFrameActivity接口协议,实现此接口可使用KJActivityManager堆栈
22 | * 创建时间 2014-3-1
23 | * 最后修改时间 2014-5-30
24 | *
25 | * @author kymjs (http://www.kymjs.com)
26 | * @version 2.25
27 | */
28 | public interface I_KJActivity {
29 |
30 | int DESTROY = 0;
31 | int STOP = 2;
32 | int PAUSE = 1;
33 | int RESUME = 3;
34 |
35 | /**
36 | * 设置root界面
37 | */
38 | void setRootView();
39 |
40 | /**
41 | * 初始化数据
42 | */
43 | void initData();
44 |
45 | /**
46 | * 在线程中初始化数据
47 | */
48 | void initDataFromThread();
49 |
50 | /**
51 | * 初始化控件
52 | */
53 | void initWidget();
54 |
55 | /**
56 | * 点击事件回调方法
57 | */
58 | void widgetClick(View v);
59 | }
60 |
--------------------------------------------------------------------------------
/doc/命名规则/Google Java编程风格指南_files/app.css:
--------------------------------------------------------------------------------
1 | h1,h2,h3,h4{
2 | color: #333;
3 | font-family: 'Yanone Kaffeesatz', sans-serif;
4 | font-weight: 400;
5 | border-bottom: 1px solid #ccc;
6 | }
7 |
8 | h1{
9 | font-size: 36px;
10 | margin-top: 18px;
11 | margin-bottom: .15em;
12 | }
13 | h2{
14 | font-size: 30px;
15 | margin-bottom: 15px;
16 | }
17 | h3{
18 | color: #777;
19 | font-size: 25px;
20 | padding-bottom: 5px;
21 | margin-bottom: 10px;
22 | }
23 |
24 | #post .authoring{
25 | margin-bottom: 17px;
26 | font-family: 'Yanone Kaffeesatz', sans-serif;
27 | padding-left: 0px;
28 | font-size: 17px;
29 | color: #777;
30 | }
31 |
32 | .posts .post_date{
33 | font-family: 'Yanone Kaffeesatz', sans-serif;
34 | }
35 |
36 | .brand {
37 | font-family: 'Yanone Kaffeesatz', sans-serif;
38 | }
39 |
40 | #footer {
41 | margin-top: 20px;
42 | padding-bottom: 40px;
43 | text-align: center;
44 | }
45 |
46 | /* fixed navbar*/
47 | body {
48 | padding-top: 40px;
49 | }
50 |
51 | /* tag_box ======================================================== */
52 |
53 | .tag_box {
54 | list-style:none;
55 | margin:0;
56 | padding:5px 0 ;
57 | overflow:hidden;
58 | }
59 | .tag_box li {
60 | line-height:28px;
61 | }
62 | .tag_box.inline li {
63 | float:left;
64 | }
65 | .tag_box a {
66 | padding: 3px 6px;
67 | margin: 2px;
68 | background: #eee;
69 | color:#005F6B;
70 | border-radius: 3px;
71 | text-decoration:none;
72 | }
73 | .tag_box a span{
74 | vertical-align:super;
75 | font-size:0.8em;
76 | }
77 | .tag_box a.active {
78 | background:#57A957;
79 | border:1px solid #4C964D;
80 | color:#FFF;
81 | }
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/DeliveryResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Android Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.http;
17 |
18 | /**
19 | * 分发器,将异步线程中的结果响应到UI线程中
20 | *
21 | * @author kymjs (http://www.kymjs.com/) .
22 | */
23 | public interface DeliveryResponse {
24 | /**
25 | * 分发响应结果
26 | *
27 | * @param request
28 | * @param response
29 | */
30 | public void postResponse(Request> request, Response> response);
31 |
32 | /**
33 | * 分发Failure事件
34 | *
35 | * @param request 请求
36 | * @param error 异常原因
37 | */
38 | public void postError(Request> request, KJHttpException error);
39 |
40 | /**
41 | * 当有中介响应的时候,会被调用,首先返回中介响应,并执行runnable(实际就是再去请求网络)
42 | * Note:所谓中介响应:当本地有一个未过期缓存的时候会优先返回一个缓存,但如果这个缓存又是需要刷新的时候,会再次去请求网络,
43 | * 那么之前返回的那个有效但需要刷新的就是中介响应
44 | */
45 | public void postResponse(Request> request, Response> response,
46 | Runnable runnable);
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
30 |
33 |
36 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/KJHttpException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.kymjs.kjframe.http;
18 |
19 | /**
20 | * 整个框架异常的基类
21 | *
22 | * @author kymjs (http://www.kymjs.com/) .
23 | */
24 | @SuppressWarnings("serial")
25 | public class KJHttpException extends Exception {
26 | public final NetworkResponse networkResponse;
27 |
28 | public KJHttpException() {
29 | networkResponse = null;
30 | }
31 |
32 | public KJHttpException(NetworkResponse response) {
33 | networkResponse = response;
34 | }
35 |
36 | public KJHttpException(String exceptionMessage) {
37 | super(exceptionMessage);
38 | networkResponse = null;
39 | }
40 |
41 | public KJHttpException(String exceptionMessage, NetworkResponse response) {
42 | super(exceptionMessage);
43 | networkResponse = response;
44 | }
45 |
46 | public KJHttpException(String exceptionMessage, Throwable reason) {
47 | super(exceptionMessage, reason);
48 | networkResponse = null;
49 | }
50 |
51 | public KJHttpException(Throwable cause) {
52 | super(cause);
53 | networkResponse = null;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/doc/wiki/UILibrary.md:
--------------------------------------------------------------------------------
1 | #Topology Summary
2 | import a Activity inheritance link.Get topology all function, you can extends org.kymjs.kjframe.KJActivity(KJFragment) for your Activity(Fragment).
3 | in topology method called queue:
4 | setRootView();
5 | @BindView
6 | initDataFromThread();(asynchronous,can do time consuming)
7 | threadDataInited();(initDataFromThread() executed just call back)
8 | initData();
9 | initWidget();
10 | registerBroadcast();
11 |
12 | ##Why use Topology
13 | In the traditional wording, the view and the data is initialized are written in the onCreate () method, it will be difficult to read a few more lines of code later. You can use the topology specification code blocks, make the code easier to read.
14 |
15 | ##surprise to you
16 | There is also a quick look binding view, and set the listener function in Topology. annotate by IOC, a line of code to bind the view and set the listener.
17 |
18 | ##
19 | ```java
20 | public class TabExample extends KJActivity {
21 | @BindView(id = R.id.bottombar_content1)
22 | public RadioButton mRbtn1;
23 | @BindView(id = R.id.bottombar_content2, click = true)
24 | private RadioButton mRbtn2;
25 |
26 | @Override
27 | public void setRootView() {
28 | setContentView(R.layout.aty_tab_example);
29 | }
30 |
31 | @Override
32 | protected void initWidget() {
33 | super.initWidget();
34 | mRbtn1.setText("widget clicked listener");
35 | }
36 |
37 | @Override
38 | public void widgetClick(View v) {
39 | super.widgetClick(v);
40 | switch (v.getId()) {
41 | case R.id.bottombar_content1:
42 | ViewInject.toast("clicked mRbtn1");
43 | break;
44 | case R.id.bottombar_content2:
45 | ViewInject.toast("clicked mRbtn2");
46 | break;
47 | }
48 | }
49 | }
50 | ```
51 |
--------------------------------------------------------------------------------
/doc/wiki/BitmapLibrary.md:
--------------------------------------------------------------------------------
1 | #BitmapLibrary Summary
2 | Can whichever View set image(for ImageView set src;other view set background).
3 | Used BitmapLibrary, loading bitmap from internet or local SD card, it definitely not out of memory.
4 | It will be widget the size of the bitmap as to decode it. And joined the multi-level cache for bitmap.
5 | defualt make use of MemoryLruCache + DiskLruCache image.
6 | More detailed configuration policies, see the sample code in the repository.
7 | Enjoy it! Any question? You can ask for me: kymjs123(wechat) or kymjs123@gmail.com.
8 |
9 | ##surprise to you
10 | You can choose according to their needs, the process of configuring the bitmap loaded. For example: to define their own rules download; animation definition picture shows; the definition of the size of the bitmap to be displayed; custom bitmap is displayed when downloading.
11 | You probably used [ImageLoader](https://github.com/nostra13/Android-Universal-Image-Loader), BitmapLibrary not so complicated, but at the same time not like ImageLoader use flash inside ListView.
12 |
13 | ##How to use
14 | ```java
15 |
16 | KJBitmap kjb = KJBitmap.create();
17 | /**
18 | * url can be local sdcard path or internet url;
19 | * view can whichever View set image(for ImageView set src;for View set background).
20 | */
21 | // local sdcard image
22 | kjb.display(imageView, "/storage/sdcard0/1.jpg");
23 | // internet url
24 | kjb.display(textView, http://www.xxx.com/xxx.jpg);
25 | //configuration after loading the size
26 | kjb.display(view, http://www.xxx.com/xxx.jpg, 100, 80); //width=100,height=80
27 | //configuration bitmap loading ImageView display
28 | kjb.display(view, http://www.xxx.com/xxx.jpg, R.drawable.xxx);
29 | kjb.display(view, http://www.xxx.com/xxx.jpg, bitmap);
30 | kjb.display(view, http://www.xxx.com/xxx.jpg, drawable);
31 | ```
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/NetworkResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project, 张涛
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.kymjs.kjframe.http;
18 |
19 | import java.util.Collections;
20 | import java.util.Map;
21 |
22 | /**
23 | * 从NetWork执行器返回的Http响应,包含了本次响应是成功还是失败,请求头,响应内容,HTTP状态码
24 | *
25 | * @author kymjs (http://www.kymjs.com/) .
26 | */
27 | public class NetworkResponse {
28 |
29 | public NetworkResponse(int statusCode, byte[] data,
30 | Map headers, boolean notModified) {
31 | this.statusCode = statusCode;
32 | this.data = data;
33 | this.headers = headers;
34 | this.notModified = notModified;
35 | }
36 |
37 | public NetworkResponse(byte[] data) {
38 | this(HttpStatus.SC_OK, data, Collections.emptyMap(),
39 | false);
40 | }
41 |
42 | public NetworkResponse(byte[] data, Map headers) {
43 | this(HttpStatus.SC_OK, data, headers, false);
44 | }
45 |
46 | public final int statusCode;
47 |
48 | public final byte[] data;
49 |
50 | public final Map headers;
51 |
52 | public final boolean notModified; // 如果服务器返回304(Not Modified),则为true
53 | }
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/example_db.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
23 |
24 |
29 |
30 |
35 |
36 |
37 |
41 |
42 |
47 |
48 |
53 |
54 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/java/org/kymjs/kjframe/demo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.demo;
2 |
3 | import android.view.View;
4 | import android.widget.Button;
5 | import android.widget.TextView;
6 |
7 | import org.kymjs.kjframe.SupportActivity;
8 | import org.kymjs.kjframe.ui.BindView;
9 | import org.kymjs.kjframe.ui.KJActivityStack;
10 | import org.kymjs.kjframe.utils.KJConfig;
11 |
12 | public class MainActivity extends SupportActivity {
13 |
14 | @BindView(id = R.id.textView1)
15 | private TextView mTvVersion;
16 | @BindView(id = R.id.button1, click = true)
17 | private Button mBtnUI;
18 | @BindView(id = R.id.button3, click = true)
19 | private Button mBtnBitmap;
20 | @BindView(id = R.id.button4, click = true)
21 | private Button mBtnHttp;
22 | @BindView(id = R.id.button5, click = true)
23 | private Button mBtnDB;
24 |
25 | @Override
26 | public void setRootView() {
27 | setContentView(R.layout.activity_main);
28 | if (!"org.kymjs.kjframe.demo".equals(getApplication().getPackageName())) {
29 | KJActivityStack.create().appExit(aty);
30 | }
31 | }
32 |
33 | @Override
34 | public void initWidget() {
35 | super.initWidget();
36 | mTvVersion.setText("当前框架版本为:" + org.kymjs.kjframe.BuildConfig.VERSION);
37 | }
38 |
39 | @Override
40 | public void widgetClick(View v) {
41 | super.widgetClick(v);
42 | switch (v.getId()) {
43 | case R.id.button1:
44 | showActivity(this, WidgetActivity.class);
45 | break;
46 | case R.id.button3:
47 | showActivity(this, BitmapActivity.class);
48 | break;
49 | case R.id.button4:
50 | showActivity(this, HttpActivity.class);
51 | break;
52 | case R.id.button5:
53 | showActivity(this, DBActivity.class);
54 | break;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/utils/KeyValue.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database.utils;
18 |
19 | import java.text.SimpleDateFormat;
20 | import java.util.Locale;
21 |
22 | /**
23 | * 键值对封装
24 | * 创建时间 2014-8-15
25 | *
26 | * @author kymjs (http://www.kymjs.com)
27 | * @author 杨福海 (http://www.yangfuhai.com)
28 | * @version 1.0
29 | */
30 | public class KeyValue {
31 | private String key;
32 | private Object value;
33 |
34 | public KeyValue(String key, Object value) {
35 | this.key = key;
36 | this.value = value;
37 | }
38 |
39 | public KeyValue() {
40 | }
41 |
42 | public String getKey() {
43 | return key;
44 | }
45 |
46 | public void setKey(String key) {
47 | this.key = key;
48 | }
49 |
50 | private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
51 |
52 | public Object getValue() {
53 | if (value instanceof java.util.Date) {
54 | return sdf.format(value);
55 | }
56 | return value;
57 | }
58 |
59 | public void setValue(Object value) {
60 | this.value = value;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/java/org/kymjs/kjframe/demo/WidgetActivity.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.demo;
2 |
3 | import android.view.View;
4 | import android.widget.Button;
5 |
6 | import org.kymjs.kjframe.KJActivity;
7 | import org.kymjs.kjframe.demo.widget.KJSlidingMenuDemo;
8 | import org.kymjs.kjframe.ui.BindView;
9 | import org.kymjs.kjframe.ui.ViewInject;
10 |
11 | public class WidgetActivity extends KJActivity {
12 | @BindView(id = R.id.button1, click = true)
13 | private Button mBtn1;
14 | @BindView(id = R.id.button2, click = true)
15 | private Button mBtn2;
16 | @BindView(id = R.id.button3, click = true)
17 | private Button mBtn3;
18 | @BindView(id = R.id.button4, click = true)
19 | private Button mBtn4;
20 | @BindView(id = R.id.button5, click = true)
21 | private Button mBtn5;
22 |
23 | @Override
24 | public void setRootView() {
25 | setContentView(R.layout.widget);
26 | }
27 |
28 | @Override
29 | public void initWidget() {
30 | super.initWidget();
31 | mBtn1.setText("侧滑SlidingMenu");
32 | mBtn2.setText("上下拉ListView,圆形imageView,万能适配器");
33 | mBtn3.setText("KJScrollView请访问:https://github.com/KJFrame/KJBlog");
34 | mBtn4.setText("KJViewPager请访问:https://github.com/kymjs/KJController");
35 | }
36 |
37 | @Override
38 | public void widgetClick(View v) {
39 | super.widgetClick(v);
40 | switch (v.getId()) {
41 | case R.id.button1:
42 | showActivity(aty, KJSlidingMenuDemo.class);
43 | break;
44 | case R.id.button2:
45 | break;
46 | case R.id.button3:
47 | ViewInject.toast("请查看KJBlog项目");
48 | break;
49 | case R.id.button4:
50 | ViewInject.toast("请查看KJController项目");
51 | break;
52 | case R.id.button5:
53 | break;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/Cache.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Android Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.http;
17 |
18 | import java.util.Collections;
19 | import java.util.Map;
20 |
21 | /**
22 | * 一个缓存接口协议,其中包含了缓存的bean原型
23 | */
24 | public interface Cache {
25 |
26 | Entry get(String key);
27 |
28 | void put(String key, Entry entry);
29 |
30 | void remove(String key);
31 |
32 | void clean();
33 |
34 | /**
35 | * 执行在线程中
36 | */
37 | void initialize();
38 |
39 | /**
40 | * 让一个缓存过期
41 | *
42 | * @param key Cache key
43 | * @param fullExpire True to fully expire the entry, false to soft expire
44 | */
45 | void invalidate(String key, boolean fullExpire);
46 |
47 | /**
48 | * cache真正缓存的数据bean,这个是会被保存的缓存对象
49 | */
50 | class Entry {
51 | public byte[] data;
52 | public String etag; // 为cache标记一个tag
53 |
54 | public long serverDate; // 本次请求成功时的服务器时间
55 | public long ttl; // 有效期,System.currentTimeMillis()
56 |
57 | public Map responseHeaders = Collections.emptyMap();
58 |
59 | /**
60 | * 是否已过期
61 | */
62 | public boolean isExpired() {
63 | return this.ttl < System.currentTimeMillis();
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/KJFrame/demo/src/main/res/layout/widget.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
27 |
28 |
34 |
35 |
41 |
42 |
48 |
49 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/ui/I_SkipActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.ui;
17 |
18 | import android.app.Activity;
19 | import android.content.Intent;
20 | import android.os.Bundle;
21 |
22 | /**
23 | * 规范Activity跳转的接口协议
24 | *
25 | * @author kymjs (https://github.com/kymjs)
26 | */
27 | public interface I_SkipActivity {
28 | /**
29 | * skip to @param(cls),and call @param(aty's) finish() method
30 | */
31 | public void skipActivity(Activity aty, Class> cls);
32 |
33 | /**
34 | * skip to @param(cls),and call @param(aty's) finish() method
35 | */
36 | public void skipActivity(Activity aty, Intent it);
37 |
38 | /**
39 | * skip to @param(cls),and call @param(aty's) finish() method
40 | */
41 | public void skipActivity(Activity aty, Class> cls, Bundle extras);
42 |
43 | /**
44 | * show a @param(cls),but can't finish activity
45 | */
46 | public void showActivity(Activity aty, Class> cls);
47 |
48 | /**
49 | * show a @param(cls),but can't finish activity
50 | */
51 | public void showActivity(Activity aty, Intent it);
52 |
53 | /**
54 | * show a @param(cls),but can't finish activity
55 | */
56 | public void showActivity(Activity aty, Class> cls, Bundle extras);
57 | }
58 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/Delivery.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, Android Open Source Project,张涛.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package org.kymjs.kjframe.http;
17 |
18 | /**
19 | * 分发器,将异步线程中的结果响应到UI线程中
20 | *
21 | * @author kymjs (http://www.kymjs.com/).
22 | *
23 | */
24 | public interface Delivery {
25 | /**
26 | * 分发响应结果
27 | *
28 | * @param request
29 | * @param response
30 | */
31 | public void postResponse(Request> request, Response> response);
32 |
33 | /**
34 | * 分发Failure事件
35 | *
36 | * @param request
37 | * 请求
38 | * @param error
39 | * 异常原因
40 | */
41 | public void postError(Request> request, KJHttpException error);
42 |
43 | /**
44 | * 当有中介响应的时候,会被调用,首先返回中介响应,并执行runnable(实际就是再去请求网络)
45 | * Note:所谓中介响应:当本地有一个未过期缓存的时候会优先返回一个缓存,但如果这个缓存又是需要刷新的时候,会再次去请求网络,
46 | * 那么之前返回的那个有效但需要刷新的就是中介响应
47 | */
48 | public void postResponse(Request> request, Response> response,
49 | Runnable runnable);
50 |
51 | /**
52 | * 分发下载进度事件
53 | *
54 | * @param request
55 | * @param fileSize
56 | * @param downloadedSize
57 | */
58 | public void postDownloadProgress(Request> request, long fileSize,
59 | long downloadedSize);
60 |
61 | public void postCancel(Request> request);
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | tomsuite.xml
2 | **pom.xml.releaseBackup
3 | release.properties
4 | gen
5 | */seed.txt
6 | notes
7 | logs
8 | gen-external-apklibs
9 | .idea
10 | *.iml
11 | .DS_Store
12 | *.swp
13 | out
14 | .gradle
15 | /local.properties
16 | /build
17 |
18 | ###OSX###
19 |
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must ends with two \r.
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear on external disk
32 | .Spotlight-V100
33 | .Trashes
34 |
35 |
36 | ###Linux###
37 |
38 | *~
39 |
40 | # KDE directory preferences
41 | .directory
42 |
43 |
44 | ###Android###
45 |
46 | # Built application files
47 | *.apk
48 | *.ap_
49 |
50 | # Files for ART and Dalvik VM
51 | *.dex
52 |
53 | # Java class files
54 | *.class
55 |
56 | # Generated files
57 | bin/
58 | gen/
59 |
60 | # Gradle files
61 | .gradle/
62 | .gradletasknamecache
63 | build/
64 |
65 | # Local configuration file (sdk path, etc)
66 | local.properties
67 |
68 | # Proguard folder generated by Eclipse
69 | proguard/
70 |
71 | # Lint
72 | lint-report.html
73 | lint-report_files/
74 | lint_result.txt
75 |
76 | # Mobile Tools for Java (J2ME)
77 | .mtj.tmp/
78 |
79 | # Package Files #
80 | *.war
81 | *.ear
82 |
83 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84 | hs_err_pid*
85 |
86 |
87 | ###IntelliJ###
88 |
89 | *.iml
90 | *.ipr
91 | *.iws
92 | .idea/
93 |
94 |
95 | ###Eclipse###
96 |
97 | *.pydevproject
98 | .metadata
99 | tmp/
100 | *.tmp
101 | *.bak
102 | *.swp
103 | *~.nib
104 | .settings/
105 | .loadpath
106 |
107 | # External tool builders
108 | .externalToolBuilders/
109 |
110 | # Locally stored "Eclipse launch configurations"
111 | *.launch
112 |
113 | # CDT-specific
114 | .cproject
115 |
116 | # PDT-specific
117 | .buildpath
118 |
119 | # sbteclipse plugin
120 | .target
121 |
122 | # TeXlipse plugin
123 | .texlipseXml version="1.0" encoding="UTF-8"?>captures
124 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/http/HttpStatus.java:
--------------------------------------------------------------------------------
1 | package org.kymjs.kjframe.http;
2 |
3 | /**
4 | * Http响应码
5 | *
6 | * @author kymjs (http://www.kymjs.com/) on 9/28/15.
7 | */
8 | public interface HttpStatus {
9 | int SC_ACCEPTED = 202;
10 | int SC_BAD_GATEWAY = 502;
11 | int SC_BAD_REQUEST = 400;
12 | int SC_CONFLICT = 409;
13 | int SC_CONTINUE = 100;
14 | int SC_CREATED = 201;
15 | int SC_EXPECTATION_FAILED = 417;
16 | int SC_FAILED_DEPENDENCY = 424;
17 | int SC_FORBIDDEN = 403;
18 | int SC_GATEWAY_TIMEOUT = 504;
19 | int SC_GONE = 410;
20 | int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
21 | int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
22 | int SC_INSUFFICIENT_STORAGE = 507;
23 | int SC_INTERNAL_SERVER_ERROR = 500;
24 | int SC_LENGTH_REQUIRED = 411;
25 | int SC_LOCKED = 423;
26 | int SC_METHOD_FAILURE = 420;
27 | int SC_METHOD_NOT_ALLOWED = 405;
28 | int SC_MOVED_PERMANENTLY = 301;
29 | int SC_MOVED_TEMPORARILY = 302;
30 | int SC_MULTIPLE_CHOICES = 300;
31 | int SC_MULTI_STATUS = 207;
32 | int SC_NON_AUTHORITATIVE_INFORMATION = 203;
33 | int SC_NOT_ACCEPTABLE = 406;
34 | int SC_NOT_FOUND = 404;
35 | int SC_NOT_IMPLEMENTED = 501;
36 | int SC_NOT_MODIFIED = 304;
37 | int SC_NO_CONTENT = 204;
38 | int SC_OK = 200;
39 | int SC_PARTIAL_CONTENT = 206;
40 | int SC_PAYMENT_REQUIRED = 402;
41 | int SC_PRECONDITION_FAILED = 412;
42 | int SC_PROCESSING = 102;
43 | int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
44 | int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
45 | int SC_REQUEST_TIMEOUT = 408;
46 | int SC_REQUEST_TOO_LONG = 413;
47 | int SC_REQUEST_URI_TOO_LONG = 414;
48 | int SC_RESET_CONTENT = 205;
49 | int SC_SEE_OTHER = 303;
50 | int SC_SERVICE_UNAVAILABLE = 503;
51 | int SC_SWITCHING_PROTOCOLS = 101;
52 | int SC_TEMPORARY_REDIRECT = 307;
53 | int SC_UNAUTHORIZED = 401;
54 | int SC_UNPROCESSABLE_ENTITY = 422;
55 | int SC_UNSUPPORTED_MEDIA_TYPE = 415;
56 | int SC_USE_PROXY = 305;
57 | }
58 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/ManyToOneLazyLoader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database;
18 |
19 | import org.kymjs.kjframe.KJDB;
20 |
21 | /**
22 | * 多对一延迟加载类
23 | * 创建时间 2014-8-15
24 | *
25 | * @param
26 | * 宿主实体的class
27 | * @param
28 | * 多放实体class
29 | *
30 | * @author kymjs (http://www.kymjs.com)
31 | * @author 杨福海 (http://www.yangfuhai.com)
32 | * @version 1.0
33 | */
34 | public class ManyToOneLazyLoader {
35 | M manyEntity;
36 | Class manyClazz;
37 | Class oneClazz;
38 | KJDB db;
39 |
40 | public ManyToOneLazyLoader(M manyEntity, Class manyClazz,
41 | Class oneClazz, KJDB db) {
42 | this.manyEntity = manyEntity;
43 | this.manyClazz = manyClazz;
44 | this.oneClazz = oneClazz;
45 | this.db = db;
46 | }
47 |
48 | O oneEntity;
49 | boolean hasLoaded = false;
50 |
51 | /**
52 | * 如果数据未加载,则调用loadManyToOne填充数据
53 | *
54 | * @return
55 | */
56 | public O get() {
57 | if (oneEntity == null && !hasLoaded) {
58 | this.db.loadManyToOne(this.manyEntity, this.manyClazz,
59 | this.oneClazz);
60 | hasLoaded = true;
61 | }
62 | return oneEntity;
63 | }
64 |
65 | public void set(O value) {
66 | oneEntity = value;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/KJFrame/kjframe/src/main/java/org/kymjs/kjframe/database/DbModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
3 | * Copyright (c) 2014,KJFrameForAndroid Open Source Project,张涛.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package org.kymjs.kjframe.database;
18 |
19 | import java.util.HashMap;
20 |
21 | /**
22 | * 数据库的模型
23 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *