0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00

Moved UI strings for deck picker to resources

Moved all the UI strings for the deck picker screen into strings.xml so
that they can be changed easily and to enable future translation.
This commit is contained in:
Daniel Svärd 2009-10-04 18:47:18 +02:00
parent a99b25d2f2
commit 3b291a4c22
3 changed files with 18 additions and 9 deletions

View File

@ -9,7 +9,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="DeckPicker" android:label="Select a deck you copied to your SD card" />
<activity android:name="DeckPicker" android:label="@string/deckpicker_title" />
<activity android:name="Preferences" android:label="Preferences" />
<activity android:name="About" android:label="About" />
</application>

View File

@ -12,4 +12,9 @@
<color name="wb_bg_color">#0000</color>
<string name="card_template">&lt;html&gt; &lt;head&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;file:///android_asset/flashcard_css&quot; /&gt; &lt;/head&gt; &lt;body&gt; &lt;span class=&quot;card&quot;&gt; ::content:: &lt;/span&gt; &lt;/body&gt; &lt;/html&gt;</string>
<string name="deckpicker_title">Select a deck you copied to your SD card</string>
<string name="deckpicker_due">%1$d of %2$d due</string>
<string name="deckpicker_new">%d new today</string>
<string name="deckpicker_loaddeck">Loading deck...</string>
<string name="deckpicker_nodeck">No decks found.</string>
</resources>

View File

@ -11,6 +11,7 @@ import java.util.concurrent.locks.ReentrantLock;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.database.SQLException;
import android.os.Bundle;
import android.os.Handler;
@ -90,6 +91,7 @@ public class DeckPicker extends Activity implements Runnable {
public void populateDeckList(String location)
{
Resources res = getResources();
int len = 0;
File[] fileList;
TreeSet<HashMap<String,String>> tree = new TreeSet<HashMap<String,String>>(new HashMapCompare());
@ -107,7 +109,7 @@ public class DeckPicker extends Activity implements Runnable {
HashMap<String,String> data = new HashMap<String,String>();
data.put("name", fileList[i].getName().replaceAll(".anki", ""));
data.put("due", "Loading deck...");
data.put("due", res.getString(R.string.deckpicker_loaddeck));
data.put("new", "");
data.put("mod", String.format("%f", Deck.getLastModified(absPath)));
data.put("filepath", absPath);
@ -121,7 +123,7 @@ public class DeckPicker extends Activity implements Runnable {
}
else {
HashMap<String,String> data = new HashMap<String,String>();
data.put("name", "No decks found.");
data.put("name", res.getString(R.string.deckpicker_nodeck));
data.put("new", "");
data.put("due", "");
data.put("mod", "1");
@ -236,14 +238,16 @@ public class DeckPicker extends Activity implements Runnable {
private Handler handler = new Handler() {
public void handleMessage(Message msg) {
Bundle data = msg.getData();
Resources res = mSelf.getResources();
String path = data.getString("absPath");
String dueString = String.valueOf(data.getInt("due")) +
" of " +
String.valueOf(data.getInt("total")) +
" due";
String newString = String.valueOf(data.getInt("new")) +
" new today";
String dueString = String.format(
res.getString(R.string.deckpicker_due),
data.getInt("due"),
data.getInt("total"));
String newString = String.format(
res.getString(R.string.deckpicker_new),
data.getInt("new"));
int count = mDeckListAdapter.getCount();
for (int i = 0; i < count; i++) {