Permalink
Browse files

Added ads and relaesed the app to android market

  • Loading branch information...
1 parent eb9baa0 commit e6e4190b6c2eadae0050cfe176dc907b87e478d6 @ignacy committed Apr 10, 2011
View
@@ -0,0 +1 @@
+*.keystore
View
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pl.imlog.pomidor"
- android:versionCode="1"
- android:versionName="1.0">
+ android:versionCode="2"
+ android:versionName="1.1">
+ <uses-sdk android:minSdkVersion="2"
+ android:targetSdkVersion="8"
+ android:maxSdkVersion="8" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="Pomidor"
android:label="@string/app_name">
@@ -11,5 +16,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name="com.google.ads.AdActivity"
+ android:configChanges="keyboard|keyboardHidden|orientation"/>
</application>
</manifest>
View
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.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
@@ -12,6 +12,7 @@
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
+key.store=pomidor-key.keystore
# 'key.alias' for the name of the key to use.
+key.alias=pomidor
# The password will be asked during the build when you use the 'release' target.
-
@@ -9,26 +9,102 @@
public final class R {
public static final class attr {
+ /** <p>Must be one of the following constant values.</p>
+<table>
+<colgroup align="left" />
+<colgroup align="left" />
+<colgroup align="left" />
+<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
+<tr><td><code>BANNER</code></td><td>1</td><td></td></tr>
+<tr><td><code>IAB_MRECT</code></td><td>2</td><td></td></tr>
+<tr><td><code>IAB_BANNER</code></td><td>3</td><td></td></tr>
+<tr><td><code>IAB_LEADERBOARD</code></td><td>4</td><td></td></tr>
+</table>
+ */
+ public static final int adSize=0x7f010000;
+ /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int adUnitId=0x7f010001;
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
- public static final int count_label=0x7f050003;
- public static final int pomodoros_count=0x7f050004;
- public static final int start_button=0x7f050001;
- public static final int stop_button=0x7f050002;
- public static final int timer_label=0x7f050000;
+ public static final int BANNER=0x7f040000;
+ public static final int IAB_BANNER=0x7f040002;
+ public static final int IAB_LEADERBOARD=0x7f040003;
+ public static final int IAB_MRECT=0x7f040001;
+ public static final int adView=0x7f040004;
+ public static final int count_label=0x7f040008;
+ public static final int pomodoros_count=0x7f040009;
+ public static final int start_button=0x7f040006;
+ public static final int stop_button=0x7f040007;
+ public static final int timer_label=0x7f040005;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
- public static final int app_name=0x7f040000;
- public static final int clock=0x7f040003;
- public static final int count=0x7f040005;
- public static final int count_label=0x7f040004;
- public static final int start=0x7f040001;
- public static final int stop=0x7f040002;
+ public static final int app_name=0x7f050000;
+ public static final int clock=0x7f050003;
+ public static final int count=0x7f050005;
+ public static final int count_label=0x7f050004;
+ public static final int start=0x7f050001;
+ public static final int stop=0x7f050002;
}
+ public static final class styleable {
+ /** Attributes that can be used with a com_google_ads_AdView.
+ <p>Includes the following attributes:</p>
+ <table>
+ <colgroup align="left" />
+ <colgroup align="left" />
+ <tr><th>Attribute</th><th>Description</th></tr>
+ <tr><td><code>{@link #com_google_ads_AdView_adSize pl.imlog.pomidor:adSize}</code></td><td></td></tr>
+ <tr><td><code>{@link #com_google_ads_AdView_adUnitId pl.imlog.pomidor:adUnitId}</code></td><td></td></tr>
+ </table>
+ @see #com_google_ads_AdView_adSize
+ @see #com_google_ads_AdView_adUnitId
+ */
+ public static final int[] com_google_ads_AdView = {
+ 0x7f010000, 0x7f010001
+ };
+ /**
+ <p>This symbol is the offset where the {@link pl.imlog.pomidor.R.attr#adSize}
+ attribute's value can be found in the {@link #com_google_ads_AdView} array.
+
+
+ <p>Must be one of the following constant values.</p>
+<table>
+<colgroup align="left" />
+<colgroup align="left" />
+<colgroup align="left" />
+<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
+<tr><td><code>BANNER</code></td><td>1</td><td></td></tr>
+<tr><td><code>IAB_MRECT</code></td><td>2</td><td></td></tr>
+<tr><td><code>IAB_BANNER</code></td><td>3</td><td></td></tr>
+<tr><td><code>IAB_LEADERBOARD</code></td><td>4</td><td></td></tr>
+</table>
+ @attr name android:adSize
+ */
+ public static final int com_google_ads_AdView_adSize = 0;
+ /**
+ <p>This symbol is the offset where the {@link pl.imlog.pomidor.R.attr#adUnitId}
+ attribute's value can be found in the {@link #com_google_ads_AdView} array.
+
+
+ <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:adUnitId
+ */
+ public static final int com_google_ads_AdView_adUnitId = 1;
+ };
}
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:ads="http://schemas.android.com/apk/res/pl.imlog.pomidor"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
- android:padding="30dip"
- >
+ android:padding="30dip">
+ <com.google.ads.AdView android:id="@+id/adView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ ads:adUnitId="a14da1ef08a8635"
+ ads:adSize="BANNER"/>
<TextView
android:id="@+id/timer_label"
android:text="@string/clock"
View
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <declare-styleable name="com.google.ads.AdView">
+ <attr name="adSize">
+ <enum name="BANNER" value="1" />
+ <enum name="IAB_MRECT" value="2" />
+ <enum name="IAB_BANNER" value="3" />
+ <enum name="IAB_LEADERBOARD" value="4" />
+ </attr>
+ <attr name="adUnitId" format="string" />
+ </declare-styleable>
+</resources>
@@ -3,7 +3,7 @@
<string name="app_name">Pomidor</string>
<string name="start">Start</string>
<string name="stop">Stop</string>
- <string name="clock">25:00</string>
+ <string name="clock">""</string>
<string name="count_label">Pomodoros finished:</string>
<string name="count">0</string>
</resources>
@@ -13,44 +13,61 @@
import android.preference.PreferenceManager;
import android.util.Log;
+
+import com.google.ads.AdRequest;
+import com.google.ads.AdSize;
+import com.google.ads.AdView;
+
+import android.widget.LinearLayout;
+
public class Pomidor extends Activity implements OnClickListener
{
- private static int donePomodoros = 0;
- private static final int INTERVAL = 62;
+ private static int donePomodoros;
+ private static final int INTERVAL = 1500;
private Handler handler;
private TextView textView;
private TextView pomodoros;
private int mStartTime;
+ private AdView adView;
+
@Override
public void onCreate(Bundle savedInstanceState)
{
+
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
+ adView = (AdView) findViewById(R.id.adView);
+ AdRequest adRequest = new AdRequest();
+ adView.loadAd(adRequest);
+
+ donePomodoros = getDonePomodorosCount();
+
try {
handler = new Handler();
- //mStartTime = 1500;
mStartTime = INTERVAL;
View startButton = findViewById(R.id.start_button);
startButton.setOnClickListener(this);
View stopButton = findViewById(R.id.stop_button);
stopButton.setOnClickListener(this);
+
textView = (TextView) findViewById(R.id.timer_label);
+ textView.setText(getTimeString(INTERVAL));
+
pomodoros = (TextView) findViewById(R.id.pomodoros_count);
+ pomodoros.setText(Integer.toString(getDonePomodorosCount()));
} catch (Exception ex) {
Log.e("onCreate", ex.getMessage());
}
-
}
public void onClick(View v) {
-
try {
switch (v.getId()) {
case R.id.start_button:
@@ -68,30 +85,34 @@ public void onClick(View v) {
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
mStartTime--;
- int minutes = mStartTime / 60;
- int seconds = mStartTime % 60;
-
- String separator = (seconds < 10) ? ": 0" : ":";
-
- textView.setText(minutes + separator + seconds);
+ textView.setText(getTimeString(mStartTime));
if (mStartTime >= 1) {
handler.postDelayed(mUpdateTimeTask, 1000);
} else {
- textView.setText(Integer.toString(INTERVAL));
+ textView.setText(getTimeString(INTERVAL));
donePomodoros++;
-
// Save the current value
getPreferences(MODE_PRIVATE).edit().putInt("pomodorod_done", donePomodoros).commit();
- mStartTime = INTERVAL;
+ mStartTime = INTERVAL; //reset timer
pomodoros.setText(Integer.toString(getDonePomodorosCount()));
}
}
};
public int getDonePomodorosCount() {
- int curr = PreferenceManager.getDefaultSharedPreferences(this)
+ return PreferenceManager.getDefaultSharedPreferences(this)
.getInt("pomodorosDone", donePomodoros);
- Log.i("ccc", "Current count is : " + curr);
- return curr;
+ }
+
+ private String getTimeString(int time) {
+ int minutes = time / 60;
+ int seconds = time % 60;
+ final String separator = (seconds < 10) ? ":0" : ":";
+ return minutes + separator + seconds;
+ }
+
+ public void onDestroy() {
+ adView.stopLoading();
+ super.onDestroy();
}
}

0 comments on commit e6e4190

Please sign in to comment.