Skip to content

Commit 21484b4

Browse files
committed
init project
0 parents  commit 21484b4

32 files changed

+3153
-0
lines changed

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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
17+
18+
# Eclipse project files
19+
.classpath
20+
.project
21+
22+
# Proguard folder generated by Eclipse
23+
proguard/
24+
25+
# Intellij project files
26+
*.iml
27+
*.ipr
28+
*.iws
29+
.idea/
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

.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.6
3+
org.eclipse.jdt.core.compiler.compliance=1.6
4+
org.eclipse.jdt.core.compiler.source=1.6

AndroidManifest.xml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.test"
4+
android:versionCode="1"
5+
android:versionName="1.0" >
6+
7+
<uses-sdk
8+
android:minSdkVersion="4"
9+
android:targetSdkVersion="4" />
10+
11+
<uses-permission android:name="android.permission.INTERNET" />
12+
<application
13+
android:allowBackup="true"
14+
android:icon="@drawable/ic_launcher"
15+
android:label="@string/app_name"
16+
android:theme="@style/AppTheme" >
17+
<activity
18+
android:name="com.example.test.MainActivity"
19+
android:label="@string/app_name" >
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
27+
<activity
28+
android:name="com.example.test.MainActivity2"
29+
android:label="@string/app_name"
30+
android:launchMode="singleInstance" >
31+
</activity>
32+
33+
</application>
34+
35+
</manifest>

ic_launcher-web.png

50.2 KB
Loading

libs/android-support-v4.jar

377 KB
Binary file not shown.

libs/jsoup-1.7.2.jar

287 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-21

res/drawable-hdpi/ic_launcher.png

7.48 KB
Loading

res/drawable-mdpi/ic_launcher.png

3.69 KB
Loading

res/drawable-xhdpi/ic_launcher.png

12.2 KB
Loading

res/drawable-xxhdpi/ic_launcher.png

24.2 KB
Loading

res/layout/activity_main.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<RelativeLayout 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+
tools:context=".MainActivity" >
6+
7+
<TextView
8+
android:id="@+id/start"
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:layout_centerHorizontal="true"
12+
android:layout_centerVertical="true"
13+
android:text="@string/hello_world" />
14+
15+
</RelativeLayout>

res/menu/activity_main.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2+
3+
<item
4+
android:id="@+id/menu_settings"
5+
android:orderInCategory="100"
6+
android:title="@string/menu_settings"/>
7+
8+
</menu>

res/values/strings.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<string name="app_name">test</string>
5+
<string name="menu_settings">Settings</string>
6+
<string name="hello_world">Hello world!</string>
7+
8+
</resources>

res/values/styles.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!--
4+
Base application theme, dependent on API level. This theme is replaced
5+
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6+
-->
7+
<style name="AppBaseTheme" parent="android:Theme.Light">
8+
<!--
9+
Theme customizations available in newer API levels can go in
10+
res/values-vXX/styles.xml, while customizations related to
11+
backward-compatibility can go here.
12+
-->
13+
</style>
14+
15+
<!-- Application theme. -->
16+
<style name="AppTheme" parent="AppBaseTheme">
17+
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
18+
</style>
19+
20+
</resources>
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.example.test;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.view.View;
7+
import android.view.View.OnClickListener;
8+
import android.widget.TextView;
9+
10+
public class MainActivity extends Activity {
11+
12+
@Override
13+
protected void onCreate(Bundle savedInstanceState) {
14+
super.onCreate(savedInstanceState);
15+
setContentView(R.layout.activity_main);
16+
TextView tv=(TextView) findViewById(R.id.start);
17+
tv.setOnClickListener(new OnClickListener() {
18+
19+
@Override
20+
public void onClick(View v) {
21+
// TODO Auto-generated method stub
22+
Intent in=new Intent(MainActivity.this, MainActivity2.class);
23+
startActivity(in);
24+
}
25+
});
26+
27+
}
28+
29+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.example.test;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
6+
public class MainActivity2 extends Activity {
7+
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_main);
12+
13+
14+
}
15+
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/******************************************************************************
2+
*
3+
* Copyright 2011-2012 Tavendo GmbH
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+
******************************************************************************/
18+
19+
package de.tavendo.autobahn;
20+
21+
import java.io.IOException;
22+
import java.io.InputStream;
23+
import java.nio.ByteBuffer;
24+
25+
/**
26+
* InputStream wrapping a ByteBuffer. This class can be used i.e. to wrap
27+
* ByteBuffers allocated direct in NIO for socket I/O. The class does not
28+
* allocate ByteBuffers itself, but assumes the user has already one that
29+
* just needs to be wrapped to use with InputStream based processing.
30+
*/
31+
public class ByteBufferInputStream extends InputStream {
32+
33+
/// ByteBuffer backing this input stream.
34+
private final ByteBuffer mBuffer;
35+
36+
/**
37+
* Create input stream over ByteBuffer.
38+
*
39+
* @param buffer ByteBuffer to wrap as input stream.
40+
*/
41+
public ByteBufferInputStream(ByteBuffer buffer) {
42+
mBuffer = buffer;
43+
}
44+
45+
/**
46+
* Read one byte from input stream and advance.
47+
*
48+
* @return Byte read or -1 when stream end reached.
49+
*/
50+
@Override
51+
public synchronized int read() throws IOException {
52+
53+
if (!mBuffer.hasRemaining()) {
54+
return -1;
55+
} else {
56+
return mBuffer.get() & 0xFF;
57+
}
58+
}
59+
60+
/**
61+
* Read chunk of bytes from input stream and advance. Read either as many
62+
* bytes specified or input stream end reached.
63+
*
64+
* @param bytes Read bytes into byte array.
65+
* @param off Read bytes into byte array beginning at this offset.
66+
* @param len Read at most this many bytes.
67+
* @return Actual number of bytes read.
68+
*/
69+
@Override
70+
public synchronized int read(byte[] bytes, int off, int len)
71+
throws IOException {
72+
73+
if (bytes == null) {
74+
throw new NullPointerException();
75+
} else if (off < 0 || len < 0 || len > bytes.length - off) {
76+
throw new IndexOutOfBoundsException();
77+
} else if (len == 0) {
78+
return 0;
79+
}
80+
81+
int length = Math.min(mBuffer.remaining(), len);
82+
if (length == 0) {
83+
return -1;
84+
}
85+
86+
mBuffer.get(bytes, off, length);
87+
return length;
88+
}
89+
90+
}

0 commit comments

Comments
 (0)