Skip to content

Commit

Permalink
Initial commit (version 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewhannay committed Apr 2, 2013
1 parent c345134 commit 3c35cce
Show file tree
Hide file tree
Showing 22 changed files with 494 additions and 0 deletions.
37 changes: 37 additions & 0 deletions AndroidManifest.xml
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drewhannay.xkcdtime"
android:versionCode="1"
android:versionName="1.0" >

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.drewhannay.xkcdtime.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>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

<receiver
android:name="com.drewhannay.xkcdtime.RepeatingAlarm"
android:process=":remote" />
</application>

</manifest>
Binary file added ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libs/GoogleAdMobAdsSdk-6.3.1.jar
Binary file not shown.
Binary file added libs/android-support-v4.jar
Binary file not shown.
20 changes: 20 additions & 0 deletions proguard-project.txt
@@ -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 changes: 14 additions & 0 deletions project.properties
@@ -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-17
Binary file added res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions res/layout/activity_main.xml
@@ -0,0 +1,91 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color"
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"
tools:ignore="Overdraw" >

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:text="@string/time"
android:textAppearance="?android:attr/textAppearanceLarge" />

<ProgressBar
android:id="@+id/progress_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="gone" />

<ImageView
android:id="@+id/time_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/time_png"
android:scaleType="fitCenter" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:text="@string/wait_for_it"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="italic" />

<CheckBox
android:id="@+id/notify_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:text="@string/notify_me" />

<TextView
android:id="@+id/xkcd_site_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColorLink="@android:color/black"
tools:ignore="SelectableText" />

<TextView
android:id="@+id/forum_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColorLink="@android:color/black"
tools:ignore="SelectableText" />

<TextView
android:id="@+id/aubronwood_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColorLink="@android:color/black"
tools:ignore="SelectableText" />
</LinearLayout>
</ScrollView>

</RelativeLayout>
8 changes: 8 additions & 0 deletions res/values-sw600dp/dimens.xml
@@ -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 changes: 9 additions & 0 deletions res/values-sw720dp-land/dimens.xml
@@ -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 changes: 11 additions & 0 deletions res/values-v11/styles.xml
@@ -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 changes: 12 additions & 0 deletions res/values-v14/styles.xml
@@ -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>
4 changes: 4 additions & 0 deletions res/values/colors.xml
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="background_color">#96A8C8</color>
</resources>
7 changes: 7 additions & 0 deletions res/values/dimens.xml
@@ -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>
15 changes: 15 additions & 0 deletions res/values/strings.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">XKCD: Time #1190</string>
<string name="time">Time</string>
<string name="wait_for_it">Wait for it.</string>
<string name="time_png">Time.png</string>
<string name="notify_me">Notify me every half hour as Time passes</string>
<string name="notif_title">New Time frame available!</string>
<string name="notif_content">View the new image</string>
<string name="xkcd_site"><![CDATA[<a href="http://xkcd.com">XKCD.com</a>]]></string>
<string name="xkcd_forum_thread"><![CDATA[<a href="http://forums.xkcd.com/viewtopic.php?f=7&t=101043">XKCD Forum Thread</a>]]></string>
<string name="aubron_wood_interactive_gif"><![CDATA[<a href="http://xkcd.aubronwood.com/">Aubron Wood Interactive GIF</a>]]></string>

</resources>
20 changes: 20 additions & 0 deletions res/values/styles.xml
@@ -0,0 +1,20 @@
<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>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>
31 changes: 31 additions & 0 deletions src/com/drewhannay/xkcdtime/BitmapUtility.java
@@ -0,0 +1,31 @@
package com.drewhannay.xkcdtime;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class BitmapUtility
{
public static Bitmap getBitmapFromURL(String src)
{
try
{
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
}
catch (IOException e)
{
e.printStackTrace();
return null;
}
}
}

0 comments on commit 3c35cce

Please sign in to comment.