use of com.ichi2.anki.reviewer.CardMarker in project AnkiChinaAndroid by ankichinateam.
the class AbstractFlashcardViewer method initLayout.
// Set the content view to the one provided and initialize accessors.
// Tracked separately as #5023 on github for clipboard
@SuppressWarnings("deprecation")
protected void initLayout() {
FrameLayout mCardContainer = (FrameLayout) findViewById(R.id.flashcard_frame);
mTopBarLayout = (RelativeLayout) findViewById(R.id.top_bar);
ImageView mark = mTopBarLayout.findViewById(R.id.mark_icon);
ImageView flag = mTopBarLayout.findViewById(R.id.flag_icon);
mCardMarker = new CardMarker(mark, flag);
mCardFrame = (FrameLayout) findViewById(R.id.flashcard);
mCardFrameParent = (ViewGroup) mCardFrame.getParent();
mTouchLayer = (FrameLayout) findViewById(R.id.touch_layer);
mTouchLayer.setOnTouchListener(mGestureListener);
if (!mDisableClipboard) {
mClipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
}
mCardFrame.removeAllViews();
// Initialize swipe
mGestureDetectorImpl = mLinkOverridesTouchGesture ? new LinkDetectingGestureDetector() : new MyGestureDetector();
gestureDetector = new GestureDetectorCompat(this, mGestureDetectorImpl);
mEaseButtonsLayout = findViewById(R.id.ease_buttons);
mEase1 = findViewById(R.id.ease1);
mEase1Layout = findViewById(R.id.flashcard_layout_ease1);
mEase1Layout.setOnClickListener(mSelectEaseHandler);
mEase2 = findViewById(R.id.ease2);
mEase2Layout = findViewById(R.id.flashcard_layout_ease2);
mEase2Layout.setOnClickListener(mSelectEaseHandler);
mEase3 = findViewById(R.id.ease3);
mEase3Layout = findViewById(R.id.flashcard_layout_ease3);
mEase3Layout.setOnClickListener(mSelectEaseHandler);
mEase4 = findViewById(R.id.ease4);
mEase4Layout = findViewById(R.id.flashcard_layout_ease4);
mEase4Layout.setOnClickListener(mSelectEaseHandler);
mNext1 = findViewById(R.id.nextTime1);
mNext2 = findViewById(R.id.nextTime2);
mNext3 = findViewById(R.id.nextTime3);
mNext4 = findViewById(R.id.nextTime4);
if (!mShowNextReviewTime) {
mNext1.setVisibility(View.GONE);
mNext2.setVisibility(View.GONE);
mNext3.setVisibility(View.GONE);
mNext4.setVisibility(View.GONE);
}
Button mFlipCard = (Button) findViewById(R.id.flip_card);
mFlipCardLayout = (LinearLayout) findViewById(R.id.flashcard_layout_flip);
mFlipCardLayout.setOnClickListener(mFlipCardListener);
if (!mButtonHeightSet && mRelativeButtonSize != 100) {
ViewGroup.LayoutParams params = mFlipCardLayout.getLayoutParams();
params.height = params.height * mRelativeButtonSize / 100;
params = mEase1Layout.getLayoutParams();
params.height = params.height * mRelativeButtonSize / 100;
params = mEase2Layout.getLayoutParams();
params.height = params.height * mRelativeButtonSize / 100;
params = mEase3Layout.getLayoutParams();
params.height = params.height * mRelativeButtonSize / 100;
params = mEase4Layout.getLayoutParams();
params.height = params.height * mRelativeButtonSize / 100;
mButtonHeightSet = true;
}
mPreviewButtonsLayout = findViewById(R.id.preview_buttons_layout);
mPreviewPrevCard = findViewById(R.id.preview_previous_flashcard);
mPreviewNextCard = findViewById(R.id.preview_next_flashcard);
mPreviewToggleAnswerText = findViewById(R.id.preview_flip_flashcard);
mCardTimer = (Chronometer) findViewById(R.id.card_time);
mChosenAnswer = (TextView) findViewById(R.id.choosen_answer);
mAnswerField = (EditText) findViewById(R.id.answer_field);
mLookUpIcon = findViewById(R.id.lookup_button);
mLookUpIcon.setVisibility(View.GONE);
mLookUpIcon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Timber.i("AbstractFlashcardViewer:: Lookup button pressed");
if (clipboardHasText()) {
lookUp();
}
}
});
initControls();
// Position answer buttons
String answerButtonsPosition = AnkiDroidApp.getSharedPrefs(this).getString(getString(R.string.answer_buttons_position_preference), "bottom");
LinearLayout answerArea = (LinearLayout) findViewById(R.id.bottom_area_layout);
RelativeLayout.LayoutParams answerAreaParams = (RelativeLayout.LayoutParams) answerArea.getLayoutParams();
RelativeLayout.LayoutParams cardContainerParams = (RelativeLayout.LayoutParams) mCardContainer.getLayoutParams();
switch(answerButtonsPosition) {
case "top":
cardContainerParams.addRule(RelativeLayout.BELOW, R.id.bottom_area_layout);
answerAreaParams.addRule(RelativeLayout.BELOW, R.id.mic_tool_bar_layer);
answerArea.removeView(mAnswerField);
answerArea.addView(mAnswerField, 1);
break;
case "bottom":
cardContainerParams.addRule(RelativeLayout.ABOVE, R.id.bottom_area_layout);
cardContainerParams.addRule(RelativeLayout.BELOW, R.id.mic_tool_bar_layer);
answerAreaParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
break;
default:
Timber.w("Unknown answerButtonsPosition: %s", answerButtonsPosition);
break;
}
answerArea.setLayoutParams(answerAreaParams);
mCardContainer.setLayoutParams(cardContainerParams);
}
use of com.ichi2.anki.reviewer.CardMarker in project Anki-Android by ankidroid.
the class Reviewer method initLayout.
@Override
protected void initLayout() {
mTextBarNew = findViewById(R.id.new_number);
mTextBarLearn = findViewById(R.id.learn_number);
mTextBarReview = findViewById(R.id.review_number);
super.initLayout();
if (!mShowRemainingCardCount) {
mTextBarNew.setVisibility(View.GONE);
mTextBarLearn.setVisibility(View.GONE);
mTextBarReview.setVisibility(View.GONE);
}
// can't move this into onCreate due to mTopBarLayout
ImageView mark = mTopBarLayout.findViewById(R.id.mark_icon);
ImageView flag = mTopBarLayout.findViewById(R.id.flag_icon);
mCardMarker = new CardMarker(mark, flag);
}
Aggregations