use of com.ichi2.anim.Animation3D in project Anki-Android by Ramblurr.
the class PreviewClass method fillFlashcard.
public void fillFlashcard(boolean flip) {
if (!flip) {
Display display = getWindowManager().getDefaultDisplay();
Integer width = display.getWidth();
Integer height = display.getHeight() / 2;
String file_contents = mCardContent.toString();
file_contents = file_contents.replace("newImg.width", width.toString());
file_contents = file_contents.replace("newImg.height", height.toString());
file_contents = file_contents.replace("<head>", "<head><meta name='viewport' content='width=device-width,initial-scale=1,minimum-scale=1,user-scalable=yes'/>");
// Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl);
if (mCurrentSimpleInterface && mSimpleCard != null) {
mSimpleCard.setText(mCardContent);
} else if (mRefreshWebview && mCard != null && mNextCard != null) {
mNextCard.setBackgroundColor(mCurrentBackgroundColor);
//newImg.width
mNextCard.loadDataWithBaseURL(mBaseUrl, file_contents, "text/html", "utf-8", null);
mNextCard.setVisibility(View.VISIBLE);
mCardFrame.removeView(mCard);
mCard.destroy();
mCard = mNextCard;
mNextCard = createWebView();
mNextCard.setVisibility(View.GONE);
mCardFrame.addView(mNextCard, 0);
// hunt for input issue 720, like android issue 3341
if (AnkiDroidApp.SDK_VERSION <= 7) {
mCard.setFocusableInTouchMode(true);
}
} else if (mCard != null) {
mCard.loadDataWithBaseURL(mBaseUrl, file_contents, "text/html", "utf-8", null);
mCard.setBackgroundColor(mCurrentBackgroundColor);
}
if (mChangeBorderStyle) {
}
} else {
Animation3D rotation;
boolean directionToLeft = true;
mCardContainer.setDrawingCacheEnabled(true);
mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor());
mCardContainer.clearAnimation();
//mCardContainer.startAnimation(rotation);
}
}
use of com.ichi2.anim.Animation3D in project Anki-Android by Ramblurr.
the class Reviewer method fillFlashcard.
public void fillFlashcard(boolean flip) {
if (!flip) {
Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl);
if (mCurrentSimpleInterface && mSimpleCard != null) {
mSimpleCard.setText(mCardContent);
} else if (!mUseQuickUpdate && mCard != null && mNextCard != null) {
mNextCard.setBackgroundColor(mCurrentBackgroundColor);
mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null);
mNextCard.setVisibility(View.VISIBLE);
mCardFrame.removeView(mCard);
mCard.destroy();
mCard = mNextCard;
mNextCard = createWebView();
mNextCard.setVisibility(View.GONE);
mCardFrame.addView(mNextCard, 0);
// hunt for input issue 720, like android issue 3341
if (AnkiDroidApp.SDK_VERSION <= 7) {
mCard.setFocusableInTouchMode(true);
}
} else if (mCard != null) {
mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null);
mCard.setBackgroundColor(mCurrentBackgroundColor);
}
if (mChangeBorderStyle) {
switch(mCurrentBackgroundColor) {
case Color.WHITE:
if (mInvertedColors) {
mInvertedColors = false;
invertColors(false);
}
break;
case Color.BLACK:
if (!mInvertedColors) {
mInvertedColors = true;
invertColors(true);
}
break;
default:
if (Themes.getTheme() != Themes.THEME_BLUE) {
mMainLayout.setBackgroundColor(mCurrentBackgroundColor);
}
if (mInvertedColors != mNightMode) {
mInvertedColors = mNightMode;
invertColors(mNightMode);
}
}
}
if (!mShowAnimations && mShowTimer && mCardTimer.getVisibility() == View.INVISIBLE) {
switchTopBarVisibility(View.VISIBLE);
}
if (!sDisplayAnswer) {
updateForNewCard();
if (mShowWhiteboard) {
mWhiteboard.clear();
}
setNextCardAnimation(false);
}
} else {
Animation3D rotation;
boolean directionToLeft = true;
switch(mNextAnimation) {
case ANIMATION_TURN:
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this);
rotation.setDuration(mAnimationDurationTurn);
rotation.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case ANIMATION_NEXT_CARD_FROM_LEFT:
directionToLeft = false;
case ANIMATION_NEXT_CARD_FROM_RIGHT:
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case ANIMATION_SLIDE_OUT_TO_RIGHT:
directionToLeft = false;
case ANIMATION_SLIDE_OUT_TO_LEFT:
fillFlashcard(false);
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new AccelerateInterpolator());
switchTopBarVisibility(View.INVISIBLE);
break;
case ANIMATION_SLIDE_IN_FROM_LEFT:
directionToLeft = false;
case ANIMATION_SLIDE_IN_FROM_RIGHT:
fillFlashcard(false);
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new DecelerateInterpolator());
switchTopBarVisibility(View.VISIBLE);
break;
case ANIMATION_NO_ANIMATION:
default:
return;
}
rotation.reset();
mCardContainer.setDrawingCacheEnabled(true);
mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor());
mCardContainer.clearAnimation();
mCardContainer.startAnimation(rotation);
}
}
Aggregations