Skip to content

Added localization (now English and Italian) and a new tab where is #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release_1.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Timer/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="lib" path="libs/android-support-v13.jar" sourcepath="C:/Users/dan/android-sdks/extras/android/support/v4/src"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/ActionBarSherlock"/>
<classpathentry combineaccessrules="false" kind="src" path="/actionbarsherlock"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
8 changes: 3 additions & 5 deletions Timer/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dpadgett.timer"
android:versionCode="7"
android:versionName="1.3" >
android:versionCode="8"
android:versionName="1.4" >

<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="15" />
android:targetSdkVersion="19" />

<application
android:debuggable="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
Expand All @@ -22,7 +21,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service android:name=".AlarmService" />
<activity
android:name=".StopwatchAutostartActivity"
Expand Down
2 changes: 1 addition & 1 deletion Timer/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

# Project target.
target=android-16
android.library.reference.1=../../../Downloads/JakeWharton-ActionBarSherlock-df676ad/library
android.library.reference.1=../../../workspace/actionbarsherlock
Binary file added Timer/res/drawable/icon_big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions Timer/res/layout/about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
android:id="@+id/textVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/icon_big" />

</RelativeLayout>
4 changes: 2 additions & 2 deletions Timer/res/layout/countdown_simplified.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="On finish:"
android:text="@string/countdown_onfinish"
android:textAppearance="?android:attr/textAppearanceMedium" />

<Spinner
Expand All @@ -94,7 +94,7 @@
android:id="@+id/startButton"
android:layout_width="120sp"
android:layout_height="wrap_content"
android:text="Start" />
android:text="@string/countdown_start" />

</LinearLayout>
</LinearLayout>
4 changes: 2 additions & 2 deletions Timer/res/layout/stopwatch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start" />
android:text="@string/stopwatch_start" />

<org.dpadgett.compat.Space
android:layout_width="20sp"
Expand All @@ -77,7 +77,7 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Reset" />
android:text="@string/stopwatch_reset" />

<org.dpadgett.compat.Space
android:layout_width="20sp"
Expand Down
2 changes: 1 addition & 1 deletion Timer/res/layout/world_clock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="+ Add" />
android:text="@string/wordclock_plusadd" />
</LinearLayout>

</org.dpadgett.compat.LinearLayout>
42 changes: 42 additions & 0 deletions Timer/res/values-it/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

<string name="hello">Sup World, TimerActivity!</string>
<string name="app_name">Timer</string>

<!-- NumberPicker - accessibility support -->
<!-- Description of the button to increment the NumberPicker value. [CHAR LIMIT=NONE] -->
<string name="number_picker_increment_button">Incrementa</string>
<!-- Description of the button to decrement the NumberPicker value. [CHAR LIMIT=NONE] -->
<string name="number_picker_decrement_button">Decrementa</string>
<!-- Description of the tap and hold action to get into scroll mode in NumberPicker. [CHAR LIMIT=NONE] -->
<string name="number_picker_increment_scroll_mode"><xliff:g id="value" example="3">%s</xliff:g> clicca e tieni.</string>
<!-- Description of the scrolling action in NumberPicker. [CHAR LIMIT=NONE] -->
<string name="number_picker_increment_scroll_action">Slide su per incrementare e giù per decrementare.</string>

<string name="title_activity_stopwatch_autostart">StopwatchAutostartActivity</string>

<string name="gen_version">Versione</string>
<string name="gen_dismiss">Chiudi</string>

<string name="tab_worldclock">Orologio Mondiale</string>
<string name="tab_stopwatch">Cronometro</string>
<string name="tab_countdown">Timer</string>
<string name="tab_about">About</string>

<string name="wordclock_plusadd">+ Aggiungi</string>
<string name="wordclock_selecttimezone">Seleziona una timezone</string>
<string name="wordclock_remove">Rimuovi</string>

<string name="stopwatch_start">Avvia</string>
<string name="stopwatch_stop">Ferma</string>
<string name="stopwatch_reset">Azzera</string>
<string name="stopwatch_lap">Giro</string>

<string name="countdown_start">Avvia</string>
<string name="countdown_cancel">Annulla</string>
<string name="countdown_onfinish">Alla fine:</string>
<string name="countdown_finished">Conteggio timer completato</string>
<string name="countdown_taptodismiss">Premi qui per terminare</string>

</resources>
23 changes: 23 additions & 0 deletions Timer/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,27 @@

<string name="title_activity_stopwatch_autostart">StopwatchAutostartActivity</string>

<string name="gen_version">Version</string>
<string name="gen_dismiss">Dismiss</string>

<string name="tab_worldclock">World Clock</string>
<string name="tab_stopwatch">Stopwatch</string>
<string name="tab_countdown">Countdown</string>
<string name="tab_about">About</string>

<string name="wordclock_plusadd">+ Add</string>
<string name="wordclock_selecttimezone">Select a timezone</string>
<string name="wordclock_remove">Remove</string>

<string name="stopwatch_start">Start</string>
<string name="stopwatch_stop">Stop</string>
<string name="stopwatch_reset">Reset</string>
<string name="stopwatch_lap">Lap</string>

<string name="countdown_start">Start</string>
<string name="countdown_cancel">Cancel</string>
<string name="countdown_onfinish">On finish:</string>
<string name="countdown_finished">Countdown timer finished</string>
<string name="countdown_taptodismiss">Tap here to dismiss</string>

