@ -146,6 +146,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:theme="@style/App_Theme_Dark.Launcher"
|
||||
android:name="com.ichi2.anki.DeckPicker"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|locale"
|
||||
android:label="@string/app_name">
|
||||
|
@ -30,7 +30,6 @@ import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -1513,28 +1512,28 @@ public abstract class AbstractFlashcardViewer extends NavigationDrawerActivity {
|
||||
|
||||
// Set correct label and background resource for each button
|
||||
// Note that it's necessary to set the resource dynamically as the ease2 / ease3 buttons
|
||||
// (which libanki expects ease to be 2 and 3) can either be hard, good, or easy -- depending on how many buttons are shown
|
||||
final int[] ANSWER_BUTTON_DRAWABLES = {R.attr.againButtonRef, R.attr.hardButtonRef, R.attr.goodButtonRef, R.attr.easyButtonRef};
|
||||
TypedArray ta = obtainStyledAttributes(ANSWER_BUTTON_DRAWABLES);
|
||||
// (which libanki expects ease to be 2 and 3) can either be hard, good, or easy - depending on num buttons shown
|
||||
final int[] icons = Themes.getResFromAttr(this, new int [] {R.attr.againButtonRef, R.attr.hardButtonRef,
|
||||
R.attr.goodButtonRef, R.attr.easyButtonRef});
|
||||
mEase1Layout.setVisibility(View.VISIBLE);
|
||||
mEase1Layout.setBackgroundResource(ta.getResourceId(0, R.drawable.footer_button_again));
|
||||
mEase4Layout.setBackgroundResource(ta.getResourceId(3, R.drawable.footer_button_easy));
|
||||
mEase1Layout.setBackgroundResource(icons[0]);
|
||||
mEase4Layout.setBackgroundResource(icons[3]);
|
||||
switch (buttonCount) {
|
||||
case 2:
|
||||
// Ease 2 is "good"
|
||||
mEase2Layout.setVisibility(View.VISIBLE);
|
||||
mEase2Layout.setBackgroundResource(ta.getResourceId(2, R.drawable.footer_button_good));
|
||||
mEase2Layout.setBackgroundResource(icons[2]);
|
||||
mEase2.setText(R.string.ease_button_good);
|
||||
mEase2Layout.requestFocus();
|
||||
break;
|
||||
case 3:
|
||||
// Ease 2 is good
|
||||
mEase2Layout.setVisibility(View.VISIBLE);
|
||||
mEase2Layout.setBackgroundResource(ta.getResourceId(2, R.drawable.footer_button_good));
|
||||
mEase2Layout.setBackgroundResource(icons[2]);
|
||||
mEase2.setText(R.string.ease_button_good);
|
||||
// Ease 3 is easy
|
||||
mEase3Layout.setVisibility(View.VISIBLE);
|
||||
mEase3Layout.setBackgroundResource(ta.getResourceId(3, R.drawable.footer_button_easy));
|
||||
mEase3Layout.setBackgroundResource(icons[3]);
|
||||
mEase3.setText(R.string.ease_button_easy);
|
||||
mEase2Layout.requestFocus();
|
||||
break;
|
||||
@ -1542,17 +1541,16 @@ public abstract class AbstractFlashcardViewer extends NavigationDrawerActivity {
|
||||
mEase2Layout.setVisibility(View.VISIBLE);
|
||||
// Ease 2 is "hard"
|
||||
mEase2Layout.setVisibility(View.VISIBLE);
|
||||
mEase2Layout.setBackgroundResource(ta.getResourceId(1, R.drawable.footer_button_hard));
|
||||
mEase2Layout.setBackgroundResource(icons[1]);
|
||||
mEase2.setText(R.string.ease_button_hard);
|
||||
mEase2Layout.requestFocus();
|
||||
// Ease 3 is good
|
||||
mEase3Layout.setVisibility(View.VISIBLE);
|
||||
mEase3Layout.setBackgroundResource(ta.getResourceId(2, R.drawable.footer_button_good));
|
||||
mEase3Layout.setBackgroundResource(icons[2]);
|
||||
mEase3.setText(R.string.ease_button_good);
|
||||
mEase4Layout.setVisibility(View.VISIBLE);
|
||||
mEase3Layout.requestFocus();
|
||||
}
|
||||
ta.recycle();
|
||||
|
||||
// Show next review time
|
||||
if (mShowNextReviewTime) {
|
||||
|
@ -24,7 +24,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
@ -1244,17 +1243,15 @@ public class CardBrowser extends NavigationDrawerActivity implements
|
||||
// Draw the content in the columns
|
||||
View[] columns = (View[]) v.getTag();
|
||||
final Map<String, String> dataSet = mData.get(position);
|
||||
final int color = getColor(dataSet.get(mColorFlagKey));
|
||||
final int colorIdx = getColor(dataSet.get(mColorFlagKey));
|
||||
int[] colors = Themes.getColorFromAttr(CardBrowser.this, new int[]{android.R.attr.colorBackground,
|
||||
R.attr.markedColor, R.attr.suspendedColor, R.attr.markedColor});
|
||||
for (int i = 0; i < mToIds.length; i++) {
|
||||
TextView col = (TextView) columns[i];
|
||||
// set font for column
|
||||
setFont(col);
|
||||
// set background color for column
|
||||
int[] attrs = new int[] {android.R.attr.colorBackground, R.attr.markedColor, R.attr.suspendedColor,
|
||||
R.attr.markedColor};
|
||||
TypedArray ta = obtainStyledAttributes(attrs);
|
||||
col.setBackgroundColor(ta.getColor(color, getResources().getColor(R.color.material_grey_700)));
|
||||
ta.recycle();
|
||||
col.setBackgroundColor(colors[colorIdx]);
|
||||
// set text for column
|
||||
col.setText(dataSet.get(mFromKeys[i]));
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.getbase.floatingactionbutton.FloatingActionButton;
|
||||
import com.getbase.floatingactionbutton.FloatingActionsMenu;
|
||||
import com.ichi2.anim.ActivityTransitionAnimation;
|
||||
import com.ichi2.anki.StudyOptionsFragment.StudyOptionsListener;
|
||||
import com.ichi2.anki.dialogs.AsyncDialogFragment;
|
||||
@ -91,9 +93,6 @@ import com.ichi2.ui.DividerItemDecoration;
|
||||
import com.ichi2.utils.VersionUtils;
|
||||
import com.ichi2.widget.WidgetStatus;
|
||||
|
||||
import com.getbase.floatingactionbutton.FloatingActionButton;
|
||||
import com.getbase.floatingactionbutton.FloatingActionsMenu;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.File;
|
||||
@ -138,7 +137,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
public static final long AUTOMATIC_SYNC_MIN_INTERVAL = 600000;
|
||||
|
||||
private MaterialDialog mProgressDialog;
|
||||
|
||||
private View mStudyoptionsFrame;
|
||||
private RecyclerView mRecyclerView;
|
||||
private LinearLayoutManager mRecyclerViewLayoutManager;
|
||||
private DeckAdapter mDeckListAdapter;
|
||||
@ -381,16 +380,19 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) throws SQLException {
|
||||
Timber.d("onCreate()");
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(getBaseContext());
|
||||
// Open Collection on UI thread while splash screen is showing
|
||||
boolean colOpen = firstCollectionOpen();
|
||||
|
||||
// Then set theme and content view
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.homescreen);
|
||||
View mainView = findViewById(android.R.id.content);
|
||||
|
||||
// check, if tablet layout
|
||||
View studyoptionsFrame = findViewById(R.id.studyoptions_fragment);
|
||||
mStudyoptionsFrame = findViewById(R.id.studyoptions_fragment);
|
||||
// set protected variable from NavigationDrawerActivity
|
||||
mFragmented = studyoptionsFrame != null && studyoptionsFrame.getVisibility() == View.VISIBLE;
|
||||
mFragmented = mStudyoptionsFrame != null && mStudyoptionsFrame.getVisibility() == View.VISIBLE;
|
||||
|
||||
registerExternalStorageListener();
|
||||
|
||||
@ -432,16 +434,45 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
|
||||
mTodayTextView = (TextView) findViewById(R.id.today_stats_text_view);
|
||||
|
||||
mTodayTextView = (TextView) findViewById(R.id.today_stats_text_view);
|
||||
if (! CollectionHelper.hasStorageAccessPermission(this)) {
|
||||
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
REQUEST_STORAGE_PERMISSION);
|
||||
} else {
|
||||
// Show splash screen and load collection
|
||||
// Hide the fragment until the counts have been loaded so that the Toolbar fills the whole screen on tablets
|
||||
if (mFragmented) {
|
||||
mStudyoptionsFrame.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// Show any necessary dialogs (e.g. changelog, special messages, etc)
|
||||
if (colOpen) {
|
||||
showStartupScreensAndDialogs(preferences, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to open the Collection for the first time, and do some error handling if it wasn't successful
|
||||
* @return whether or not we were successful
|
||||
*/
|
||||
private boolean firstCollectionOpen() {
|
||||
if (CollectionHelper.hasStorageAccessPermission(this)) {
|
||||
// Try to open the collection
|
||||
Collection col = null;
|
||||
try {
|
||||
col = getCol();
|
||||
} catch (RuntimeException e) {
|
||||
Timber.e(e, "RuntimeException opening collection");
|
||||
AnkiDroidApp.sendExceptionReport(e, "DeckPicker.firstCollectionOpen");
|
||||
}
|
||||
// Show error dialog if collection could not be opened
|
||||
if (col == null) {
|
||||
showDatabaseErrorDialog(DatabaseErrorDialog.DIALOG_LOAD_FAILED);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Request storage permission if we don't have it (e.g. on Android 6.0+)
|
||||
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
REQUEST_STORAGE_PERMISSION);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void configureFloatingActionsMenu() {
|
||||
final FloatingActionButton addDeckButton = (FloatingActionButton) findViewById(R.id.add_deck_action);
|
||||
final FloatingActionButton addSharedButton = (FloatingActionButton) findViewById(R.id.add_shared_action);
|
||||
@ -677,14 +708,14 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
Timber.d("onResume()");
|
||||
super.onResume();
|
||||
mActivityPaused = false;
|
||||
selectNavigationItem(DRAWER_DECK_PICKER);
|
||||
if (mSyncOnResume) {
|
||||
sync();
|
||||
mSyncOnResume = false;
|
||||
} else if (colIsOpen()) {
|
||||
selectNavigationItem(DRAWER_DECK_PICKER);
|
||||
updateDeckList();
|
||||
setTitle(getResources().getString(R.string.app_name));
|
||||
}
|
||||
setTitle(getResources().getString(R.string.app_name));
|
||||
}
|
||||
|
||||
|
||||
@ -702,12 +733,6 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
|
||||
|
||||
protected void sendKey(int keycode) {
|
||||
this.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keycode));
|
||||
this.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keycode));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
Timber.d("onPause()");
|
||||
@ -777,24 +802,14 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
// CUSTOM METHODS
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
protected void onCollectionLoaded(Collection col) {
|
||||
// keep reference to collection in parent
|
||||
super.onCollectionLoaded(col);
|
||||
onFinishedStartup();
|
||||
// prepare deck counts and mini-today-statistic
|
||||
updateDeckList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do any work needed after DeckPicker starts. This method assumes that the collection has
|
||||
* finished loading and is open.
|
||||
* Perform the following tasks:
|
||||
* Automatic backup
|
||||
* loadStudyOptionsFragment() if tablet
|
||||
* Automatic sync
|
||||
*/
|
||||
private void onFinishedStartup() {
|
||||
// Since the deck list won't show until we get the deck counts, we show the progress bar again
|
||||
showProgressBar();
|
||||
|
||||
// create backup in background if needed
|
||||
BackupManager.performBackupInBackground(getCol().getPath());
|
||||
|
||||
@ -818,13 +833,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
// Open StudyOptionsFragment if in fragmented mode
|
||||
if (mFragmented) {
|
||||
// Create the fragment in a new handler since Android won't let you perform fragment
|
||||
// transactions in a loader's onLoadFinished.
|
||||
new Handler().post(new Runnable() {
|
||||
public void run() {
|
||||
loadStudyOptionsFragment(false);
|
||||
}
|
||||
});
|
||||
loadStudyOptionsFragment(false);
|
||||
}
|
||||
automaticSync();
|
||||
}
|
||||
@ -862,7 +871,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
} else if (preferences.getString("lastVersion", "").equals("")) {
|
||||
// Fresh install
|
||||
preferences.edit().putString("lastVersion", VersionUtils.getPkgVersionName()).commit();
|
||||
startLoadingCollection();
|
||||
onFinishedStartup();
|
||||
} else if (skip < 2 && !preferences.getString("lastVersion", "").equals(VersionUtils.getPkgVersionName())) {
|
||||
// AnkiDroid is being updated and a collection already exists. We check if we are upgrading
|
||||
// to a version that contains additions to the database integrity check routine that we would
|
||||
@ -943,11 +952,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
} else {
|
||||
// This is the main call when there is nothing special required
|
||||
if (!colIsOpen()) {
|
||||
startLoadingCollection();
|
||||
} else {
|
||||
onFinishedStartup();
|
||||
}
|
||||
onFinishedStartup();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1089,13 +1094,11 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
showDialogFragment(newFragment);
|
||||
}
|
||||
|
||||
|
||||
public void onSdCardNotMounted() {
|
||||
Themes.showThemedToast(this, getResources().getString(R.string.sd_card_not_mounted), false);
|
||||
finishWithoutAnimation();
|
||||
}
|
||||
|
||||
|
||||
// Callback method to submit error report
|
||||
@Override
|
||||
public void sendErrorReport() {
|
||||
@ -1120,9 +1123,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
if (mProgressDialog != null && mProgressDialog.isShowing()) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
if (result != null && result.getBoolean()) {
|
||||
startLoadingCollection();
|
||||
} else {
|
||||
if (result == null || !result.getBoolean()) {
|
||||
Themes.showThemedToast(DeckPicker.this, getResources().getString(R.string.deck_repair_error), true);
|
||||
onCollectionLoadError();
|
||||
}
|
||||
@ -1676,7 +1677,7 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
if (intent.getAction().equals(SdCardReceiver.MEDIA_EJECT)) {
|
||||
onSdCardNotMounted();
|
||||
} else if (intent.getAction().equals(SdCardReceiver.MEDIA_MOUNT)) {
|
||||
startLoadingCollection();
|
||||
restartActivity();
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1688,21 +1689,6 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an intent to load a deck given the full pathname of it. The constructed intent is equivalent (modulo the
|
||||
* extras) to the open used by the launcher shortcut, which means it will not open a new study options window but
|
||||
* bring the existing one to the front.
|
||||
*/
|
||||
public static Intent getLoadDeckIntent(Context context, long deckId) {
|
||||
Intent loadDeckIntent = new Intent(context, DeckPicker.class);
|
||||
loadDeckIntent.setAction(Intent.ACTION_MAIN);
|
||||
loadDeckIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
loadDeckIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
loadDeckIntent.putExtra(EXTRA_DECK_ID, deckId);
|
||||
return loadDeckIntent;
|
||||
}
|
||||
|
||||
|
||||
public void addSharedDeck() {
|
||||
openUrl(Uri.parse(getResources().getString(R.string.shared_decks_url)));
|
||||
}
|
||||
@ -1821,6 +1807,10 @@ public class DeckPicker extends NavigationDrawerActivity implements
|
||||
@Override
|
||||
public void onPostExecute(TaskData result) {
|
||||
hideProgressBar();
|
||||
// Make sure the fragment is visible
|
||||
if (mFragmented) {
|
||||
mStudyoptionsFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (result == null) {
|
||||
Timber.e("null result loading deck counts");
|
||||
onCollectionLoadError();
|
||||
|
@ -17,7 +17,6 @@ package com.ichi2.anki;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.TypedArray;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
@ -27,6 +26,7 @@ import android.widget.CompoundButton;
|
||||
|
||||
import com.ichi2.anim.ActivityTransitionAnimation;
|
||||
import com.ichi2.compat.CompatHelper;
|
||||
import com.ichi2.themes.Themes;
|
||||
import com.mikepenz.materialdrawer.AccountHeader;
|
||||
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
|
||||
import com.mikepenz.materialdrawer.Drawer;
|
||||
@ -104,11 +104,9 @@ public class NavigationDrawerActivity extends AnkiActivity implements Drawer.OnD
|
||||
float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
|
||||
float dpWidth = displayMetrics.widthPixels / displayMetrics.density;
|
||||
if (dpHeight > 320 && dpWidth > 320) {
|
||||
int[] attrs = new int[]{R.attr.navDrawerImage};
|
||||
TypedArray ta = obtainStyledAttributes(attrs);
|
||||
mHeader = new AccountHeaderBuilder()
|
||||
.withActivity(this)
|
||||
.withHeaderBackground(ta.getResourceId(0, R.drawable.nav_drawer_logo))
|
||||
.withHeaderBackground(Themes.getResFromAttr(this, R.attr.navDrawerImage))
|
||||
.withDividerBelowHeader(false)
|
||||
.build();
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
@ -1106,18 +1105,17 @@ public class NoteEditor extends AnkiActivity {
|
||||
|
||||
ImageButton mediaButton = (ImageButton) editline_view.findViewById(R.id.id_media_button);
|
||||
// Load icons from attributes
|
||||
int[] attrs = new int[] { R.attr.attachFileImage, R.attr.upDownImage};
|
||||
TypedArray ta = obtainStyledAttributes(attrs);
|
||||
int[] icons = Themes.getResFromAttr(this, new int[] { R.attr.attachFileImage, R.attr.upDownImage});
|
||||
// Make the icon change between media icon and switch field icon depending on whether editing note type
|
||||
if (editModelMode && allowFieldRemapping()) {
|
||||
// Allow remapping if originally more than two fields
|
||||
mediaButton.setBackgroundResource(ta.getResourceId(1, R.drawable.ic_import_export_black_24dp));
|
||||
mediaButton.setBackgroundResource(icons[1]);
|
||||
setRemapButtonListener(mediaButton, i);
|
||||
} else if (editModelMode && !allowFieldRemapping()) {
|
||||
mediaButton.setBackgroundResource(0);
|
||||
} else {
|
||||
// Use media editor button if not changing note type
|
||||
mediaButton.setBackgroundResource(ta.getResourceId(0, R.drawable.ic_attachment_black_24dp));
|
||||
mediaButton.setBackgroundResource(icons[0]);
|
||||
setMMButtonListener(mediaButton, i);
|
||||
}
|
||||
mFieldsLayoutContainer.addView(label);
|
||||
|
@ -435,7 +435,9 @@ public class Reviewer extends AbstractFlashcardViewer {
|
||||
@Override
|
||||
public boolean onItemClick(View view, int i, IDrawerItem iDrawerItem) {
|
||||
// Tell the browser the current card ID so that it can tell us when we need to reload
|
||||
setCurrentCardId(mCurrentCard.getId());
|
||||
if (mCurrentCard != null) {
|
||||
setCurrentCardId(mCurrentCard.getId());
|
||||
}
|
||||
return super.onItemClick(view, i, iDrawerItem);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/***************************************************************************************
|
||||
* Copyright (c) 2011 Norbert Nagold <norbert.nagold@gmail.com> *
|
||||
* Copyright (c) 2015 Timothy Rae <perceptualchaos2@gmail.com> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify it under *
|
||||
* the terms of the GNU General Public License as published by the Free Software *
|
||||
@ -18,6 +19,8 @@ package com.ichi2.themes;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ichi2.anki.AnkiDroidApp;
|
||||
@ -47,4 +50,36 @@ public class Themes {
|
||||
context.setTheme(R.style.LegacyActionBarWhite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int getResFromAttr(Context context, int resAttr) {
|
||||
int[] attrs = new int[] {resAttr};
|
||||
return getResFromAttr(context, attrs)[0];
|
||||
}
|
||||
|
||||
public static int[] getResFromAttr(Context context, int[] attrs) {
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs);
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
attrs[i] = ta.getResourceId(i, 0);
|
||||
}
|
||||
ta.recycle();
|
||||
return attrs;
|
||||
}
|
||||
|
||||
public static int getColorFromAttr(Context context, int colorAttr) {
|
||||
int[] attrs = new int[] {colorAttr};
|
||||
return getColorFromAttr(context, attrs)[0];
|
||||
}
|
||||
|
||||
|
||||
public static int[] getColorFromAttr(Context context, int[] attrs) {
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs);
|
||||
Resources res = context.getResources();
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
attrs[i] = ta.getColor(i, res.getColor(R.color.white));
|
||||
}
|
||||
ta.recycle();
|
||||
return attrs;
|
||||
}
|
||||
|
||||
}
|
||||
|
BIN
AnkiDroid/src/main/res/drawable-hdpi/ankidroid_txt.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
AnkiDroid/src/main/res/drawable-hdpi/logo_star_144dp.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
AnkiDroid/src/main/res/drawable-mdpi/ankidroid_txt.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
AnkiDroid/src/main/res/drawable-mdpi/logo_star_144dp.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
AnkiDroid/src/main/res/drawable-xhdpi/ankidroid_txt.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
AnkiDroid/src/main/res/drawable-xhdpi/logo_star_144dp.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
AnkiDroid/src/main/res/drawable-xxhdpi/ankidroid_txt.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
AnkiDroid/src/main/res/drawable-xxhdpi/logo_star_144dp.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
AnkiDroid/src/main/res/drawable-xxxhdpi/ankidroid_txt.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
AnkiDroid/src/main/res/drawable-xxxhdpi/logo_star_144dp.png
Normal file
After Width: | Height: | Size: 42 KiB |
15
AnkiDroid/src/main/res/drawable/launch_screen.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
|
||||
<!-- The background color, preferably the same as your normal theme -->
|
||||
<item android:drawable="@color/material_drawer_dark_background"/>
|
||||
<!-- Your product logo - 144dp color version of your app icon -->
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/logo_star_144dp"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
<item android:top="200dp">
|
||||
<bitmap
|
||||
android:src="@drawable/ankidroid_txt"
|
||||
android:gravity="center"/>
|
||||
</item>
|
||||
</layer-list>
|
@ -4,6 +4,9 @@
|
||||
<!-- App themes -->
|
||||
<style name="App_Theme_White" parent="Theme_White"/>
|
||||
<style name="App_Theme_Dark" parent="Theme_Dark"/>
|
||||
<style name="App_Theme_Dark.Launcher">
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
</style>
|
||||
<!-- Theme for crash report dialog -->
|
||||
<style name="Theme.CrashReportDialog" parent="@android:style/Theme.Dialog" />
|
||||
|
||||
|
75
docs/graphics/src/ankidroid_txt.svg
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="162.56mm"
|
||||
height="26.42642mm"
|
||||
viewBox="0 0 575.99999 93.636922"
|
||||
id="svg4228"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="ankidroid-txt.svg">
|
||||
<defs
|
||||
id="defs4230" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="-16.270432"
|
||||
inkscape:cy="257.31758"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata4233">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-243.16964,-822.14882)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:120.9895401px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="242.22441"
|
||||
y="914.07251"
|
||||
id="text4236"
|
||||
sodipodi:linespacing="125%"
|
||||
inkscape:export-xdpi="68.056618"
|
||||
inkscape:export-ydpi="68.056618"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4238"
|
||||
x="242.22441"
|
||||
y="914.07251"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Droid Sans Japanese';-inkscape-font-specification:'Droid Sans Japanese';fill:#ffffff">AnkiDroid</tspan></text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
87
docs/graphics/src/logo_star_144dp.svg
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 576.00001 600.70272"
|
||||
enable-background="new 0 0 192 192"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="logo_star_144dp.svg"
|
||||
width="576"
|
||||
height="600.7027"><metadata
|
||||
id="metadata97"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs95" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview93"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="1.2291667"
|
||||
inkscape:cx="37.799997"
|
||||
inkscape:cy="315.65836"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" /><g
|
||||
id="bottom_x5F_half"
|
||||
display="none"
|
||||
style="display:none"
|
||||
transform="translate(-58.200003,416.84098)"><path
|
||||
display="inline"
|
||||
enable-background="new "
|
||||
d="m 142,91.5 0,69.5 c 0,6.6 -5.4,12 -12,12 l -95.7,0 c -6.6,0 -12,-5.4 -12,-12 l 0,-69.5 119.7,0 z"
|
||||
id="path16"
|
||||
inkscape:connector-curvature="0"
|
||||
style="display:inline;opacity:0.2" /></g><g
|
||||
id="g62"
|
||||
inkscape:export-filename="/home/tim/development/ankidroid-timrae/AnkiDroid/src/main/res/drawable-xxxhdpi/product_logo_144dp.png"
|
||||
inkscape:export-xdpi="416.94742"
|
||||
inkscape:export-ydpi="416.94742"
|
||||
transform="matrix(4.8341729,0,0,4.8341729,-281.34886,-288.1167)"><g
|
||||
id="g64"><path
|
||||
style="fill:#ffffff"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path66"
|
||||
d="m 106.2,59.6 c -1,0 -2.1,0.1 -3.1,0.4 -4.2,1.4 -6.3,5.4 -7.3,9.1 -1,3.7 -1.2,7.8 -1.3,11.9 -0.1,4.1 -0.2,8.3 -0.5,11.7 -0.3,3.4 -1.2,5.9 -1.7,6.6 -0.5,0.7 -2.7,2.3 -5.8,3.6 -3.1,1.4 -7,2.7 -10.9,4.1 -3.9,1.4 -7.7,2.9 -11,4.9 -3.2,2 -6.4,5.2 -6.4,9.7 0,4.5 3.1,7.6 6.4,9.7 3.3,2.1 7,3.5 10.9,5 3.9,1.4 7.8,2.7 10.9,4.1 3.1,1.4 5.3,2.9 5.8,3.6 0.5,0.7 1.3,3.3 1.6,6.7 0.3,3.4 0.4,7.5 0.5,11.7 0.1,4.1 0.4,8.2 1.3,11.9 0.9,3.7 3,7.7 7.2,9.1 4.2,1.4 8.2,-0.6 11.2,-3.1 3,-2.5 5.6,-5.6 8.1,-8.8 2.5,-3.2 5,-6.6 7.3,-9.1 2.3,-2.5 4.4,-4.2 5.3,-4.4 0.8,-0.3 3.5,-0.2 6.8,0.5 3.3,0.7 7.3,2 11.2,3.1 4,1.1 7.9,2.2 11.7,2.4 3.8,0.2 8.2,-0.5 10.9,-4.1 2.6,-3.6 2,-8 0.6,-11.6 -1.4,-3.6 -3.6,-7 -5.9,-10.4 -2.3,-3.4 -4.7,-6.8 -6.4,-9.7 -1.7,-2.9 -2.6,-5.5 -2.6,-6.4 0,-1 1.1,-4 3.3,-7.4 2.1,-3.4 5,-7.3 7.5,-11.1 2,-3 3.7,-6.1 4.8,-9.2 1,-3.2 1.3,-7.1 -1,-10.3 -2.6,-3.6 -7,-4.3 -10.9,-4.1 -3.8,0.2 -7.8,1.3 -11.8,2.4 -4,1.1 -7.9,2.4 -11.2,3.1 -3.3,0.7 -6,0.7 -6.8,0.5 -0.8,-0.2 -3,-1.9 -5.3,-4.4 -2.3,-2.6 -4.7,-5.9 -7.2,-9.2 -2.5,-3.3 -5.1,-6.4 -8.1,-8.9 -2.3,-1.9 -5.1,-3.5 -8.1,-3.6 l 0,0 z" /><g
|
||||
id="inner_11_"><linearGradient
|
||||
gradientTransform="matrix(1,0,0,-1,0,192)"
|
||||
y2="40.880001"
|
||||
x2="170.66859"
|
||||
y1="93.285301"
|
||||
x1="79.900101"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="SVGID_1_"><stop
|
||||
id="stop70"
|
||||
style="stop-color:#29B6F6"
|
||||
offset="0" /><stop
|
||||
id="stop72"
|
||||
style="stop-color:#0288D1"
|
||||
offset="1" /></linearGradient><path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:url(#SVGID_1_)"
|
||||
id="path74"
|
||||
d="m 105.7,68.2 c 0.4,-0.1 1.2,-0.1 3.1,1.5 1.9,1.6 4.3,4.4 6.8,7.5 2.4,3.1 4.9,6.6 7.6,9.5 2.6,3 5.2,5.7 9,6.9 4,1.3 8,0.7 11.4,-0.3 3.9,-0.9 7.9,-2.1 11.7,-3.2 3.8,-1.1 7.4,-2 9.9,-2.1 2.5,-0.2 3.2,0.3 3.4,0.6 0.2,0.3 0.4,0.8 -0.2,2.6 -0.6,1.8 -2,4.5 -3.8,7.2 -2.3,3.5 -5.1,7.4 -7.5,11.2 -2.4,3.8 -4.6,7.5 -4.6,12 0,4 1.8,7.3 3.8,10.7 2,3.4 4.5,6.9 6.7,10.2 2.2,3.3 4.1,6.4 5.1,8.8 0.9,2.3 0.7,3.1 0.5,3.4 -0.2,0.3 -0.9,0.7 -3.4,0.6 -2.5,-0.2 -6.1,-1 -9.9,-2.1 -3.8,-1.1 -7.9,-2.4 -11.7,-3.3 -3.9,-0.9 -7.6,-1.5 -11.4,-0.3 -3.8,1.2 -6.4,3.9 -9,6.9 -2.6,3 -5.2,6.4 -7.6,9.5 -2.4,3.1 -4.9,5.9 -6.8,7.5 -1.9,1.6 -2.7,1.7 -3.1,1.5 -0.4,-0.1 -1,-0.6 -1.6,-3.1 -0.6,-2.5 -0.9,-6.1 -1,-10.1 -0.1,-4 -0.2,-8.2 -0.5,-12.2 -0.4,-4 -0.9,-7.7 -3.2,-10.9 -2.3,-3.2 -5.7,-4.9 -9.3,-6.5 -3.6,-1.6 -7.7,-2.9 -11.4,-4.3 -3.7,-1.4 -7.1,-2.8 -9.3,-4.1 -2.1,-1.4 -2.4,-2.1 -2.4,-2.5 0,-0.4 0.3,-1.1 2.4,-2.4 2.2,-1.4 5.7,-2.9 9.3,-4.1 3.7,-1.4 7.8,-2.7 11.4,-4.3 3.6,-1.6 7,-3.2 9.3,-6.4 2.3,-3.2 2.9,-7 3.3,-10.9 0.4,-3.9 0.4,-8.2 0.6,-12.2 0.1,-4 0.4,-7.6 1.1,-10.1 0.3,-2.1 0.9,-2.6 1.3,-2.7 l 0,0 z" /></g></g></g></svg>
|
After Width: | Height: | Size: 5.2 KiB |