mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 20:03:05 +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:
parent
a99b25d2f2
commit
3b291a4c22
@ -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>
|
||||
|
@ -12,4 +12,9 @@
|
||||
<color name="wb_bg_color">#0000</color>
|
||||
<string name="card_template"><html> <head> <link rel="stylesheet" type="text/css" href="file:///android_asset/flashcard_css" /> </head> <body> <span class="card"> ::content:: </span> </body> </html></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>
|
||||
|
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user