mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 20:03:05 +02:00
Fixed all the crashes caused by starting the app without any selected deck and with the option 'Sample deck' deselected. It also has been implemented the DeckPicker's title change when sd card is unmounted and the correct display in both orientations of the message informing the user about the sd card being unavailable.
This commit is contained in:
parent
6272c63c0d
commit
fddf1f8683
@ -14,6 +14,7 @@
|
||||
<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_title_nosdcard">SD card is unmounted</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>
|
||||
|
@ -520,6 +520,13 @@ public class Ankidroid extends Activity implements Runnable
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
LinearLayout sdLayout = (LinearLayout) findViewById(R.id.sd_layout);
|
||||
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
sdLayout.setPadding(0, 50, 0, 0);
|
||||
else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
|
||||
sdLayout.setPadding(0, 100, 0, 0);
|
||||
|
||||
//extra height that the Whiteboard should have to be able to write in all its surface either on the question or on the answer
|
||||
int extraHeight = 0;
|
||||
if(mSelectRemembered.isShown() && mSelectNotRemembered.isShown())
|
||||
@ -644,6 +651,7 @@ public class Ankidroid extends Activity implements Runnable
|
||||
|
||||
public void updateCard(String content)
|
||||
{
|
||||
Log.i(TAG, "updateCard");
|
||||
String card = cardTemplate.replace("::content::", content);
|
||||
mCard.loadDataWithBaseURL("", card, "text/html", "utf-8", null);
|
||||
}
|
||||
@ -715,14 +723,14 @@ public class Ankidroid extends Activity implements Runnable
|
||||
{
|
||||
Log.i(TAG, "Ankidroid loader thread - run");
|
||||
loadDeck(deckFilename);
|
||||
//if(deckSelected)
|
||||
//{
|
||||
if(deckSelected)
|
||||
{
|
||||
handler.sendEmptyMessage(0);
|
||||
//} else
|
||||
//{
|
||||
} else
|
||||
{
|
||||
//Dismiss dialog and show something to indicate to the user that a deck has not been loaded
|
||||
//dialog.dismiss();
|
||||
//}
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private Handler handler = new Handler()
|
||||
|
@ -176,6 +176,7 @@ public class DeckPicker extends Activity implements Runnable
|
||||
if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()))
|
||||
{
|
||||
Log.i(TAG, "populateDeckList - No sd card.");
|
||||
setTitle(R.string.deckpicker_title_nosdcard);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage("The SD card could not be read. Please, turn off USB storage.");
|
||||
@ -389,6 +390,7 @@ public class DeckPicker extends Activity implements Runnable
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
|
||||
String deckPath = preferences.getString("deckPath", "/sdcard");
|
||||
mDeckIsSelected = false;
|
||||
setTitle(R.string.deckpicker_title);
|
||||
populateDeckList(deckPath);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user