Skip to content

Commit f1bbd7e

Browse files
initial commit
0 parents  commit f1bbd7e

23 files changed

+298
-0
lines changed

.classpath

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry kind="output" path="bin/classes"/>
8+
</classpath>

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# generated files
12+
bin/
13+
gen/
14+
15+
# Local configuration file (sdk path, etc)
16+
local.properties

.project

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>iUPB</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3+
org.eclipse.jdt.core.compiler.compliance=1.5
4+
org.eclipse.jdt.core.compiler.source=1.5

AndroidManifest.xml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="io.yippie.iupb.app"
3+
android:versionCode="9"
4+
android:versionName="1.7" >
5+
6+
<uses-sdk
7+
android:minSdkVersion="8"
8+
android:targetSdkVersion="15" />
9+
10+
<uses-permission android:name="android.permission.INTERNET" />
11+
<application
12+
android:icon="@drawable/ic_launcher"
13+
android:label="@string/app_name"
14+
android:theme="@style/AppTheme" >
15+
<activity
16+
android:name=".MainActivity"
17+
android:label="@string/title_activity_main" >
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
</manifest>

ic_launcher-web.png

37.8 KB
Loading

libs/android-support-v4.jar

341 KB
Binary file not shown.

proguard-project.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

project.properties

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-16
3.05 KB
Loading

res/drawable-hdpi/ic_launcher.png

2.38 KB
Loading

res/drawable-ldpi/ic_launcher.png

941 Bytes
Loading
2.96 KB
Loading

res/drawable-mdpi/ic_launcher.png

1.37 KB
Loading
3.12 KB
Loading

res/drawable-xhdpi/ic_launcher.png

3.72 KB
Loading

res/layout/activity_main.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="fill_parent"
4+
android:layout_height="fill_parent"
5+
android:paddingTop="0dp"
6+
android:paddingBottom="0dp"
7+
android:paddingLeft="0dp"
8+
android:paddingRight="0dp"
9+
android:orientation="horizontal">
10+
11+
<WebView
12+
android:id="@+id/webViewIUPB"
13+
android:layout_width="fill_parent"
14+
android:layout_height="fill_parent"/>
15+
16+
</LinearLayout>

res/menu/activity_main.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<item android:id="@+id/itemHome" android:title="@string/actionbar_home_label"></item><item android:id="@+id/itemRestaurants" android:title="@string/actionbar_restaurants_label" android:enabled="true"></item>
4+
5+
<item android:id="@+id/itemTransporation" android:title="@string/actionbar_transportation_label" android:enabled="true"></item>
6+
<item android:id="@+id/itemPaul" android:title="@string/actionbar_paul_label"></item>
7+
<item android:id="@+id/itemTimetable" android:title="@string/actionbar_timetable_label"></item><item android:id="@+id/itemWeather" android:title="@string/actionbar_weather_label"></item>
8+
<item android:id="@+id/itemTwitter" android:title="@string/actionbar_twitter_label"></item>
9+
<item android:id="@+id/itemAsta" android:title="@string/actionbar_asta_label"></item>
10+
11+
12+
</menu>

res/values-v11/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Holo.Light" />
4+
5+
</resources>

res/values-v14/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
4+
5+
</resources>

res/values/strings.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<resources>
2+
3+
<string name="app_name">iUPB</string>
4+
<string name="title_activity_main">iUPB</string>
5+
<string name="actionbar_restaurants_label">Restaurants</string>
6+
<string name="actionbar_transportation_label">Buses</string>
7+
<string name="iupb_base_url">beta.i-upb.de</string>
8+
<string name="progressbar_pleasewait">Bitte warten&#8230;</string>
9+
<string name="actionbar_paul_label">PAUL</string>
10+
<string name="actionbar_parties_label">Parties</string>
11+
<string name="actionbar_weather_label">Wetter</string>
12+
<string name="actionbar_twitter_label">Twitter</string>
13+
<string name="actionbar_asta_label">AStA News</string>
14+
<string name="actionbar_timetable_label">Stundenplan</string>
15+
<string name="actionbar_home_label">Home</string>
16+
</resources>

