changes made
This commit is contained in:
9
source/libs/.classpath
Executable file
9
source/libs/.classpath
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
33
source/libs/.project
Executable file
33
source/libs/.project
Executable file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vpHerder</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>
|
||||
4
source/libs/.settings/org.eclipse.jdt.core.prefs
Executable file
4
source/libs/.settings/org.eclipse.jdt.core.prefs
Executable file
@@ -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
|
||||
27
source/libs/AndroidManifest.xml
Executable file
27
source/libs/AndroidManifest.xml
Executable file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.caesar2011.vpherder"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-sdk
|
||||
android:minSdkVersion="11"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="me.caesar2011.vpherder.MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
0
source/libs/android-support-v4.jar
Normal file → Executable file
0
source/libs/android-support-v4.jar
Normal file → Executable file
27
source/libs/bin/AndroidManifest.xml
Executable file
27
source/libs/bin/AndroidManifest.xml
Executable file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.caesar2011.vpherder"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-sdk
|
||||
android:minSdkVersion="11"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="me.caesar2011.vpherder.MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
source/libs/bin/classes/me/caesar2011/vpherder/BuildConfig.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/BuildConfig.class
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/MainActivity.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/MainActivity.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$attr.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$attr.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$color.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$color.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$dimen.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$dimen.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$drawable.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$drawable.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$id.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$id.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$layout.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$layout.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$string.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$string.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$style.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R$style.class
Executable file
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/R.class
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
source/libs/bin/classes/me/caesar2011/vpherder/views/PullToRefreshListView.class
Executable file
BIN
source/libs/bin/classes/me/caesar2011/vpherder/views/PullToRefreshListView.class
Executable file
Binary file not shown.
3
source/libs/bin/jarlist.cache
Executable file
3
source/libs/bin/jarlist.cache
Executable file
@@ -0,0 +1,3 @@
|
||||
# cache for current jar dependency. DO NOT EDIT.
|
||||
# format is <lastModified> <length> <SHA-1> <path>
|
||||
# Encoding is UTF-8
|
||||
0
source/libs/commons-io-2.4.jar
Normal file → Executable file
0
source/libs/commons-io-2.4.jar
Normal file → Executable file
8
source/libs/gen/me/caesar2011/vpherder/BuildConfig.java
Executable file
8
source/libs/gen/me/caesar2011/vpherder/BuildConfig.java
Executable file
@@ -0,0 +1,8 @@
|
||||
/*___Generated_by_IDEA___*/
|
||||
|
||||
package me.caesar2011.vpherder;
|
||||
|
||||
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = Boolean.parseBoolean(null);
|
||||
}
|
||||
7
source/libs/gen/me/caesar2011/vpherder/Manifest.java
Executable file
7
source/libs/gen/me/caesar2011/vpherder/Manifest.java
Executable file
@@ -0,0 +1,7 @@
|
||||
/*___Generated_by_IDEA___*/
|
||||
|
||||
package me.caesar2011.vpherder;
|
||||
|
||||
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
|
||||
public final class Manifest {
|
||||
}
|
||||
103
source/libs/gen/me/caesar2011/vpherder/R.java
Executable file
103
source/libs/gen/me/caesar2011/vpherder/R.java
Executable file
@@ -0,0 +1,103 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package me.caesar2011.vpherder;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class color {
|
||||
public static final int block=0x7f040002;
|
||||
public static final int cancelled=0x7f040004;
|
||||
public static final int fragment_background=0x7f040003;
|
||||
public static final int subject=0x7f040000;
|
||||
public static final int teacher=0x7f040001;
|
||||
}
|
||||
public static final class dimen {
|
||||
/** Default screen margins, per the Android Design guidelines.
|
||||
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
|
||||
*/
|
||||
public static final int activity_horizontal_margin=0x7f050000;
|
||||
public static final int activity_vertical_margin=0x7f050001;
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int ic_launcher=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int box_subject=0x7f080008;
|
||||
public static final int cancelbar=0x7f08000f;
|
||||
public static final int changes=0x7f080007;
|
||||
public static final int listview=0x7f080003;
|
||||
public static final int main=0x7f080005;
|
||||
public static final int pager=0x7f080000;
|
||||
public static final int pager_title_strip=0x7f080001;
|
||||
public static final int remark=0x7f08000e;
|
||||
public static final int section_label=0x7f080002;
|
||||
public static final int subject=0x7f080009;
|
||||
public static final int subject_subinfo=0x7f08000a;
|
||||
public static final int teacher=0x7f080006;
|
||||
public static final int text=0x7f080004;
|
||||
public static final int textview_from=0x7f08000b;
|
||||
public static final int textview_to=0x7f08000d;
|
||||
public static final int to_arrow=0x7f08000c;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int activity_main=0x7f030000;
|
||||
public static final int fragment_main_dummy=0x7f030001;
|
||||
public static final int fragment_teacher_substitution=0x7f030002;
|
||||
public static final int pull_to_refresh_header=0x7f030003;
|
||||
public static final int teacher_substitution_change=0x7f030004;
|
||||
public static final int teacher_substitution_row_alteration=0x7f030005;
|
||||
public static final int teacher_substitution_row_remark=0x7f030006;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int action_settings=0x7f060007;
|
||||
public static final int app_name=0x7f060004;
|
||||
public static final int pull_to_refresh_aborting_label=0x7f060003;
|
||||
public static final int pull_to_refresh_pull_label=0x7f060000;
|
||||
public static final int pull_to_refresh_refreshing_label=0x7f060002;
|
||||
public static final int pull_to_refresh_release_label=0x7f060001;
|
||||
public static final int title_section1=0x7f060005;
|
||||
public static final int title_section2=0x7f060006;
|
||||
public static final int to_arrow=0x7f060008;
|
||||
}
|
||||
public static final class style {
|
||||
/**
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
|
||||
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
|
||||
|
||||
Base application theme for API 11+. This theme completely replaces
|
||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||
|
||||
API 11 theme customizations can go here.
|
||||
|
||||
Base application theme for API 14+. This theme completely replaces
|
||||
AppBaseTheme from BOTH res/values/styles.xml and
|
||||
res/values-v11/styles.xml on API 14+ devices.
|
||||
|
||||
API 14 theme customizations can go here.
|
||||
*/
|
||||
public static final int AppBaseTheme=0x7f070000;
|
||||
/** Application theme.
|
||||
All customizations that are NOT specific to a particular API-level can go here.
|
||||
*/
|
||||
public static final int AppTheme=0x7f070005;
|
||||
public static final int TextSize_Large=0x7f070002;
|
||||
public static final int TextSize_Medium=0x7f070003;
|
||||
public static final int TextSize_Small=0x7f070004;
|
||||
public static final int TextSize_VeryLarge=0x7f070001;
|
||||
}
|
||||
}
|
||||
BIN
source/libs/ic_launcher-web.png
Executable file
BIN
source/libs/ic_launcher-web.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
source/libs/libs/android-support-v4.jar
Executable file
BIN
source/libs/libs/android-support-v4.jar
Executable file
Binary file not shown.
BIN
source/libs/libs/commons-io-2.4.jar
Executable file
BIN
source/libs/libs/commons-io-2.4.jar
Executable file
Binary file not shown.
20
source/libs/proguard-project.txt
Executable file
20
source/libs/proguard-project.txt
Executable file
@@ -0,0 +1,20 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
14
source/libs/project.properties
Executable file
14
source/libs/project.properties
Executable file
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
BIN
source/libs/raw/images/pull_arrow.xcf
Executable file
BIN
source/libs/raw/images/pull_arrow.xcf
Executable file
Binary file not shown.
BIN
source/libs/res/drawable-hdpi/ic_launcher.png
Executable file
BIN
source/libs/res/drawable-hdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
source/libs/res/drawable-mdpi/ic_launcher.png
Executable file
BIN
source/libs/res/drawable-mdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 770 B |
BIN
source/libs/res/drawable-xhdpi/ic_launcher.png
Executable file
BIN
source/libs/res/drawable-xhdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
source/libs/res/drawable-xxhdpi/ic_launcher.png
Executable file
BIN
source/libs/res/drawable-xxhdpi/ic_launcher.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
23
source/libs/res/layout/activity_main.xml
Executable file
23
source/libs/res/layout/activity_main.xml
Executable file
@@ -0,0 +1,23 @@
|
||||
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity" >
|
||||
|
||||
<!--
|
||||
This title strip will display the currently visible page title, as well as the page
|
||||
titles for adjacent pages.
|
||||
-->
|
||||
|
||||
<android.support.v4.view.PagerTitleStrip
|
||||
android:id="@+id/pager_title_strip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:background="#fd0"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingTop="4dp"
|
||||
android:textColor="#000" />
|
||||
|
||||
</android.support.v4.view.ViewPager>
|
||||
17
source/libs/res/layout/fragment_main_dummy.xml
Executable file
17
source/libs/res/layout/fragment_main_dummy.xml
Executable file
@@ -0,0 +1,17 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".MainActivity$DummySectionFragment"
|
||||
android:background="@color/fragment_background" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/section_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
||||
7
source/libs/res/layout/fragment_teacher_substitution.xml
Executable file
7
source/libs/res/layout/fragment_teacher_substitution.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<me.caesar2011.vpherder.views.PullToRefreshListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/listview"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:background="@color/fragment_background" />
|
||||
31
source/libs/res/layout/pull_to_refresh_header.xml
Executable file
31
source/libs/res/layout/pull_to_refresh_header.xml
Executable file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:background="#777"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0sp"
|
||||
android:padding="0sp"
|
||||
android:layout_margin="0sp"
|
||||
android:visibility="gone"
|
||||
android:gravity="center" >
|
||||
<LinearLayout
|
||||
android:background="#777"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0sp"
|
||||
android:layout_margin="0sp"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:text="@string/pull_to_refresh_pull_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="0sp"
|
||||
android:paddingTop="0sp"
|
||||
android:paddingBottom="0sp"
|
||||
android:paddingLeft="10sp"
|
||||
android:layout_margin="0sp"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/text" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
10
source/libs/res/layout/teacher_substitution_change.xml
Executable file
10
source/libs/res/layout/teacher_substitution_change.xml
Executable file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/text"
|
||||
style="@android:style/TextAppearance.Small" />
|
||||
</RelativeLayout>
|
||||
110
source/libs/res/layout/teacher_substitution_row_alteration.xml
Executable file
110
source/libs/res/layout/teacher_substitution_row_alteration.xml
Executable file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/main" >
|
||||
<TextView
|
||||
android:layout_width="58sp"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="6sp"
|
||||
android:id="@+id/teacher"
|
||||
android:layout_gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/TextSize:VeryLarge"
|
||||
android:textColor="@color/teacher" />
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_toRightOf="@+id/teacher"
|
||||
android:layout_toLeftOf="@+id/changes"
|
||||
android:id="@+id/box_subject"
|
||||
android:layout_gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
style="@android:style/TextAppearance.Large" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6sp"
|
||||
android:paddingTop="6sp"
|
||||
android:paddingRight="6sp"
|
||||
android:paddingBottom="0sp"
|
||||
android:id="@+id/subject"
|
||||
style="@android:style/TextAppearance.Medium"
|
||||
android:textColor="@color/subject" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="6sp"
|
||||
android:paddingTop="0sp"
|
||||
android:paddingRight="6sp"
|
||||
android:paddingBottom="6sp"
|
||||
android:id="@+id/subject_subinfo"
|
||||
android:layout_below="@+id/subject"
|
||||
android:layout_alignLeft="@+id/subject"
|
||||
style="@android:style/TextAppearance.Small"
|
||||
android:textColor="@color/block" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/changes"
|
||||
android:layout_alignParentRight="true"
|
||||
style="@android:style/TextAppearance.Large" >
|
||||
<TextView
|
||||
android:layout_width="45sp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/textview_from"
|
||||
android:layout_toLeftOf="@+id/to_arrow"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
style="@android:style/TextAppearance.Small" />
|
||||
<TextView
|
||||
android:padding="6sp"
|
||||
android:layout_width="30sp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/to_arrow"
|
||||
android:id="@+id/to_arrow"
|
||||
android:layout_toLeftOf="@+id/textview_to"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/TextSize:VeryLarge" />
|
||||
<TextView
|
||||
android:layout_width="45sp"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/textview_to"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center"
|
||||
android:layout_centerVertical="true"
|
||||
style="@android:style/TextAppearance.Small" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/remark"
|
||||
android:layout_below="@+id/main"
|
||||
android:layout_centerVertical="true"
|
||||
style="@android:style/TextAppearance.Medium"
|
||||
android:textStyle="italic"
|
||||
android:padding="6sp" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/cancelbar"
|
||||
android:layout_alignLeft="@+id/main"
|
||||
android:layout_alignTop="@+id/main"
|
||||
android:layout_alignRight="@+id/main"
|
||||
android:layout_alignBottom="@+id/main">
|
||||
<View
|
||||
android:background="@color/cancelled"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="15sp"
|
||||
android:layout_marginRight="15sp"
|
||||
android:layout_centerInParent="true" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
11
source/libs/res/layout/teacher_substitution_row_remark.xml
Executable file
11
source/libs/res/layout/teacher_substitution_row_remark.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6sp"
|
||||
android:id="@+id/text"
|
||||
style="@android:style/TextAppearance.Medium" />
|
||||
</RelativeLayout>
|
||||
8
source/libs/res/values-sw600dp/dimens.xml
Executable file
8
source/libs/res/values-sw600dp/dimens.xml
Executable file
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||
-->
|
||||
|
||||
</resources>
|
||||
9
source/libs/res/values-sw720dp-land/dimens.xml
Executable file
9
source/libs/res/values-sw720dp-land/dimens.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
-->
|
||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||
|
||||
</resources>
|
||||
11
source/libs/res/values-v11/styles.xml
Executable file
11
source/libs/res/values-v11/styles.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 11+. This theme completely replaces
|
||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
|
||||
<!-- API 11 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
12
source/libs/res/values-v14/styles.xml
Executable file
12
source/libs/res/values-v14/styles.xml
Executable file
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 14+. This theme completely replaces
|
||||
AppBaseTheme from BOTH res/values/styles.xml and
|
||||
res/values-v11/styles.xml on API 14+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<!-- API 14 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
8
source/libs/res/values/colors.xml
Executable file
8
source/libs/res/values/colors.xml
Executable file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="subject">#d34937</color>
|
||||
<color name="teacher">#000</color>
|
||||
<color name="block">#888</color>
|
||||
<color name="fragment_background">#fff</color>
|
||||
<color name="cancelled">#f00</color>
|
||||
</resources>
|
||||
7
source/libs/res/values/dimens.xml
Executable file
7
source/libs/res/values/dimens.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
||||
7
source/libs/res/values/pull_to_refresh_strings.xml
Executable file
7
source/libs/res/values/pull_to_refresh_strings.xml
Executable file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="pull_to_refresh_pull_label">Ziehen zum Aktualisieren…</string>
|
||||
<string name="pull_to_refresh_release_label">Loslassen zum Aktualisieren…</string>
|
||||
<string name="pull_to_refresh_refreshing_label">Aktualisieren…</string>
|
||||
<string name="pull_to_refresh_aborting_label">Aktualisieren abbrechen…</string>
|
||||
</resources>
|
||||
9
source/libs/res/values/strings.xml
Executable file
9
source/libs/res/values/strings.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">vpHerder</string>
|
||||
<string name="title_section1">Heute</string>
|
||||
<string name="title_section2">Einstellungen</string>
|
||||
<string name="action_settings">Menü</string>
|
||||
|
||||
<string name="to_arrow">▶</string>
|
||||
</resources>
|
||||
35
source/libs/res/values/styles.xml
Executable file
35
source/libs/res/values/styles.xml
Executable file
@@ -0,0 +1,35 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme, dependent on API level. This theme is replaced
|
||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Light">
|
||||
<!--
|
||||
Theme customizations available in newer API levels can go in
|
||||
res/values-vXX/styles.xml, while customizations related to
|
||||
backward-compatibility can go here.
|
||||
-->
|
||||
</style>
|
||||
|
||||
<style name="TextSize:VeryLarge">
|
||||
<item name="android:textSize">32sp</item>
|
||||
</style>
|
||||
<style name="TextSize:Large">
|
||||
<item name="android:textSize">22sp</item>
|
||||
</style>
|
||||
<style name="TextSize:Medium">
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
<style name="TextSize:Small">
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
|
||||
<!-- Application theme. -->
|
||||
<style name="AppTheme" parent="AppBaseTheme">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
125
source/libs/src/me/caesar2011/vpherder/MainActivity.java
Executable file
125
source/libs/src/me/caesar2011/vpherder/MainActivity.java
Executable file
@@ -0,0 +1,125 @@
|
||||
package me.caesar2011.vpherder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSCreate;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MainActivity extends FragmentActivity {
|
||||
|
||||
/**
|
||||
* The {@link android.support.v4.view.PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a
|
||||
* {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
|
||||
* will keep every loaded fragment in memory. If this becomes too memory
|
||||
* intensive, it may be best to switch to a
|
||||
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
|
||||
*/
|
||||
SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
ViewPager mViewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// TSCreate the adapter that will return a fragment for each of the three
|
||||
// primary sections of the app.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(
|
||||
getSupportFragmentManager());
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// getItem is called to instantiate the fragment for the given page.
|
||||
// Return a SectionFragment (defined as a static inner class
|
||||
// below) with the page number as its lone argument.
|
||||
Fragment fragment = new SectionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(SectionFragment.ARG_SECTION_NUMBER, position + 1);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// Show 2 total pages.
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
Locale l = Locale.getDefault();
|
||||
switch (position) {
|
||||
case 0:
|
||||
return getString(R.string.title_section1).toUpperCase(l); // teacher substitution today
|
||||
case 1:
|
||||
return getString(R.string.title_section2).toUpperCase(l); //settings
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A dummy fragment representing a section of the app, but that simply
|
||||
* displays dummy text.
|
||||
*/
|
||||
public static class SectionFragment extends Fragment {
|
||||
/**
|
||||
* The fragment argument representing the section number for this
|
||||
* fragment.
|
||||
*/
|
||||
public static final String ARG_SECTION_NUMBER = "section_number";
|
||||
|
||||
public SectionFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
int page = getArguments().getInt(ARG_SECTION_NUMBER);
|
||||
if (page == 1) {
|
||||
return (new TSCreate(getActivity(), inflater, container)).Draw();
|
||||
}
|
||||
|
||||
// TODO delete this code
|
||||
View rootView = inflater.inflate(R.layout.fragment_main_dummy,
|
||||
container, false);
|
||||
TextView dummyTextView = (TextView) rootView
|
||||
.findViewById(R.id.section_label);
|
||||
dummyTextView.setText(Integer.toString(getArguments().getInt(
|
||||
ARG_SECTION_NUMBER)));
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
110
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSAdapter.java
Executable file
110
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSAdapter.java
Executable file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.caesar2011.vpherder.R;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSAdapter extends ArrayAdapter<TSjsonAnnouncement> {
|
||||
|
||||
private ArrayList<TSjsonAnnouncement> mData = new ArrayList<TSjsonAnnouncement>();
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public TSAdapter(Context context, int textViewResourceId,
|
||||
ArrayList<TSjsonAnnouncement> objects) {
|
||||
super(context, textViewResourceId, objects);
|
||||
mData = objects;
|
||||
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TSjsonAnnouncement getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// TODO Optimize
|
||||
if (mData.get(position) instanceof TSjsonAnnouncementRemark) {
|
||||
return AnnounceType.REMARK;
|
||||
} else {
|
||||
return AnnounceType.ALTERATION;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return AnnounceType.count;
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder holder = null;
|
||||
int type = getItemViewType(position);
|
||||
if (convertView == null || convertView.getTag() == null) {
|
||||
switch (type) {
|
||||
case AnnounceType.REMARK:
|
||||
convertView = mInflater.inflate(R.layout.teacher_substitution_row_remark, null);
|
||||
break;
|
||||
case AnnounceType.ALTERATION:
|
||||
convertView = mInflater.inflate(R.layout.teacher_substitution_row_alteration, null);
|
||||
break;
|
||||
}
|
||||
holder = mData.get(position).createHolder(convertView);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
// (Re-)fill view with new data
|
||||
mData.get(position).refillView(holder);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
// SUB CLASSES
|
||||
|
||||
static class AnnounceType {
|
||||
public static final int REMARK = 0;
|
||||
public static final int ALTERATION = 1;
|
||||
public static final int count = 2;
|
||||
}
|
||||
|
||||
public static class ViewHolder {}
|
||||
|
||||
public static class ViewHolderREMARK extends ViewHolder {
|
||||
public TextView text;
|
||||
}
|
||||
|
||||
public static class ViewHolderALTERATION extends ViewHolder {
|
||||
public TextView teacher;
|
||||
public TextView subject;
|
||||
public TextView subject_subinfo;
|
||||
public TextView changes_from;
|
||||
public TextView changes_to;
|
||||
public TextView remark;
|
||||
public View cancelbar;
|
||||
public RelativeLayout changes;
|
||||
}
|
||||
}
|
||||
128
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSCreate.java
Executable file
128
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSCreate.java
Executable file
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import me.caesar2011.vpherder.R;
|
||||
import me.caesar2011.vpherder.views.PullToRefreshListView;
|
||||
import me.caesar2011.vpherder.views.PullToRefreshListView.OnRefreshListener;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.json.JSONException;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.AsyncTask;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Class to organize the drawings of the teacher substition.
|
||||
*
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSCreate {
|
||||
|
||||
private final Activity activity;
|
||||
private final LayoutInflater inflater;
|
||||
private final ViewGroup container;
|
||||
private static TSjsonObject JsonObject;
|
||||
private boolean downloadStarted;
|
||||
private TSAdapter adapter;
|
||||
private PullToRefreshListView listview;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public TSCreate(Activity activity, LayoutInflater inflater, ViewGroup container) {
|
||||
this.activity = activity;
|
||||
this.inflater = inflater;
|
||||
this.container = container;
|
||||
this.downloadStarted = false;
|
||||
|
||||
if(JsonObject == null){
|
||||
StartDownload();
|
||||
}
|
||||
}
|
||||
|
||||
public View Draw() {
|
||||
View rootView = inflater.inflate(R.layout.fragment_teacher_substitution,
|
||||
container, false);
|
||||
|
||||
listview = (PullToRefreshListView) rootView.findViewById(R.id.listview);
|
||||
listview.setOnRefreshListener(new OnRefreshListener() {
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
StartDownload();
|
||||
}
|
||||
|
||||
});
|
||||
System.out.println(JsonObject);
|
||||
adapter = new TSAdapter(activity,
|
||||
R.layout.teacher_substitution_row_remark, (JsonObject!=null)?JsonObject.announcements:(new ArrayList<TSjsonAnnouncement>()));
|
||||
listview.setAdapter(adapter);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
public void StartDownload() {
|
||||
if (!downloadStarted) {
|
||||
downloadStarted = true;
|
||||
try {
|
||||
URL url = new URL("https://vpherder.canis.uberspace.de/example.json");
|
||||
DownloadFilesTask downloadSubstitutions = new DownloadFilesTask();
|
||||
downloadSubstitutions.execute(url);
|
||||
} catch (MalformedURLException e) {
|
||||
downloadStarted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FinishDownload() {
|
||||
downloadStarted = false;
|
||||
adapter.clear();
|
||||
adapter.addAll(JsonObject.announcements);
|
||||
adapter.notifyDataSetChanged();
|
||||
listview.onRefreshComplete();
|
||||
}
|
||||
|
||||
private class DownloadFilesTask extends AsyncTask<URL, Integer, String> {
|
||||
|
||||
protected String doInBackground(URL... urls) {
|
||||
String file = "";
|
||||
URL url = urls[0];
|
||||
URLConnection connection;
|
||||
try {
|
||||
connection = url.openConnection();
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
IOUtils.copy(inputStream, writer, "UTF-8");
|
||||
file = writer.toString();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
protected void onProgressUpdate(Integer... progress) {
|
||||
//setProgressPercent(progress[0]);
|
||||
}
|
||||
|
||||
protected void onPostExecute(String result) {
|
||||
try {
|
||||
JsonObject = new TSjsonObject(result);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
FinishDownload();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSAdapter.ViewHolder;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public class TSjsonAnnouncement {
|
||||
|
||||
public final String type;
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @throws JSONException
|
||||
*/
|
||||
public TSjsonAnnouncement(JSONObject jsonObject) throws JSONException {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.type = jsonObject.getString("type");
|
||||
}
|
||||
|
||||
public void refillView(ViewHolder holder) {
|
||||
|
||||
}
|
||||
|
||||
public ViewHolder createHolder(View convertView) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import me.caesar2011.vpherder.R;
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSAdapter.ViewHolder;
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSAdapter.ViewHolderALTERATION;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSjsonAnnouncementAlteration extends TSjsonAnnouncement {
|
||||
|
||||
public final int time;
|
||||
public final String form;
|
||||
public final String teacher;
|
||||
public final String subject;
|
||||
public final boolean cancelled;
|
||||
public final ArrayList<TSjsonChange> changes;
|
||||
public final String remark;
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @throws JSONException
|
||||
*/
|
||||
public TSjsonAnnouncementAlteration(JSONObject jsonObject)
|
||||
throws JSONException {
|
||||
super(jsonObject);
|
||||
this.time = jsonObject.getInt("time");
|
||||
this.form = jsonObject.getString("form");
|
||||
this.teacher = jsonObject.getString("teacher");
|
||||
this.subject = jsonObject.getString("class");
|
||||
this.cancelled = jsonObject.getBoolean("cancelled");
|
||||
|
||||
this.changes = new ArrayList<TSjsonChange>();
|
||||
JSONObject jObject = jsonObject.getJSONObject("changes");
|
||||
Iterator<?> i = jObject.keys();
|
||||
|
||||
while(i.hasNext()){
|
||||
String key = (String)i.next();
|
||||
if(jObject.get(key) instanceof JSONObject){
|
||||
jObject.getJSONObject(key);
|
||||
TSjsonChange jChanges = new TSjsonChange(key,
|
||||
jObject.getJSONObject(key).getString("old"),
|
||||
jObject.getJSONObject(key).getString("new"));
|
||||
this.changes.add(jChanges);
|
||||
}
|
||||
}
|
||||
this.remark = jsonObject.optString("remark");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refillView(ViewHolder holder) {
|
||||
ViewHolderALTERATION holdAlteration = (ViewHolderALTERATION) holder;
|
||||
holdAlteration.teacher.setText(teacher);
|
||||
holdAlteration.subject.setText(subject);
|
||||
holdAlteration.subject_subinfo.setText(time + " - " + form);
|
||||
|
||||
String sFrom = "";
|
||||
String sTo = "";
|
||||
Iterator<TSjsonChange> i = changes.iterator();
|
||||
while (i.hasNext()) {
|
||||
TSjsonChange jChange = i.next();
|
||||
if (!sFrom.equals("")) {
|
||||
sFrom += "\n";
|
||||
sTo += "\n";
|
||||
}
|
||||
sFrom += jChange.oldValue;
|
||||
sTo += jChange.newValue;
|
||||
}
|
||||
holdAlteration.changes_from.setText(sFrom);
|
||||
holdAlteration.changes_to.setText(sTo);
|
||||
|
||||
if (remark.equals("false")) {
|
||||
holdAlteration.remark.setVisibility(View.GONE);
|
||||
} else {
|
||||
holdAlteration.remark.setVisibility(View.VISIBLE);
|
||||
holdAlteration.remark.setText(remark);
|
||||
}
|
||||
|
||||
if (sFrom.equals("")) {
|
||||
holdAlteration.changes.setVisibility(View.GONE);
|
||||
} else {
|
||||
holdAlteration.changes.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (cancelled) {
|
||||
holdAlteration.cancelbar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holdAlteration.cancelbar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder createHolder(View convertView) {
|
||||
ViewHolderALTERATION holder = new ViewHolderALTERATION();
|
||||
holder.teacher = (TextView)convertView.findViewById(R.id.teacher);
|
||||
holder.subject = (TextView)convertView.findViewById(R.id.subject);
|
||||
holder.subject_subinfo = (TextView)convertView.findViewById(R.id.subject_subinfo);
|
||||
holder.changes_from = (TextView)convertView.findViewById(R.id.textview_from);
|
||||
holder.changes_to = (TextView)convertView.findViewById(R.id.textview_to);
|
||||
holder.remark = (TextView)convertView.findViewById(R.id.remark);
|
||||
holder.cancelbar = (View)convertView.findViewById(R.id.cancelbar);
|
||||
holder.changes = (RelativeLayout)convertView.findViewById(R.id.changes);
|
||||
return holder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import me.caesar2011.vpherder.R;
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSAdapter.ViewHolder;
|
||||
import me.caesar2011.vpherder.teachersubstitution.TSAdapter.ViewHolderREMARK;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSjsonAnnouncementRemark extends TSjsonAnnouncement {
|
||||
|
||||
public final String text;
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @throws JSONException
|
||||
*/
|
||||
public TSjsonAnnouncementRemark(JSONObject jsonObject) throws JSONException {
|
||||
super(jsonObject);
|
||||
this.text = jsonObject.optString("text");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refillView(ViewHolder holder) {
|
||||
ViewHolderREMARK holdRemark = (ViewHolderREMARK) holder;
|
||||
holdRemark.text.setText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder createHolder(View convertView) {
|
||||
ViewHolderREMARK holder = new ViewHolderREMARK();
|
||||
holder.text = (TextView)convertView.findViewById(R.id.text);
|
||||
return holder;
|
||||
}
|
||||
|
||||
}
|
||||
27
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSjsonChange.java
Executable file
27
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSjsonChange.java
Executable file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
|
||||
/**
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSjsonChange {
|
||||
|
||||
public final String name;
|
||||
public final String oldValue;
|
||||
public final String newValue;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public TSjsonChange(String name, String oldValue, String newValue) {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.name = name;
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
}
|
||||
77
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSjsonObject.java
Executable file
77
source/libs/src/me/caesar2011/vpherder/teachersubstitution/TSjsonObject.java
Executable file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package me.caesar2011.vpherder.teachersubstitution;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* The hole json object witch handles version, date, creation/modified time, etc. ...
|
||||
* And it holds a list of all announcements.
|
||||
*
|
||||
* @author BastiLapTop
|
||||
*
|
||||
*/
|
||||
public class TSjsonObject {
|
||||
|
||||
public final String version;
|
||||
public final Date date;
|
||||
public final Date created;
|
||||
public final Date modified;
|
||||
public final ArrayList<TSjsonAnnouncement> announcements;
|
||||
|
||||
|
||||
/**
|
||||
* @param jsonObject
|
||||
* @throws JSONException
|
||||
*/
|
||||
public TSjsonObject(JSONObject jsonObject) throws JSONException {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.version = jsonObject.getString("version");
|
||||
|
||||
try {
|
||||
this.date = new SimpleDateFormat("yyyy-MM-dd", Locale.GERMANY).parse(jsonObject.getString("date"));
|
||||
} catch (ParseException e) {
|
||||
throw new JSONException("Date could not be converted. ParseExeption.");
|
||||
}
|
||||
|
||||
try {
|
||||
this.created = new Date(Long.parseLong(jsonObject.getString("created")) * 1000);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("Created could not be converted. NumberFormatException.");
|
||||
}
|
||||
|
||||
try {
|
||||
this.modified = new Date(Long.parseLong(jsonObject.getString("modified")) * 1000);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("Modified could not be converted. NumberFormatException.");
|
||||
}
|
||||
|
||||
JSONArray jArray = jsonObject.getJSONArray("announcements");
|
||||
JSONObject jObject = null;
|
||||
this.announcements = new ArrayList<TSjsonAnnouncement>();
|
||||
for (int i = 0; i < jArray.length(); i++) {
|
||||
jObject = jArray.getJSONObject(i);
|
||||
if (jObject.getString("type").equals("alteration")) {
|
||||
this.announcements.add(new TSjsonAnnouncementAlteration(jObject));
|
||||
} else {
|
||||
this.announcements.add(new TSjsonAnnouncementRemark(jObject));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TSjsonObject(String jsonString) throws JSONException {
|
||||
this(new JSONObject(jsonString));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
187
source/libs/src/me/caesar2011/vpherder/views/PullToRefreshListView.java
Executable file
187
source/libs/src/me/caesar2011/vpherder/views/PullToRefreshListView.java
Executable file
@@ -0,0 +1,187 @@
|
||||
package me.caesar2011.vpherder.views;
|
||||
|
||||
import me.caesar2011.vpherder.R;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AbsListView.OnScrollListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class PullToRefreshListView extends ListView implements OnScrollListener {
|
||||
|
||||
private float mStartX;
|
||||
private float mStartY;
|
||||
private int mRefreshState;
|
||||
private LayoutInflater mInflater;
|
||||
private View mHeaderView;
|
||||
private HeaderViewHolder mHeaderViewHolder;
|
||||
private int mLastTopVisiblePos;
|
||||
private OnRefreshListener mOnRefreshListener;
|
||||
|
||||
private static final int PULL_DOWN_LIMIT = (int) Math.round(0.75 * DisplayMetrics.DENSITY_DEFAULT);
|
||||
|
||||
public PullToRefreshListView(Context context) {
|
||||
super(context);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PullToRefreshListView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public PullToRefreshListView(Context context, AttributeSet attrs,
|
||||
int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init(context);
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
super.setOnScrollListener(this);
|
||||
|
||||
mInflater = (LayoutInflater) context.getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
mHeaderView = mInflater.inflate(R.layout.pull_to_refresh_header, null);
|
||||
mHeaderViewHolder = new HeaderViewHolder(mHeaderView);
|
||||
addHeaderView(mHeaderView);
|
||||
System.out.println("k"+mHeaderView);
|
||||
|
||||
mRefreshState = RefreshState.PULL_TO_REFRESH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView arg0, int arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
boolean isHandled = false;
|
||||
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN || mLastTopVisiblePos == 1) {
|
||||
int refreshBoxHeight = (int) ((mRefreshState == RefreshState.REFRESHING)?PULL_DOWN_LIMIT:1);
|
||||
mStartX = event.getRawX();
|
||||
mStartY = event.getRawY()-refreshBoxHeight;
|
||||
mHeaderViewHolder.setVisibility(View.VISIBLE);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, refreshBoxHeight));
|
||||
}
|
||||
if (event.getRawY()-mStartY > Math.abs(event.getRawX()-mStartX) && getFirstVisiblePosition() == 0) {
|
||||
int stretch = (int) Math.max(0, event.getRawY()-mStartY);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, stretch));
|
||||
if (mRefreshState == RefreshState.PULL_TO_REFRESH && stretch > PULL_DOWN_LIMIT) {
|
||||
mRefreshState = RefreshState.RELEASE_TO_REFRESH;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
} else if (mRefreshState == RefreshState.RELEASE_TO_REFRESH && stretch <= PULL_DOWN_LIMIT) {
|
||||
mRefreshState = RefreshState.PULL_TO_REFRESH;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
} else if (mRefreshState == RefreshState.ABORTING && stretch > PULL_DOWN_LIMIT) {
|
||||
mRefreshState = RefreshState.RELEASE_TO_REFRESH;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
} else if (mRefreshState == RefreshState.REFRESHING && stretch <= PULL_DOWN_LIMIT/2) {
|
||||
mRefreshState = RefreshState.ABORTING;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
}
|
||||
isHandled = true;
|
||||
}
|
||||
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
isHandled = false;
|
||||
switch (mRefreshState) {
|
||||
case RefreshState.PULL_TO_REFRESH:
|
||||
mHeaderViewHolder.setVisibility(View.GONE);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, 0));
|
||||
break;
|
||||
case RefreshState.RELEASE_TO_REFRESH:
|
||||
Refresh();
|
||||
break;
|
||||
case RefreshState.REFRESHING:
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, PULL_DOWN_LIMIT));
|
||||
break;
|
||||
case RefreshState.ABORTING:
|
||||
mHeaderViewHolder.setVisibility(View.GONE);
|
||||
mRefreshState = RefreshState.PULL_TO_REFRESH;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
mLastTopVisiblePos = getFirstVisiblePosition();
|
||||
return isHandled?true:super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
private class HeaderViewHolder {
|
||||
public final View mParent;
|
||||
public final TextView mText;
|
||||
|
||||
public HeaderViewHolder(View HeaderView) {
|
||||
mParent = HeaderView;
|
||||
mText = (TextView) HeaderView.findViewById(R.id.text);
|
||||
}
|
||||
|
||||
public void setVisibility(int visibility) {
|
||||
mParent.setVisibility(visibility);
|
||||
mText.setVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setRefreshingState(int refreshState) {
|
||||
switch (refreshState){
|
||||
case RefreshState.PULL_TO_REFRESH:
|
||||
mText.setText(R.string.pull_to_refresh_pull_label);
|
||||
break;
|
||||
case RefreshState.RELEASE_TO_REFRESH:
|
||||
mText.setText(R.string.pull_to_refresh_release_label);
|
||||
break;
|
||||
case RefreshState.REFRESHING:
|
||||
mText.setText(R.string.pull_to_refresh_refreshing_label);
|
||||
break;
|
||||
case RefreshState.ABORTING:
|
||||
mText.setText(R.string.pull_to_refresh_aborting_label);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class RefreshState {
|
||||
public static final int PULL_TO_REFRESH = 1;
|
||||
public static final int RELEASE_TO_REFRESH = 2;
|
||||
public static final int REFRESHING = 3;
|
||||
public static final int ABORTING = 4;
|
||||
}
|
||||
|
||||
public void Refresh() {
|
||||
mHeaderViewHolder.setVisibility(View.VISIBLE);
|
||||
mRefreshState = RefreshState.REFRESHING;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, PULL_DOWN_LIMIT));
|
||||
System.out.print("onRefresh");
|
||||
if (mOnRefreshListener != null) {
|
||||
mOnRefreshListener.onRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnRefreshListener(OnRefreshListener onRefreshListener) {
|
||||
mOnRefreshListener = onRefreshListener;
|
||||
}
|
||||
|
||||
public void onRefreshComplete() {
|
||||
mHeaderViewHolder.setVisibility(View.GONE);
|
||||
mRefreshState = RefreshState.PULL_TO_REFRESH;
|
||||
mHeaderViewHolder.setRefreshingState(mRefreshState);
|
||||
mHeaderView.setLayoutParams(new LayoutParams(mHeaderView.getLayoutParams().width, 0));
|
||||
}
|
||||
|
||||
public interface OnRefreshListener {
|
||||
public void onRefresh();
|
||||
}
|
||||
}
|
||||
19
source/libs/vpHerderAndroid.iml
Executable file
19
source/libs/vpHerderAndroid.iml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="libs" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
Reference in New Issue
Block a user