use of com.ichi2.anki.Reviewer.ScrollTextView in project Anki-Android by Ramblurr.
the class PreviewClass method setInterface.
private void setInterface() {
if (mCurrentCard == null) {
return;
}
if (mSimpleInterface) {
Note note = mCurrentCard.note();
mCurrentSimpleInterface = true;
for (String s : mSimpleInterfaceExcludeTags) {
if (note.hasTag(s)) {
mCurrentSimpleInterface = false;
break;
}
}
}
if (mCurrentSimpleInterface) {
if (mSimpleCard == null) {
mSimpleCard = new ScrollTextView(this);
Themes.setRegularFont(mSimpleCard);
mSimpleCard.setTextSize(mSimpleCard.getTextSize() * mDisplayFontSize / 100);
mSimpleCard.setGravity(Gravity.CENTER);
try {
mSetTextIsSelectable = TextView.class.getMethod("setTextIsSelectable", boolean.class);
} catch (Throwable e) {
// Log.i(AnkiDroidApp.TAG, "mSetTextIsSelectable could not be found due to a too low Android version (< 3.0)");
mSetTextIsSelectable = null;
}
if (mSetTextIsSelectable != null) {
try {
mSetTextIsSelectable.invoke(mSimpleCard, true);
} catch (Exception e) {
Log.e(AnkiDroidApp.TAG, e.toString());
}
}
mSimpleCard.setClickable(true);
mCardFrame.addView(mSimpleCard);
mSimpleCard.setBackgroundColor(mCurrentBackgroundColor);
mSimpleCard.setTextColor(mForegroundColor);
}
if (mSimpleCard.getVisibility() != View.VISIBLE || (mCard != null && mCard.getVisibility() == View.VISIBLE)) {
mSimpleCard.setVisibility(View.VISIBLE);
mCard.setVisibility(View.GONE);
}
} else {
if (mCard == null) {
mCard = createWebView();
mCardFrame.addView(mCard);
if (mRefreshWebview) {
mNextCard = createWebView();
mNextCard.setVisibility(View.GONE);
mCardFrame.addView(mNextCard, 0);
mCard.setBackgroundColor(mCurrentBackgroundColor);
mCustomFontStyle = getCustomFontsStyle() + getDefaultFontStyle();
}
}
if (mCard.getVisibility() != View.VISIBLE || (mSimpleCard != null && mSimpleCard.getVisibility() == View.VISIBLE)) {
mSimpleCard.setVisibility(View.GONE);
mCard.setVisibility(View.VISIBLE);
}
}
}
use of com.ichi2.anki.Reviewer.ScrollTextView in project Anki-Android by Ramblurr.
the class Reviewer method setInterface.
private void setInterface() {
if (mCurrentCard == null) {
return;
}
if (mSimpleInterface) {
Note note = mCurrentCard.note();
mCurrentSimpleInterface = true;
for (String s : mSimpleInterfaceExcludeTags) {
if (note.hasTag(s)) {
mCurrentSimpleInterface = false;
break;
}
}
}
if (mCurrentSimpleInterface) {
if (mSimpleCard == null) {
mSimpleCard = new ScrollTextView(this);
Themes.setRegularFont(mSimpleCard);
mSimpleCard.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()) * mDisplayFontSize / 100);
mSimpleCard.setGravity(Gravity.CENTER);
try {
mSetTextIsSelectable = TextView.class.getMethod("setTextIsSelectable", boolean.class);
} catch (Throwable e) {
Log.i(AnkiDroidApp.TAG, "mSetTextIsSelectable could not be found due to a too low Android version (< 3.0)");
mSetTextIsSelectable = null;
}
if (mSetTextIsSelectable != null) {
try {
mSetTextIsSelectable.invoke(mSimpleCard, true);
} catch (Exception e) {
Log.e(AnkiDroidApp.TAG, e.toString());
}
}
mSimpleCard.setClickable(true);
mCardFrame.addView(mSimpleCard);
mSimpleCard.setBackgroundColor(mCurrentBackgroundColor);
mSimpleCard.setTextColor(mForegroundColor);
}
if (mSimpleCard.getVisibility() != View.VISIBLE || (mCard != null && mCard.getVisibility() == View.VISIBLE)) {
mSimpleCard.setVisibility(View.VISIBLE);
mCard.setVisibility(View.GONE);
}
} else {
if (mCard == null) {
mCard = createWebView();
mCardFrame.addView(mCard);
if (!mUseQuickUpdate) {
mNextCard = createWebView();
mNextCard.setVisibility(View.GONE);
mCardFrame.addView(mNextCard, 0);
mCard.setBackgroundColor(mCurrentBackgroundColor);
}
}
if (mCard.getVisibility() != View.VISIBLE || (mSimpleCard != null && mSimpleCard.getVisibility() == View.VISIBLE)) {
mSimpleCard.setVisibility(View.GONE);
mCard.setVisibility(View.VISIBLE);
}
}
}
Aggregations