res/values/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Light" />
4+
5+
</resources>
+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package io.yippie.iupb.app;
2+
3+
import android.net.Uri;
4+
import android.os.Bundle;
5+
import android.app.ActionBar;
6+
import android.app.Activity;
7+
import android.app.ProgressDialog;
8+
import android.content.Intent;
9+
import android.graphics.Bitmap;
10+
import android.view.KeyEvent;
11+
import android.view.Menu;
12+
import android.view.MenuItem;
13+
import android.webkit.WebSettings;
14+
import android.webkit.WebView;
15+
import android.webkit.WebViewClient;
16+
17+
public class MainActivity extends Activity {
18+
19+
private ProgressDialog progressDialog;
20+
private WebView mainWebView;
21+
22+
@Override
23+
public void onCreate(Bundle savedInstanceState) {
24+
super.onCreate(savedInstanceState);
25+
setContentView(R.layout.activity_main);
26+
27+
//progressbar
28+
progressDialog = new ProgressDialog(MainActivity.this);
29+
progressDialog.setMessage(getString(R.string.progressbar_pleasewait));
30+
progressDialog.setCancelable(true);
31+
32+
mainWebView = (WebView) findViewById(R.id.webViewIUPB);
33+
mainWebView.setWebViewClient(new WebViewClient() {
34+
@Override
35+
public boolean shouldOverrideUrlLoading(WebView view, String url) {
36+
if (Uri.parse(url).getHost().equals(getString(R.string.iupb_base_url))) {
37+
view.loadUrl(url);
38+
return false;
39+
}else {
40+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
41+
startActivity(intent);
42+
return true;
43+
}
44+
}
45+
46+
@Override
47+
public void onPageFinished(WebView view, String url) {
48+
// TODO Auto-generated method stub
49+
super.onPageFinished(view, url);
50+
progressDialog.hide();
51+
}
52+
53+
@Override
54+
public void onPageStarted(WebView view, String url, Bitmap favicon) {
55+
// TODO Auto-generated method stub
56+
super.onPageStarted(view, url, favicon);
57+
progressDialog.show();
58+
}
59+
60+
});
61+
62+
mainWebView.loadUrl(generateURL("/"));
63+
WebSettings webSettings = mainWebView.getSettings();
64+
webSettings.setJavaScriptEnabled(true);
65+
}
66+
67+
@Override
68+
public boolean onKeyDown(int keyCode, KeyEvent event) {
69+
// Check if the key event was the Back button and if there's history
70+
if ((keyCode == KeyEvent.KEYCODE_BACK) && mainWebView.canGoBack()) {
71+
mainWebView.goBack();
72+
return true;
73+
}
74+
// If it wasn't the Back key or there's no web page history, bubble up to the default
75+
// system behavior (probably exit the activity)
76+
return super.onKeyDown(keyCode, event);
77+
}
78+
79+
@Override
80+
public boolean onCreateOptionsMenu(Menu menu) {
81+
getMenuInflater().inflate(R.menu.activity_main, menu);
82+
return true;
83+
}
84+
85+
private String generateURL(String target) {
86+
return "http://" + getString(R.string.iupb_base_url) + "/" + target + "?canvas=true&os=android";
87+
}
88+
89+
@Override
90+
public boolean onOptionsItemSelected(MenuItem item) {
91+
// TODO Auto-generated method stub
92+
switch(item.getItemId()) {
93+
case R.id.itemHome:
94+
mainWebView.loadUrl(generateURL(""));
95+
return true;
96+
case R.id.itemRestaurants:
97+
mainWebView.loadUrl(generateURL("restaurants"));
98+
return true;
99+
case R.id.itemTransporation:
100+
mainWebView.loadUrl(generateURL("transportation"));
101+
return true;
102+
case R.id.itemAsta:
103+
mainWebView.loadUrl(generateURL("asta"));
104+
return true;
105+
case R.id.itemPaul:
106+
mainWebView.loadUrl(generateURL("courses"));
107+
return true;
108+
case R.id.itemTimetable:
109+
mainWebView.loadUrl(generateURL("timetable"));
110+
return true;
111+
case R.id.itemWeather:
112+
mainWebView.loadUrl(generateURL("weather"));
113+
return true;
114+
default:
115+
return super.onOptionsItemSelected(item);
116+
}
117+
}
118+
119+
}

0 commit comments

Comments
 (0)