</resources>
40 changes: 40 additions & 0 deletions Timer/src/org/dpadgett/timer/AboutFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.dpadgett.timer;

import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class AboutFragment extends Fragment {

private View rootView;

/* (non-Javadoc)
* @see android.support.v4.app.Fragment#onCreate(android.os.Bundle)
*/
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
rootView = inflater.inflate(R.layout.about, container, false);
ResourceFinder finder = ResourceFinders.from(rootView);
TextView tv = (TextView)finder.findViewById(R.id.textVersion);
String version = getActivity().getResources().getString(R.string.gen_version)+" ";
try {
version += getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName;
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tv.setText(version);
return rootView;
}
}
6 changes: 3 additions & 3 deletions Timer/src/org/dpadgett/timer/AlarmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ private void countdownFinished() {
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
int icon = drawable.ic_dialog_info;
String tickerText = "Countdown timer finished";
String tickerText = context.getResources().getString(R.string.countdown_finished);
long when = System.currentTimeMillis();

Notification notification = new Notification(icon, tickerText, when);
notification.flags |= Notification.FLAG_AUTO_CANCEL | Notification.FLAG_ONGOING_EVENT;

String contentTitle = "Countdown timer finished";
String contentText = "Tap here to dismiss";
String contentTitle = context.getResources().getString(R.string.countdown_finished);
String contentText = context.getResources().getString(R.string.countdown_taptodismiss);
Intent notificationIntent = new Intent(context, AlarmService.class)
.putExtra("startAlarm", false).putExtra("fromFragment", false)
.setAction("internalStopAlarm");
Expand Down
6 changes: 3 additions & 3 deletions Timer/src/org/dpadgett/timer/CountdownFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void restoreState() {
Button startButton = (Button) rootView.findViewById(R.id.startButton);
inputs.removeAllViews();
inputs.addView(timerLayout);
startButton.setText("Cancel");
startButton.setText(getContext().getResources().getString(R.string.countdown_cancel));
// timing thread will auto start itself
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public void run() {

inputs.removeAllViews();
inputs.addView(timerLayout);
startButton.setText("Cancel");
startButton.setText(getContext().getResources().getString(R.string.countdown_cancel));

AlarmManager alarmMgr = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
// should be unique
Expand Down Expand Up @@ -295,7 +295,7 @@ public void run() {
handler.removeCallbacks(inputModeOn);
inputs.removeAllViews();
inputs.addView(inputLayout);
startButton.setText("Start");
startButton.setText(getContext().getResources().getString(R.string.countdown_start));
timingState.stopTimer();
if (alarmPendingIntent == null) {
// should be unique
Expand Down
2 changes: 1 addition & 1 deletion Timer/src/org/dpadgett/timer/LapTimes.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void add(long lapTime) {
.inflate(R.layout.single_lap_time, (ViewGroup) lapTimesView, false);

TextView lapLabel = (TextView) lapLayout.findViewById(R.id.lapLabel);
lapLabel.setText("lap " + (lapTimes.size() + 1));
lapLabel.setText(context.getResources().getString(R.string.stopwatch_lap)+" "+(lapTimes.size() + 1));

TextView lapTimeView = (TextView) lapLayout.findViewById(R.id.lapTime);
lapTimeView.setText(getTimerText(lapTime));
Expand Down
16 changes: 7 additions & 9 deletions Timer/src/org/dpadgett/timer/StopwatchFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
import org.dpadgett.compat.LinearLayout;
import org.dpadgett.timer.TimerActivity.StartReason;
import org.dpadgett.widget.TimerTextView;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
Expand Down Expand Up @@ -73,17 +71,17 @@ public void start() {
lapTimeText.resume();
timerText.forceUpdate(timeStarted);
lapTimeText.forceUpdate(timeStarted);
startButton.setText("Stop");
resetButton.setText("Lap");
startButton.setText(getResources().getString(R.string.stopwatch_stop));
resetButton.setText(getResources().getString(R.string.stopwatch_lap));
saveState();
}

public void stop() {
Button startButton = (Button) rootView.findViewById(R.id.startButton);
Button resetButton = (Button) rootView.findViewById(R.id.stopButton);
long timeStopped = System.currentTimeMillis();
startButton.setText("Start");
resetButton.setText("Reset");
startButton.setText(getResources().getString(R.string.stopwatch_start));
resetButton.setText(getResources().getString(R.string.stopwatch_reset));
additionalElapsed += timeStopped - timeStarted;
timerText.pause(timeStopped);
lapTimeText.pause(timeStopped);
Expand Down Expand Up @@ -142,7 +140,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,

timerText = (TimerTextView) rootView.findViewById(R.id.timerText);
lapTimeText = (TimerTextView) rootView.findViewById(R.id.liveLapTime);
lapTimeText.setTextPrefix("lap: ");
lapTimeText.setTextPrefix(getResources().getString(R.string.stopwatch_lap)+": ");

lapTimes = new LapTimes((ScrollView) rootView.findViewById(R.id.scrollView1));

Expand Down Expand Up @@ -219,8 +217,8 @@ private void restoreState() {
if (isTimerRunning) {
timerText.resume();
lapTimeText.resume();
startButton.setText("Stop");
resetButton.setText("Lap");
startButton.setText(getResources().getString(R.string.stopwatch_stop));
resetButton.setText(getResources().getString(R.string.stopwatch_lap));
}
timerText.forceUpdate(timeStarted);
lapTimeText.forceUpdate(timeStarted);
Expand Down
Loading