Skip to content

Commit ddef61e

Browse files
committed
create sunshine app with default hello world contents
1 parent 267143c commit ddef61e

24 files changed

+479
-0
lines changed

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'android'
2+
3+
android {
4+
compileSdkVersion 19
5+
buildToolsVersion "20.0.0"
6+
7+
defaultConfig {
8+
minSdkVersion 10
9+
targetSdkVersion 20
10+
versionCode 1
11+
versionName "1.0"
12+
}
13+
buildTypes {
14+
release {
15+
runProguard false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
compile fileTree(dir: 'libs', include: ['*.jar'])
23+
compile 'com.android.support:appcompat-v7:20.0.0'
24+
compile 'com.android.support:support-v4:20.0.0'
25+
}

app/proguard-rules.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in android-sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the ProGuard
5+
# include property in project.properties.
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+
#}

app/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.android.sunshine.app" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@drawable/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name="com.example.android.sunshine.app.MainActivity"
12+
android:label="@string/app_name" >
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.example.android.sunshine.app;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.Fragment;
5+
import android.support.v7.app.ActionBarActivity;
6+
import android.view.LayoutInflater;
7+
import android.view.Menu;
8+
import android.view.MenuItem;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
12+
13+
public class MainActivity extends ActionBarActivity {
14+
15+
@Override
16+
protected void onCreate(Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
setContentView(R.layout.activity_main);
19+
if (savedInstanceState == null) {
20+
getSupportFragmentManager().beginTransaction()
21+
.add(R.id.container, new PlaceholderFragment())
22+
.commit();
23+
}
24+
}
25+
26+
27+
@Override
28+
public boolean onCreateOptionsMenu(Menu menu) {
29+
// Inflate the menu; this adds items to the action bar if it is present.
30+
getMenuInflater().inflate(R.menu.main, menu);
31+
return true;
32+
}
33+
34+
@Override
35+
public boolean onOptionsItemSelected(MenuItem item) {
36+
// Handle action bar item clicks here. The action bar will
37+
// automatically handle clicks on the Home/Up button, so long
38+
// as you specify a parent activity in AndroidManifest.xml.
39+
int id = item.getItemId();
40+
if (id == R.id.action_settings) {
41+
return true;
42+
}
43+
return super.onOptionsItemSelected(item);
44+
}
45+
46+
/**
47+
* A placeholder fragment containing a simple view.
48+
*/
49+
public static class PlaceholderFragment extends Fragment {
50+
51+
public PlaceholderFragment() {
52+
}
53+
54+
@Override
55+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
56+
Bundle savedInstanceState) {
57+
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
58+
return rootView;
59+
}
60+
}
61+
}
4.53 KB
Loading
2.68 KB
Loading
Loading
11.9 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:id="@+id/container"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
tools:context="com.example.android.sunshine.app.MainActivity"
7+
tools:ignore="MergeRootFrame" />
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:paddingLeft="@dimen/activity_horizontal_margin"
6+
android:paddingRight="@dimen/activity_horizontal_margin"
7+
android:paddingTop="@dimen/activity_vertical_margin"
8+
android:paddingBottom="@dimen/activity_vertical_margin"
9+
tools:context="com.example.android.sunshine.app.MainActivity$PlaceholderFragment">
10+
11+
<TextView
12+
android:text="@string/hello_world"
13+
android:layout_width="wrap_content"
14+
android:layout_height="wrap_content" />
15+
16+
</RelativeLayout>

app/src/main/res/menu/main.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context="com.example.android.sunshine.app.MainActivity" >
5+
<item android:id="@+id/action_settings"
6+
android:title="@string/action_settings"
7+
android:orderInCategory="100"
8+
app:showAsAction="never" />
9+
</menu>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
3+
(such as screen margins) for screens with more than 820dp of available width. This
4+
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5+
<dimen name="activity_horizontal_margin">64dp</dimen>
6+
</resources>

app/src/main/res/values/dimens.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
<!-- Default screen margins, per the Android Design guidelines. -->
3+
<dimen name="activity_horizontal_margin">16dp</dimen>
4+
<dimen name="activity_vertical_margin">16dp</dimen>
5+
</resources>

app/src/main/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">Sunshine</string>
5+
<string name="hello_world">Hello world!</string>
6+
<string name="action_settings">Settings</string>
7+
8+
</resources>

app/src/main/res/values/styles.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
</style>
7+
8+
</resources>

build.gradle

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
mavenCentral()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:0.12.+'
9+
}
10+
}
11+
12+
allprojects {
13+
repositories {
14+
mavenCentral()
15+
}
16+
}

gradle.properties

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Project-wide Gradle settings.
2+
3+
# IDE (e.g. Android Studio) users:
4+
# Settings specified in this file will override any Gradle settings
5+
# configured through the IDE.
6+
7+
# For more details on how to configure your build environment visit
8+
# http://www.gradle.org/docs/current/userguide/build_environment.html
9+
10+
# Specifies the JVM arguments used for the daemon process.
11+
# The setting is particularly useful for tweaking memory settings.
12+
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14+
15+
# When configured, Gradle will run in incubating parallel mode.
16+
# This option should only be used with decoupled projects. More details, visit
17+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18+
# org.gradle.parallel=true

gradle/wrapper/gradle-wrapper.jar

48.7 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Jun 27 19:02:47 PDT 2014
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

0 commit comments

Comments
 (0)