Skip to content

Commit

Permalink
第二次提交
Browse files Browse the repository at this point in the history
  • Loading branch information
Va-doubles committed Mar 4, 2014
1 parent 938333a commit 36a5e83
Show file tree
Hide file tree
Showing 120 changed files with 13,848 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="lib" path="libs/roboguice-2.0.jar" sourcepath="depending source/roboguice-3.0b-experimental-sources.jar"/>
<classpathentry kind="lib" path="libs/guice-3.0-no_aop.jar" sourcepath="depending source"/>
<classpathentry kind="lib" path="libs/javax.inject-1.jar" sourcepath="depending source"/>
<classpathentry kind="lib" path="libs/jsr305-1.3.9.jar" sourcepath="depending source"/>
<classpathentry kind="lib" path="libs/afinal_0.5_bin.jar" sourcepath="depending source"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MobieOA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
4 changes: 4 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6
29 changes: 29 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.geeklub.vass"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.geeklub.vass.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
29 changes: 29 additions & 0 deletions bin/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.geeklub.vass"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.geeklub.vass.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
129 changes: 129 additions & 0 deletions depending source/afinal/tsz/afinal/FinalActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/**
* Copyright (c) 2012-2013, Michael Yang 杨福海 (www.yangfuhai.com).
*
* 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.
*/
package net.tsz.afinal;

import java.lang.reflect.Field;

import net.tsz.afinal.annotation.view.EventListener;
import net.tsz.afinal.annotation.view.Select;
import net.tsz.afinal.annotation.view.ViewInject;
import android.app.Activity;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AbsListView;

public abstract class FinalActivity extends Activity {


public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
initView();
}


public void setContentView(View view, LayoutParams params) {
super.setContentView(view, params);
initView();
}


public void setContentView(View view) {
super.setContentView(view);
initView();
}

private void initView(){
Field[] fields = getClass().getDeclaredFields();
if(fields!=null && fields.length>0){
for(Field field : fields){
try {
field.setAccessible(true);

if(field.get(this)!= null )
continue;

ViewInject viewInject = field.getAnnotation(ViewInject.class);
if(viewInject!=null){

int viewId = viewInject.id();
field.set(this,findViewById(viewId));

setListener(field,viewInject.click(),Method.Click);
setListener(field,viewInject.longClick(),Method.LongClick);
setListener(field,viewInject.itemClick(),Method.ItemClick);
setListener(field,viewInject.itemLongClick(),Method.itemLongClick);

Select select = viewInject.select();
if(!TextUtils.isEmpty(select.selected())){
setViewSelectListener(field,select.selected(),select.noSelected());
}

}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}



private void setViewSelectListener(Field field,String select,String noSelect)throws Exception{
Object obj = field.get(this);
if(obj instanceof View){
((AbsListView)obj).setOnItemSelectedListener(new EventListener(this).select(select).noSelect(noSelect));
}
}


private void setListener(Field field,String methodName,Method method)throws Exception{
if(methodName == null || methodName.trim().length() == 0)
return;

Object obj = field.get(this);

switch (method) {
case Click:
if(obj instanceof View){
((View)obj).setOnClickListener(new EventListener(this).click(methodName));
}
break;
case ItemClick:
if(obj instanceof AbsListView){
((AbsListView)obj).setOnItemClickListener(new EventListener(this).itemClick(methodName));
}
break;
case LongClick:
if(obj instanceof View){
((View)obj).setOnLongClickListener(new EventListener(this).longClick(methodName));
}
break;
case itemLongClick:
if(obj instanceof AbsListView){
((AbsListView)obj).setOnItemLongClickListener(new EventListener(this).itemLongClick(methodName));
}
break;
default:
break;
}
}

public enum Method{
Click,LongClick,ItemClick,itemLongClick
}

}
Loading

0 comments on commit 36a5e83

Please sign in to comment.