mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 20:03:05 +02:00
More improvements to study options and tablet layout
This commit is contained in:
parent
15a3538a4f
commit
304afd1a69
@ -371,8 +371,12 @@ public class AnkiActivity extends AppCompatActivity implements LoaderManager.Loa
|
||||
* @param listener listener for the action (if null no action shown)
|
||||
* @oaram root View Snackbar will attach to. Should be CoordinatorLayout for swipe-to-dismiss to work.
|
||||
*/
|
||||
protected void showSnackbar(int mainTextResource, boolean shortLength,
|
||||
int actionTextResource, View.OnClickListener listener, View root) {
|
||||
protected void showSnackbar(int mainTextResource, boolean shortLength, int actionTextResource,
|
||||
View.OnClickListener listener, View root) {
|
||||
showSnackbar(mainTextResource,shortLength,actionTextResource,listener,root);
|
||||
}
|
||||
protected void showSnackbar(int mainTextResource, boolean shortLength, int actionTextResource,
|
||||
View.OnClickListener listener, View root, Snackbar.Callback callback) {
|
||||
if (root == null) {
|
||||
root = findViewById(android.R.id.content);
|
||||
if (root == null) {
|
||||
@ -385,6 +389,9 @@ public class AnkiActivity extends AppCompatActivity implements LoaderManager.Loa
|
||||
if (listener != null) {
|
||||
sb.setAction(actionTextResource, listener);
|
||||
}
|
||||
if (callback != null) {
|
||||
sb.setCallback(callback);
|
||||
}
|
||||
// Make the text white to avoid interference from our theme colors.
|
||||
View view = sb.getView();
|
||||
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
|
||||
|
@ -38,6 +38,7 @@ import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -467,6 +468,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
getMenuInflater().inflate(R.menu.deck_picker, menu);
|
||||
boolean sdCardAvailable = AnkiDroidApp.isSdCardMounted();
|
||||
menu.findItem(R.id.action_sync).setEnabled(sdCardAvailable);
|
||||
menu.findItem(R.id.action_unbury).setEnabled(sdCardAvailable);
|
||||
menu.findItem(R.id.action_new_filtered_deck).setEnabled(sdCardAvailable);
|
||||
menu.findItem(R.id.action_check_database).setEnabled(sdCardAvailable);
|
||||
menu.findItem(R.id.action_check_media).setEnabled(sdCardAvailable);
|
||||
@ -625,7 +627,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
});
|
||||
}
|
||||
}, findViewById(R.id.root_layout));
|
||||
}, findViewById(R.id.root_layout), mSnackbarShowHideCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1668,7 +1670,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
CustomStudyDialog d = CustomStudyDialog.newInstance(CustomStudyDialog.CONTEXT_MENU_LIMITS, true);
|
||||
showDialogFragment(d);
|
||||
}
|
||||
}, findViewById(R.id.root_layout));
|
||||
}, findViewById(R.id.root_layout), mSnackbarShowHideCallback);
|
||||
} else if (deckDueTreeNode.children.size() == 0 && getCol().cardCount(new long[]{did}) == 0) {
|
||||
// If the deck is empty and has no children then show a message saying it's empty
|
||||
showSnackbar(R.string.empty_deck, false, R.string.help, new OnClickListener() {
|
||||
@ -1678,7 +1680,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
.getString(R.string.link_manual_getting_started)));
|
||||
startActivityWithoutAnimation(helpIntent);
|
||||
}
|
||||
}, findViewById(R.id.root_layout));
|
||||
}, findViewById(R.id.root_layout), mSnackbarShowHideCallback);
|
||||
} else {
|
||||
// Otherwise say there are no cards scheduled to study, and give option to do custom study
|
||||
showSnackbar(R.string.studyoptions_empty_schedule, false, R.string.custom_study, new OnClickListener() {
|
||||
@ -1688,7 +1690,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
CustomStudyDialog.CONTEXT_MENU_EMPTY_SCHEDULE, true);
|
||||
showDialogFragment(d);
|
||||
}
|
||||
}, findViewById(R.id.root_layout));
|
||||
}, findViewById(R.id.root_layout), mSnackbarShowHideCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1739,7 +1741,9 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
if (eta != -1) {
|
||||
time = res.getString(R.string.time_quantity_minutes, eta);
|
||||
}
|
||||
getSupportActionBar().setSubtitle(res.getQuantityString(R.plurals.deckpicker_title, due, due, time));
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setSubtitle(res.getQuantityString(R.plurals.deckpicker_title, due, due, time));
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Timber.e(e, "RuntimeException setting time remaining");
|
||||
@ -1969,4 +1973,25 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
updateDeckList();
|
||||
}
|
||||
|
||||
/**
|
||||
* FAB can't be animated to move out of the way of the snackbar button on API < 11
|
||||
*/
|
||||
Snackbar.Callback mSnackbarShowHideCallback = new Snackbar.Callback() {
|
||||
@Override
|
||||
public void onDismissed(Snackbar snackbar, int event) {
|
||||
if (!CompatHelper.isHoneycomb()) {
|
||||
final FloatingActionsMenu actionsMenu = (FloatingActionsMenu) findViewById(R.id.add_content_menu);
|
||||
actionsMenu.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShown(Snackbar snackbar) {
|
||||
if (!CompatHelper.isHoneycomb()) {
|
||||
final FloatingActionsMenu actionsMenu = (FloatingActionsMenu) findViewById(R.id.add_content_menu);
|
||||
actionsMenu.setEnabled(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -163,7 +163,9 @@ public class NavigationDrawerActivity extends AnkiActivity implements Drawer.OnD
|
||||
@Override
|
||||
public void setTitle(CharSequence title) {
|
||||
mTitle = title;
|
||||
getSupportActionBar().setTitle(mTitle);
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setTitle(mTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,18 +52,6 @@ public class StudyOptionsActivity extends NavigationDrawerActivity implements St
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu){
|
||||
// Make the add button visible when not fragmented layout
|
||||
MenuItem addFromStudyOptions = menu.findItem(R.id.action_add_note_from_study_options);
|
||||
if (addFromStudyOptions != null) {
|
||||
addFromStudyOptions.setVisible(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void loadStudyOptionsFragment() {
|
||||
boolean withDeckOptions = false;
|
||||
if (getIntent().getExtras() != null) {
|
||||
|
@ -20,30 +20,21 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.ichi2.anim.ActivityTransitionAnimation;
|
||||
import com.ichi2.anim.ViewAnimation;
|
||||
import com.ichi2.anki.dialogs.CustomStudyDialog;
|
||||
import com.ichi2.anki.stats.AnkiStatsTaskHandler;
|
||||
import com.ichi2.anki.stats.ChartView;
|
||||
import com.ichi2.async.CollectionLoader;
|
||||
import com.ichi2.async.DeckTask;
|
||||
import com.ichi2.libanki.Collection;
|
||||
import com.ichi2.libanki.Utils;
|
||||
@ -52,19 +43,14 @@ import com.ichi2.themes.StyledProgressDialog;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
public class StudyOptionsFragment extends Fragment implements LoaderManager.LoaderCallbacks<Collection> {
|
||||
public class StudyOptionsFragment extends Fragment implements Toolbar.OnMenuItemClickListener {
|
||||
|
||||
|
||||
/**
|
||||
* Available options performed by other activities
|
||||
*/
|
||||
public static final int PREFERENCES_UPDATE = 0;
|
||||
private static final int ADD_NOTE = 2;
|
||||
private static final int BROWSE_CARDS = 3;
|
||||
private static final int STATISTICS = 4;
|
||||
private static final int DECK_OPTIONS = 5;
|
||||
@ -83,7 +69,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
* Preferences
|
||||
*/
|
||||
private int mCurrentContentView = CONTENT_STUDY_OPTIONS;
|
||||
boolean mInvertedColors = false;
|
||||
|
||||
/** Alerts to inform the user about different situations */
|
||||
private MaterialDialog mProgressDialog;
|
||||
@ -94,8 +79,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
private View mStudyOptionsView;
|
||||
private View mDeckInfoLayout;
|
||||
private Button mButtonStart;
|
||||
private Button mButtonCustomStudy;
|
||||
private Button mButtonUnbury;
|
||||
private TextView mTextDeckName;
|
||||
private TextView mTextDeckDescription;
|
||||
private TextView mTextTodayNew;
|
||||
@ -104,17 +87,13 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
private TextView mTextNewTotal;
|
||||
private TextView mTextTotal;
|
||||
private TextView mTextETA;
|
||||
private Button mDeckOptions;
|
||||
private Button mCramOptions;
|
||||
private TextView mTextCongratsMessage;
|
||||
private View mCongratsLayout;
|
||||
private ChartView mChartView;
|
||||
private Toolbar mToolbar;
|
||||
|
||||
// Flag to indicate if the fragment should load the deck options immediately after it loads
|
||||
private boolean mLoadWithDeckOptions;
|
||||
|
||||
private boolean mFragmented;
|
||||
private Collection mCollection;
|
||||
|
||||
private Thread mFullNewCountThread = null;
|
||||
|
||||
@ -142,46 +121,15 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
private View.OnClickListener mButtonClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Collection col = getCol();
|
||||
// long timeLimit = 0;
|
||||
switch (v.getId()) {
|
||||
case R.id.studyoptions_start:
|
||||
Timber.i("StudyOptionsFragment:: start study button pressed");
|
||||
openReviewer();
|
||||
return;
|
||||
case R.id.studyoptions_custom:
|
||||
Timber.i("StudyOptionsFragment:: custom study button pressed");
|
||||
showCustomStudyContextMenu();
|
||||
return;
|
||||
case R.id.studyoptions_unbury:
|
||||
case R.id.studyoptions_unbury_cram:
|
||||
Timber.i("StudyOptionsFragment:: unbury button pressed");
|
||||
col.getSched().unburyCardsForDeck();
|
||||
refreshInterfaceAndDecklist(true);
|
||||
return;
|
||||
case R.id.studyoptions_options_cram:
|
||||
Timber.i("StudyOptionsFragment:: cram deck options button pressed");
|
||||
openFilteredDeckOptions();
|
||||
return;
|
||||
case R.id.studyoptions_options:
|
||||
Timber.i("StudyOptionsFragment:: deck options button pressed");
|
||||
Intent i = new Intent(getActivity(), DeckOptions.class);
|
||||
startActivityForResult(i, DECK_OPTIONS);
|
||||
ActivityTransitionAnimation.slide(getActivity(), ActivityTransitionAnimation.FADE);
|
||||
return;
|
||||
case R.id.studyoptions_rebuild_cram:
|
||||
Timber.i("StudyOptionsFragment:: rebuild cram deck button pressed");
|
||||
mProgressDialog = StyledProgressDialog.show(getActivity(), "",
|
||||
getResources().getString(R.string.rebuild_cram_deck), true);
|
||||
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_REBUILD_CRAM, getDeckTaskListener(true),
|
||||
new DeckTask.TaskData(mFragmented));
|
||||
return;
|
||||
case R.id.studyoptions_empty_cram:
|
||||
Timber.i("StudyOptionsFragment:: empty cram deck button pressed");
|
||||
mProgressDialog = StyledProgressDialog.show(getActivity(), "",
|
||||
getResources().getString(R.string.empty_cram_deck), false);
|
||||
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_EMPTY_CRAM, getDeckTaskListener(true),
|
||||
new DeckTask.TaskData(mFragmented));
|
||||
if (mCurrentContentView != CONTENT_CONGRATS) {
|
||||
openReviewer();
|
||||
} else {
|
||||
showCustomStudyContextMenu();
|
||||
}
|
||||
return;
|
||||
default:
|
||||
}
|
||||
@ -230,24 +178,18 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
}
|
||||
restorePreferences();
|
||||
mStudyOptionsView = inflater.inflate(R.layout.studyoptions_fragment, container, false);
|
||||
mToolbar = (Toolbar) mStudyOptionsView.findViewById(R.id.studyOptionsToolbar);
|
||||
if (mToolbar != null) {
|
||||
configureToolbar();
|
||||
}
|
||||
mFragmented = getActivity().getClass() != StudyOptionsActivity.class;
|
||||
NavigationDrawerActivity.setIsWholeCollection(false);
|
||||
startLoadingCollection();
|
||||
showProgressBar();
|
||||
return mStudyOptionsView;
|
||||
}
|
||||
|
||||
// Called when the collection loader has finished
|
||||
// NOTE: Fragment transactions are NOT allowed to be called from here onwards
|
||||
private void onCollectionLoaded(Collection col) {
|
||||
mCollection = col;
|
||||
initAllContentViews();
|
||||
if (getArguments() != null) {
|
||||
mLoadWithDeckOptions = getArguments().getBoolean("withDeckOptions");
|
||||
}
|
||||
refreshInterface(true);
|
||||
setHasOptionsMenu(true);
|
||||
hideProgressBar();
|
||||
return mStudyOptionsView;
|
||||
}
|
||||
|
||||
|
||||
@ -264,10 +206,8 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (colOpen()) {
|
||||
Timber.d("onResume()");
|
||||
refreshInterface(true);
|
||||
}
|
||||
Timber.d("onResume()");
|
||||
refreshInterface(true);
|
||||
}
|
||||
|
||||
|
||||
@ -293,15 +233,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
}
|
||||
|
||||
|
||||
private void addNote() {
|
||||
Preferences.COMING_FROM_ADD = true;
|
||||
Intent intent = new Intent(getActivity(), NoteEditor.class);
|
||||
intent.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_STUDYOPTIONS);
|
||||
startActivityForResult(intent, ADD_NOTE);
|
||||
animateLeft();
|
||||
}
|
||||
|
||||
|
||||
private void animateLeft() {
|
||||
ActivityTransitionAnimation.slide(getActivity(), ActivityTransitionAnimation.LEFT);
|
||||
}
|
||||
@ -314,26 +245,7 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
// make links clickable
|
||||
mTextDeckDescription.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
mButtonStart = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_start);
|
||||
mButtonCustomStudy = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_custom);
|
||||
mDeckOptions = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_options);
|
||||
mCramOptions = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_options_cram);
|
||||
mCongratsLayout = mStudyOptionsView.findViewById(R.id.studyoptions_congrats_layout);
|
||||
mTextCongratsMessage = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_congrats_message);
|
||||
|
||||
if (getCol().getDecks().isDyn(getCol().getDecks().selected())) {
|
||||
Button rebBut = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_rebuild_cram);
|
||||
rebBut.setOnClickListener(mButtonClickListener);
|
||||
Button emptyBut = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_empty_cram);
|
||||
emptyBut.setOnClickListener(mButtonClickListener);
|
||||
// Enable the dynamic deck buttons and disable the normal ones
|
||||
mStudyOptionsView.findViewById(R.id.studyoptions_cram_buttons).setVisibility(View.VISIBLE);
|
||||
mStudyOptionsView.findViewById(R.id.studyoptions_regular_buttons).setVisibility(View.GONE);
|
||||
// Dynamic decks have their own unbury button to keep a reference to
|
||||
mButtonUnbury = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_unbury_cram);
|
||||
} else {
|
||||
mButtonUnbury = (Button) mStudyOptionsView.findViewById(R.id.studyoptions_unbury);
|
||||
}
|
||||
mButtonUnbury.setOnClickListener(mButtonClickListener);
|
||||
// Code common to both fragmented and non-fragmented view
|
||||
mTextTodayNew = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_new);
|
||||
mTextTodayLrn = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_lrn);
|
||||
@ -342,16 +254,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
mTextTotal = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_total);
|
||||
mTextETA = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_eta);
|
||||
mButtonStart.setOnClickListener(mButtonClickListener);
|
||||
mButtonCustomStudy.setOnClickListener(mButtonClickListener);
|
||||
mDeckOptions.setOnClickListener(mButtonClickListener);
|
||||
mCramOptions.setOnClickListener(mButtonClickListener);
|
||||
|
||||
/*mFloatingActionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
addNote();
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
|
||||
@ -371,22 +273,70 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
}
|
||||
|
||||
|
||||
private void updateChart(double[][] serieslist) {
|
||||
if (mChartView != null && mCurrentContentView != CONTENT_EMPTY) {
|
||||
Collection col = CollectionHelper.getInstance().getCol(getActivity());
|
||||
AnkiStatsTaskHandler.createSmallDueChartChart(col, serieslist, mChartView);
|
||||
if (mChartView.getVisibility() == View.INVISIBLE) {
|
||||
mChartView.setVisibility(View.VISIBLE);
|
||||
mChartView.setAnimation(ViewAnimation.fade(ViewAnimation.FADE_IN, 500, 0));
|
||||
}
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_undo:
|
||||
Timber.i("StudyOptionsFragment:: Undo button pressed");
|
||||
getCol().undo();
|
||||
refreshInterfaceAndDecklist(true);
|
||||
configureToolbar();
|
||||
return true;
|
||||
case R.id.action_deck_options:
|
||||
Timber.i("StudyOptionsFragment:: Deck options button pressed");
|
||||
if (getCol().getDecks().isDyn(getCol().getDecks().selected())) {
|
||||
openFilteredDeckOptions();
|
||||
} else {
|
||||
Intent i = new Intent(getActivity(), DeckOptions.class);
|
||||
startActivityForResult(i, DECK_OPTIONS);
|
||||
ActivityTransitionAnimation.slide(getActivity(), ActivityTransitionAnimation.FADE);
|
||||
}
|
||||
return true;
|
||||
case R.id.action_custom_study:
|
||||
Timber.i("StudyOptionsFragment:: custom study button pressed");
|
||||
showCustomStudyContextMenu();
|
||||
return true;
|
||||
case R.id.action_unbury:
|
||||
Timber.i("StudyOptionsFragment:: unbury button pressed");
|
||||
getCol().getSched().unburyCardsForDeck();
|
||||
refreshInterfaceAndDecklist(true);
|
||||
return true;
|
||||
case R.id.action_rebuild:
|
||||
Timber.i("StudyOptionsFragment:: rebuild cram deck button pressed");
|
||||
mProgressDialog = StyledProgressDialog.show(getActivity(), "",
|
||||
getResources().getString(R.string.rebuild_cram_deck), true);
|
||||
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_REBUILD_CRAM, getDeckTaskListener(true),
|
||||
new DeckTask.TaskData(mFragmented));
|
||||
return true;
|
||||
case R.id.action_empty:
|
||||
Timber.i("StudyOptionsFragment:: empty cram deck button pressed");
|
||||
mProgressDialog = StyledProgressDialog.show(getActivity(), "",
|
||||
getResources().getString(R.string.empty_cram_deck), false);
|
||||
DeckTask.launchDeckTask(DeckTask.TASK_TYPE_EMPTY_CRAM, getDeckTaskListener(true),
|
||||
new DeckTask.TaskData(mFragmented));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
getActivity().getMenuInflater().inflate(R.menu.study_options_fragment, menu);
|
||||
|
||||
public void configureToolbar() {
|
||||
mToolbar.inflateMenu(R.menu.study_options_fragment);
|
||||
mToolbar.setOnMenuItemClickListener(this);
|
||||
Menu menu = mToolbar.getMenu();
|
||||
// Switch on or off rebuild/empty/custom study depending on whether or not filtered deck
|
||||
if (getCol().getDecks().isDyn(getCol().getDecks().selected())) {
|
||||
menu.findItem(R.id.action_rebuild).setVisible(true);
|
||||
menu.findItem(R.id.action_empty).setVisible(true);
|
||||
menu.findItem(R.id.action_custom_study).setVisible(false);
|
||||
} else {
|
||||
menu.findItem(R.id.action_rebuild).setVisible(false);
|
||||
menu.findItem(R.id.action_empty).setVisible(false);
|
||||
menu.findItem(R.id.action_custom_study).setVisible(true);
|
||||
}
|
||||
// Switch on or off unbury depending on if there are cards to unbury
|
||||
menu.findItem(R.id.action_unbury).setVisible(getCol().getSched().haveBuried());
|
||||
// Switch on or off unbury depending on whether undo is available
|
||||
if (!getCol().undoAvailable()) {
|
||||
menu.findItem(R.id.action_undo).setVisible(false);
|
||||
} else {
|
||||
@ -394,30 +344,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
Resources res = AnkiDroidApp.getAppResources();
|
||||
menu.findItem(R.id.action_undo).setTitle(res.getString(R.string.studyoptions_congrats_undo, getCol().undoName(res)));
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_undo:
|
||||
Timber.i("StudyOptionsFragment:: Undo button pressed");
|
||||
if (colOpen()) {
|
||||
getCol().undo();
|
||||
refreshInterfaceAndDecklist(true);
|
||||
getActivity().supportInvalidateOptionsMenu();
|
||||
}
|
||||
return true;
|
||||
case R.id.action_add_note_from_study_options:
|
||||
Timber.i("StudyOptionsFragment:: Add note button pressed");
|
||||
addNote();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -435,12 +361,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
return;
|
||||
}
|
||||
|
||||
// check that the collection is open before doing anything
|
||||
if (!colOpen()) {
|
||||
startLoadingCollection();
|
||||
return;
|
||||
}
|
||||
|
||||
// perform some special actions depending on which activity we're returning from
|
||||
if (requestCode == STATISTICS || requestCode == BROWSE_CARDS) {
|
||||
// select original deck if the statistics or card browser were opened,
|
||||
@ -553,10 +473,9 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
int totalNew = (Integer) obj[3];
|
||||
int totalCards = (Integer) obj[4];
|
||||
int eta = (Integer) obj[7];
|
||||
double[][] serieslist = (double[][]) obj[8];
|
||||
|
||||
// Don't do anything if the fragment is no longer attached to it's Activity or col has been closed
|
||||
if (getActivity() == null || !colOpen()) {
|
||||
if (getActivity() == null) {
|
||||
Timber.e("StudyOptionsFragment.mRefreshFragmentListener :: can't refresh");
|
||||
return;
|
||||
}
|
||||
@ -583,12 +502,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
nameBuilder.append("\n").append(name[name.length - 1]);
|
||||
}
|
||||
mTextDeckName.setText(nameBuilder.toString());
|
||||
// Also set deck name in activity title in action bar if not tablet mode
|
||||
if (!mFragmented) {
|
||||
getActivity().setTitle(getResources().getString(R.string.studyoptions_title));
|
||||
List<String> parts = Arrays.asList(fullName.split("::"));
|
||||
((AppCompatActivity)getActivity()).getSupportActionBar().setSubtitle(parts.get(parts.size() - 1));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -603,25 +516,26 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
if (totalCards == 0 && !isDynamic) {
|
||||
mCurrentContentView = CONTENT_EMPTY;
|
||||
mDeckInfoLayout.setVisibility(View.VISIBLE);
|
||||
mCongratsLayout.setVisibility(View.VISIBLE);
|
||||
mTextCongratsMessage.setVisibility(View.VISIBLE);
|
||||
mTextCongratsMessage.setText(R.string.studyoptions_empty);
|
||||
mButtonStart.setVisibility(View.GONE);
|
||||
if (mChartView != null) {
|
||||
mChartView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else if (newCards + lrnCards + revCards == 0) {
|
||||
mCurrentContentView = CONTENT_CONGRATS;
|
||||
if (!isDynamic) {
|
||||
mDeckInfoLayout.setVisibility(View.GONE);
|
||||
mButtonStart.setVisibility(View.VISIBLE);
|
||||
mButtonStart.setText(R.string.custom_study);
|
||||
} else {
|
||||
mButtonStart.setVisibility(View.GONE);
|
||||
}
|
||||
mCongratsLayout.setVisibility(View.VISIBLE);
|
||||
mTextCongratsMessage.setVisibility(View.VISIBLE);
|
||||
mTextCongratsMessage.setText(getCol().getSched().finishedMsg(getActivity()));
|
||||
mButtonStart.setVisibility(View.GONE);
|
||||
} else {
|
||||
mCurrentContentView = CONTENT_STUDY_OPTIONS;
|
||||
mDeckInfoLayout.setVisibility(View.VISIBLE);
|
||||
mCongratsLayout.setVisibility(View.GONE);
|
||||
mTextCongratsMessage.setVisibility(View.GONE);
|
||||
mButtonStart.setVisibility(View.VISIBLE);
|
||||
mButtonStart.setText(R.string.studyoptions_start);
|
||||
}
|
||||
|
||||
// Set deck description
|
||||
@ -638,9 +552,6 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
mTextDeckDescription.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Update the chart (for tablet view)
|
||||
updateChart(serieslist);
|
||||
|
||||
// Set new/learn/review card counts
|
||||
mTextTodayNew.setText(String.valueOf(newCards));
|
||||
mTextTodayLrn.setText(String.valueOf(lrnCards));
|
||||
@ -691,15 +602,8 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
} else {
|
||||
mTextETA.setText("-");
|
||||
}
|
||||
|
||||
// Show unbury button if necessary
|
||||
if (mButtonUnbury != null) {
|
||||
if (getCol().getSched().haveBuried()) {
|
||||
mButtonUnbury.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mButtonUnbury.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
// Rebuild the options menu
|
||||
getActivity().supportInvalidateOptionsMenu();
|
||||
}
|
||||
|
||||
// If in fragmented mode, refresh the deck list
|
||||
@ -720,60 +624,7 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private Collection getCol() {
|
||||
return mCollection;
|
||||
}
|
||||
|
||||
private boolean colOpen() {
|
||||
return getCol() != null && getCol().getDb() != null;
|
||||
}
|
||||
|
||||
// Method for loading the collection which is inherited by all AnkiActivitys
|
||||
protected void startLoadingCollection() {
|
||||
// Initialize the open collection loader
|
||||
Timber.d("startLoadingCollection()");
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
|
||||
// CollectionLoader Listener callbacks
|
||||
@Override
|
||||
public Loader<Collection> onCreateLoader(int id, Bundle args) {
|
||||
// Currently only using one loader, so ignore id
|
||||
return new CollectionLoader(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Collection> loader, Collection col) {
|
||||
if (col != null) {
|
||||
onCollectionLoaded(col);
|
||||
} else {
|
||||
AnkiDatabaseManager.closeDatabase(CollectionHelper.getCollectionPath(getActivity()));
|
||||
//showDialog(DIALOG_LOAD_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Collection> arg0) {
|
||||
// We don't currently retain any references, so no need to free any data here
|
||||
}
|
||||
|
||||
private void showProgressBar() {
|
||||
ProgressBar progressBar = (ProgressBar) mStudyOptionsView.findViewById(R.id.progress_bar);
|
||||
if (progressBar != null) {
|
||||
mStudyOptionsView.setVisibility(View.INVISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void hideProgressBar() {
|
||||
ProgressBar progressBar = (ProgressBar) mStudyOptionsView.findViewById(R.id.progress_bar);
|
||||
if (progressBar != null) {
|
||||
mStudyOptionsView.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
return CollectionHelper.getInstance().getCol(getContext());
|
||||
}
|
||||
}
|
||||
|
@ -732,10 +732,8 @@ public class DeckTask extends BaseAsyncTask<DeckTask.TaskData, DeckTask.TaskData
|
||||
int totalCount = sched.cardCount();
|
||||
double progressMature = ((double) sched.matureCount()) / ((double) totalCount);
|
||||
double progressAll = 1 - (((double) (totalNewCount + counts[1])) / ((double) totalCount));
|
||||
double[][] serieslist = null;
|
||||
serieslist = Stats.getSmallDueStats(col);
|
||||
return new TaskData(new Object[] { counts[0], counts[1], counts[2], totalNewCount, totalCount,
|
||||
progressMature, progressAll, sched.eta(counts), serieslist });
|
||||
progressMature, progressAll, sched.eta(counts)});
|
||||
} catch (RuntimeException e) {
|
||||
Timber.e(e, "doInBackgroundUpdateValuesFromDeck - an error occurred");
|
||||
return null;
|
||||
|
8
AnkiDroid/src/main/res/drawable-v21/shadow_left.xml
Normal file
8
AnkiDroid/src/main/res/drawable-v21/shadow_left.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:gradientRadius="0dp"
|
||||
android:startColor="#10000000"
|
||||
android:endColor="?android:attr/colorBackground"/>
|
||||
</shape>
|
@ -4,5 +4,5 @@
|
||||
android:angle="0"
|
||||
android:gradientRadius="0dp"
|
||||
android:startColor="#10000000"
|
||||
android:endColor="?android:attr/colorBackground"/>
|
||||
android:endColor="#10FFFFFF"/>
|
||||
</shape>
|
@ -13,7 +13,8 @@
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
android:layout_weight="1"
|
||||
|
@ -5,38 +5,24 @@
|
||||
android:layout_height="fill_parent"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:orientation="horizontal"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<include layout="@layout/deck_picker"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="3"
|
||||
android:layout_height="match_parent"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/studyOptionsToolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="?attr/actionBarThemeRef"
|
||||
app:popupTheme="?attr/actionBarPopupThemeRef"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<View
|
||||
android:id="@+id/studyoptions_gradient"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/shadow_left" />
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/studyoptions_fragment"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
</LinearLayout>
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<View
|
||||
android:id="@+id/studyoptions_gradient"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/shadow_left" />
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/studyoptions_fragment"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -12,7 +12,9 @@
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
<include layout="@layout/toolbar" />
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<com.ichi2.ui.SlidingTabLayout
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="12dp" >
|
||||
<!-- Front -->
|
||||
|
@ -12,10 +12,9 @@
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
<ListView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/note_type_editor_fields"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
android:id="@+id/note_type_editor_fields"/>
|
||||
</LinearLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -1,9 +1,10 @@
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/model_editor_list_display"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="7dip"
|
||||
android:paddingLeft="@dimen/keyline_1"
|
||||
android:paddingRight="5dip"
|
||||
android:textSize="20sp"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
android:id="@+id/model_editor_list_display"
|
||||
android:layout_width="600dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="7dip"
|
||||
android:paddingLeft="@dimen/keyline_1"
|
||||
android:paddingRight="5dip"
|
||||
android:textSize="20sp"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
@ -13,7 +13,8 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LinearLayoutForSpareMenuFieldEdit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
</LinearLayout>
|
||||
|
@ -11,8 +11,9 @@
|
||||
android:orientation="vertical">
|
||||
<include layout="@layout/toolbar"/>
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:fillViewport="true"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/logged_text"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:gravity="center"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp"
|
||||
android:layout_centerInParent="true"
|
||||
|
@ -13,8 +13,9 @@
|
||||
<include layout="@layout/toolbar"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:fillViewport="true"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/CardEditorScroll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="@dimen/match_parent_or_600dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
<LinearLayout
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</LinearLayout>
|
@ -8,9 +8,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/studyoptions_frame"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -1,59 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/studyoptions_main"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="@dimen/keyline_1"
|
||||
android:paddingRight="@dimen/keyline_1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/studyoptions_mainframe"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="32dp" >
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/studyOptionsToolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="?attr/actionBarThemeRef"
|
||||
android:layout_alignParentTop="true"
|
||||
app:popupTheme="?attr/actionBarPopupThemeRef"/>
|
||||
<ScrollView
|
||||
android:id="@+id/studyoptions_scrollview"
|
||||
android:layout_below="@id/studyOptionsToolbar"
|
||||
android:layout_above="@id/bottom_area_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="@dimen/study_options_padding"
|
||||
android:paddingRight="@dimen/study_options_padding"
|
||||
android:paddingBottom="16dp"
|
||||
android:fadeScrollbars="false"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/studyoptions_scrollcontainer"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/studyoptions_deck_name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="3"
|
||||
android:text=""
|
||||
android:text="Deck Title"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/studyoptions_deckinformation"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/studyoptions_deckcounts"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="5dip"
|
||||
android:layout_marginEnd="3dip"
|
||||
@ -69,7 +84,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="0dip"
|
||||
android:paddingRight="5dip"
|
||||
android:text="@string/studyoptions_due_today" />
|
||||
android:text="@string/studyoptions_due_today"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@ -147,149 +162,48 @@
|
||||
android:gravity="end" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/studyoptions_deck_description"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/studyoptions_congrats_layout"
|
||||
android:layout_width="fill_parent"
|
||||
<TextView
|
||||
android:id="@+id/studyoptions_deck_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/studyoptions_congrats_message"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:gravity="center"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:gravity="center"
|
||||
android:text="This is a deck description. It tells us about what the deck does and where it comes from blah blah." />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/bottom_area_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="5dip">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/studyoptions_congrats_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_start"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:lines="3"
|
||||
android:text="@string/studyoptions_start"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- This is the layout for a normal deck (not filtered). We show this by default and
|
||||
hide/replace it with another one if it's a filtered deck.-->
|
||||
<LinearLayout
|
||||
android:id="@+id/studyoptions_regular_buttons"
|
||||
android:layout_width="fill_parent"
|
||||
android:minLines="2"
|
||||
android:text="Congratulations! You have finished for now."
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center"/>
|
||||
<Button
|
||||
android:id="@+id/studyoptions_start"
|
||||
android:background="@color/fab_normal"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="200dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_options"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:lines="1"
|
||||
android:text="@string/study_options"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_custom"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:lines="1"
|
||||
android:text="@string/custom_study"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_unbury"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:lines="1"
|
||||
android:text="@string/unbury"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- This is the layout used for filtered decks. It is hidden by default and made visible
|
||||
at runtime if we are loading a filtered deck. -->
|
||||
<LinearLayout
|
||||
android:id="@+id/studyoptions_cram_buttons"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_options_cram"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/study_options"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_rebuild_cram"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/rebuild_cram_label"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_empty_cram"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/empty_cram_label"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/studyoptions_unbury_cram"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/unbury"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
android:lines="2"
|
||||
android:text="@string/studyoptions_start"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<include layout="@layout/anki_progress"/>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -5,12 +5,23 @@
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/ic_undo_white_24dp"
|
||||
android:title="@string/undo"
|
||||
ankidroid:showAsAction="always"
|
||||
android:visibility = "gone" />
|
||||
ankidroid:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/action_add_note_from_study_options"
|
||||
android:icon="@drawable/ic_add_white_24dp"
|
||||
android:title="@string/menu_add"
|
||||
ankidroid:showAsAction="always"
|
||||
android:visible="false" />
|
||||
android:id="@+id/action_deck_options"
|
||||
android:title="@string/study_options"/>
|
||||
<item
|
||||
android:id="@+id/action_custom_study"
|
||||
android:title="@string/custom_study"/>
|
||||
<item
|
||||
android:id="@+id/action_unbury"
|
||||
android:title="@string/unbury"
|
||||
android:visibility = "gone"/>
|
||||
<item
|
||||
android:id="@+id/action_rebuild"
|
||||
android:title="@string/rebuild_cram_label"
|
||||
android:visibility = "gone"/>
|
||||
<item
|
||||
android:id="@+id/action_empty"
|
||||
android:title="@string/empty_cram_label"
|
||||
android:visibility = "gone"/>
|
||||
</menu>
|
@ -2,7 +2,9 @@
|
||||
<resources>
|
||||
<dimen name="keyline_1">24dp</dimen>
|
||||
<dimen name="default_width">64dp</dimen>
|
||||
<dimen name="study_options_padding">16dp</dimen>
|
||||
<dimen name="deck_picker_left_padding_small">12dp</dimen>
|
||||
<dimen name="deck_picker_left_padding">24dp</dimen>
|
||||
<dimen name="deck_picker_right_padding">12dp</dimen>
|
||||
<dimen name="match_parent_or_600dp">600dp</dimen>
|
||||
</resources>
|
@ -3,6 +3,10 @@
|
||||
<dimen name="touch_target">48dp</dimen>
|
||||
<dimen name="default_width">56dp</dimen>
|
||||
<dimen name="keyline_1">16dp</dimen>
|
||||
<dimen name="study_options_padding">8dp</dimen>
|
||||
|
||||
<!-- match_parent or max 600dp -->
|
||||
<dimen name="match_parent_or_600dp">-1px</dimen>
|
||||
|
||||
<!-- Top margin for action bar subtitles -->
|
||||
<dimen name="action_bar_subtitle_top_margin">-3dp</dimen>
|
||||
|
Loading…
Reference in New Issue
Block a user