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

Expose unbury button for filtered decks

This commit is contained in:
Houssam Salem 2015-06-27 17:30:32 +10:00
parent a5d665600f
commit 4cbe3c8f0d
3 changed files with 22 additions and 6 deletions

View File

@ -171,6 +171,7 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
showCustomStudyContextMenu();
return;
case R.id.studyoptions_unbury:
case R.id.studyoptions_unbury_cram:
Timber.i("StudyOptionsFragment:: unbury button pressed");
col.getSched().unburyCardsForDeck();
refreshInterfaceAndDecklist(true);
@ -340,21 +341,20 @@ public class StudyOptionsFragment extends Fragment implements LoaderManager.Load
mTextCongratsMessage = (TextView) mStudyOptionsView.findViewById(R.id.studyoptions_congrats_message);
mFloatingActionButton = (ImageButton) mStudyOptionsView.findViewById(R.id.fab);
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);
// If dynamic deck then enable the cram buttons group, and disable the new filtered deck / ordinary study
// options buttons group
// Enable the dynamic deck buttons and disable the normal ones
((LinearLayout) mStudyOptionsView.findViewById(R.id.studyoptions_cram_buttons)).setVisibility(View.VISIBLE);
((LinearLayout) 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);
}
// Show the unbury button if there are cards to unbury
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);

View File

@ -369,6 +369,14 @@
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>
</LinearLayout>
</LinearLayout>

View File

@ -333,6 +333,14 @@
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>
</LinearLayout>
</LinearLayout>