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

start of new theme

This commit is contained in:
nobnago 2011-12-09 13:42:11 +01:00
parent cc1a1df8cd
commit 6ab67f0a6f
16 changed files with 197 additions and 56 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/flat_wallpaper"
android:tileMode="repeat"/>

View File

@ -114,5 +114,6 @@
<item>Android Dark</item>
<item>Android Light</item>
<item>Blue</item>
<item>Flat</item>
</string-array>
</resources>

View File

@ -124,6 +124,7 @@
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string name="link_anki">http://ankisrs.net</string>
<string name="link_ankidroid">http://code.google.com/p/ankidroid</string>

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Blue Theme -->
<style name="Blue">
<item name="android:background">@color/reviewer_background</item>
</style>
<!-- Button styles -->
<style name="Blue.Button" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/blue_btn_default</item>
</style>
@ -24,9 +22,6 @@
<item name="android:background">@android:drawable/btn_radio</item>
<item name="android:button">?android:attr/listChoiceIndicatorSingle</item>
</style>
<!-- Dialog styles -->
<style name="Blue.AlertDialog">
<item name="android:fullDark">@drawable/blue_popup_full_dark</item>
<item name="android:topDark">@drawable/blue_popup_top_dark</item>
@ -46,48 +41,96 @@
<item name="android:typeface">monospace</item>
<item name="android:textSize">10sp</item>
</style>
<style name="Blue.Edittext" parent="@android:style/Widget.EditText">
<item name="android:background">@drawable/blue_edit_text</item>
</style><!--
<style name="Blue.Widget.ProgressBar" parent="@android:style/Widget.ProgressBar">>
<item name="android:indeterminateDrawable">@drawable/blue_progress_medium_white</item>
</style>
<style name="Blue.Widget.ProgressBar.Small" parent="@android:style/Widget.ProgressBar.Small">
<item name="android:indeterminateDrawable">@drawable/blue_progress_small</item>
</style>
--><style name="Blue.Widget.ListView" parent="@android:Widget.ListView">
<style name="Blue.Widget.ListView" parent="@android:Widget.ListView">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Blue.Widget.ListView.DropDown" parent="@android:Widget.ListView.DropDown">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Blue.Widget.ListView.Menu" parent="@android:Widget.ListView.Menu">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Blue.Widget.Spinner" parent="@android:style/Widget.Spinner">
<item name="android:background">@drawable/blue_btn_dropdown</item>
</style>
<style name="Blue.Widget.DropDownItem.Spinner" parent="@android:style/Widget.DropDownItem.Spinner">
<item name="android:checkMark">@drawable/blue_btn_radio</item>
</style>
<!-- Flat Theme -->
<style name="Flat">
<item name="android:background">@color/reviewer_background</item>
</style>
<style name="Flat.Button" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/blue_btn_default</item>
</style>
<style name="Flat.Button.Small" parent="@android:style/Widget.Button.Small">
<item name="android:background">@drawable/blue_btn_small</item>
</style>
<style name="Flat.Button.Toggle" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/blue_btn_toggle_bg</item>
</style>
<style name="Flat.CompoundButton">
</style>
<style name="Flat.CompoundButton.CheckBox" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/blue_btn_check</item>
</style>
<style name="Flat.CompoundButton.RadioButton">
<item name="android:background">@android:drawable/btn_radio</item>
<item name="android:button">?android:attr/listChoiceIndicatorSingle</item>
</style>
<style name="Flat.AlertDialog">
<item name="android:fullDark">@drawable/blue_popup_full_dark</item>
<item name="android:topDark">@drawable/blue_popup_top_dark</item>
<item name="android:centerDark">@drawable/blue_popup_center_dark</item>
<item name="android:bottomDark">@drawable/blue_popup_bottom_dark</item>
<item name="android:fullBright">@drawable/blue_popup_full_bright</item>
<item name="android:topBright">@drawable/blue_popup_top_bright</item>
<item name="android:centerBright">@drawable/blue_popup_center_bright</item>
<item name="android:bottomBright">@drawable/blue_popup_bottom_bright</item>
<item name="android:bottomMedium">@drawable/blue_popup_bottom_medium</item>
<item name="android:centerMedium">@drawable/blue_popup_center_medium</item>
<item name="android:buttonStyle">@style/Blue.Button</item>
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">10sp</item>
</style>
<style name="Flat.Edittext" parent="@android:style/Widget.EditText">
<item name="android:background">@drawable/blue_edit_text</item>
</style>
<style name="Flat.Widget.ListView" parent="@android:Widget.ListView">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Flat.Widget.ListView.DropDown" parent="@android:Widget.ListView.DropDown">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Flat.Widget.ListView.Menu" parent="@android:Widget.ListView.Menu">
<item name="android:listSelector">@drawable/blue_list_selector_background</item>
</style>
<style name="Flat.Widget.Spinner" parent="@android:style/Widget.Spinner">
<item name="android:background">@drawable/blue_btn_dropdown</item>
</style>
<style name="Flat.Widget.DropDownItem.Spinner" parent="@android:style/Widget.DropDownItem.Spinner">
<item name="android:checkMark">@drawable/blue_btn_radio</item>
</style>
<style name="Flat.Font" parent="@android:style/TextAppearance">
<item name="android:typeface">OpenSans</item>
</style>
<!-- Widget Elements -->
<style name="Widget.ProgressBar.Horizontal" parent="@android:style/Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_horizontal</item>
<item name="android:orientation">vertical</item>
</style>
<style name="Widget.ProgressBar.BigWidget.Horizontal" parent="@android:style/Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_widgetbig_horizontal</item>
<item name="android:orientation">vertical</item>
</style>
</resources>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<!-- Blue Theme -->
<style name="Theme_Blue" parent="@android:Theme.Light">
<!-- Button styles -->
<item name="android:buttonStyle">@style/Blue.Button</item>
<item name="android:buttonStyleSmall">@style/Blue.Button.Small</item>
<item name="android:buttonStyleToggle">@style/Blue.Button.Toggle</item>
<item name="android:checkboxStyle">@style/Blue.CompoundButton.CheckBox</item>
<item name="android:colorForeground">#0000</item>
<item name="android:colorBackground">@color/background_blue</item>
<item name="android:editTextStyle">@style/Blue.Edittext</item>
<item name="android:radioButtonStyle">@style/Blue.CompoundButton.RadioButton</item>
@ -19,38 +19,54 @@
<item name="android:listViewStyle">@style/Blue.Widget.ListView</item>
<item name="android:dropDownListViewStyle">@style/Blue.Widget.ListView.DropDown</item>
<item name="android:listDivider">@drawable/blue_divider_horizontal_bright</item>
<item name="android:listPreferredItemHeight">56dip</item>
<!-- <item name="android:dropdownListPreferredItemHeight">40dip</item> -->
<item name="android:spinnerStyle">@style/Blue.Widget.Spinner</item>
<item name="android:spinnerDropDownItemStyle">@style/Blue.Widget.DropDownItem.Spinner</item>
<item name="listItemBackgroundDrawable">@drawable/blue_list_selector_background</item>
</style>
<!-- Flat Theme -->
<style name="Theme_Flat" parent="@android:Theme.Light">
<item name="android:buttonStyle">@style/Blue.Button</item>
<item name="android:buttonStyleSmall">@style/Blue.Button.Small</item>
<item name="android:buttonStyleToggle">@style/Blue.Button.Toggle</item>
<item name="android:checkboxStyle">@style/Blue.CompoundButton.CheckBox</item>
<item name="android:colorForeground">#0000</item>
<item name="android:colorBackground">@color/background_blue</item>
<item name="android:editTextStyle">@style/Blue.Edittext</item>
<item name="android:radioButtonStyle">@style/Blue.CompoundButton.RadioButton</item>
<!-- Dialog styles -->
<item name="android:alertDialogStyle">@style/Blue.AlertDialog</item>
<item name="android:listChoiceIndicatorSingle">@drawable/blue_btn_radio</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/blue_btn_check</item>
<item name="android:listViewStyle">@style/Blue.Widget.ListView</item>
<item name="android:dropDownListViewStyle">@style/Blue.Widget.ListView.DropDown</item>
<item name="android:listDivider">@drawable/blue_divider_horizontal_bright</item>
<item name="android:listPreferredItemHeight">56dip</item>
<item name="android:spinnerStyle">@style/Blue.Widget.Spinner</item>
<item name="android:spinnerDropDownItemStyle">@style/Blue.Widget.DropDownItem.Spinner</item>
<item name="listItemBackgroundDrawable">@drawable/blue_list_selector_background</item>
</style>
<!-- <item name="android:popupMenuStyle">@style/Blue.Widget.PopupMenu</item>
<item name="android:progressBarStyle">@style/Blue.Widget.ProgressBar</item>
<item name="android:progressBarStyleSmall">@style/Blue.Widget.ProgressBar.Small</item>
<!-- White Theme -->
<style name="Theme_Light" parent="@android:style/Theme.Light">
<item name="listItemBackgroundDrawable">@android:drawable/list_selector_background</item>
</style>
<item name="android:panelBackground">@drawable/blue_menu_background</item>
<item name="android:panelFullBackground">@drawable/blue_menu_background_fill_parent_width</item>-->
</style>
<!-- Black Theme -->
<style name="Theme_Black" parent="@android:style/Theme">
<item name="listItemBackgroundDrawable">@android:drawable/list_selector_background</item>
</style>
<!-- Basic theme for dialogs -->
<style name="StyledDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
</style>
<style name="Theme_Light" parent="@android:style/Theme.Light">
<item name="listItemBackgroundDrawable">@android:drawable/list_selector_background</item>
</style>
<style name="Theme_Black" parent="@android:style/Theme">
<item name="listItemBackgroundDrawable">@android:drawable/list_selector_background</item>
</style>
<!-- Theme for widget dialogs -->
<style name="Theme_Translucent" parent="style/Theme_Blue">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
@ -58,6 +74,6 @@
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>
</style>
</resources>

View File

@ -756,7 +756,7 @@ public class CardEditor extends Activity {
DeckManager.closeDeck(mDeck.getDeckPath(), DeckManager.REQUESTING_ACTIVITY_CARDEDITOR);
finish();
if (mCaller == CALLER_CARDEDITOR_INTENT_ADD || mCaller == CALLER_BIGWIDGET_EDIT || mCaller == CALLER_BIGWIDGET_ADD) {
if (Integer.valueOf(android.os.Build.VERSION.SDK) > 4) {
if (Integer.valueOf(android.os.Build.VERSION.SDK) > 4) {
ActivityTransitionAnimation.slide(CardEditor.this,
ActivityTransitionAnimation.FADE);
}

View File

@ -38,6 +38,7 @@ public class Themes {
public final static int THEME_ANDROID_DARK = 0;
public final static int THEME_ANDROID_LIGHT = 1;
public final static int THEME_BLUE = 2;
public final static int THEME_FLAT = 3;
public final static int THEME_NO_THEME = 100;
public final static int CALLER_STUDYOPTIONS = 1;
@ -105,6 +106,10 @@ public class Themes {
context.setTheme(R.style.Theme_Blue);
Log.i(AnkiDroidApp.TAG, "Set theme: blue");
break;
case THEME_FLAT:
context.setTheme(R.style.Theme_Flat);
Log.i(AnkiDroidApp.TAG, "Set theme: flat");
break;
case -1:
break;
}
@ -112,9 +117,6 @@ public class Themes {
public static void setContentStyle(View view, int caller) {
if (mCurrentTheme == THEME_ANDROID_DARK) {
return;
}
switch (caller) {
case CALLER_STUDYOPTIONS:
((View) view.findViewById(R.id.studyoptions_progressbar1_border)).setBackgroundResource(mProgressbarsFrameColor);
@ -134,24 +136,51 @@ public class Themes {
((View) view.findViewById(R.id.studyoptions_global_bar)).setBackgroundResource(mProgressbarsYoungColor);
break;
case CALLER_DECKPICKER:
if (mCurrentTheme == THEME_BLUE) {
switch (mCurrentTheme) {
case THEME_BLUE:
ListView lv = (ListView) view.findViewById(R.id.files);
lv.setSelector(R.drawable.blue_deckpicker_list_selector);
lv.setDividerHeight(0);
break;
case THEME_FLAT:
ListView lv = (ListView) view.findViewById(R.id.files);
lv.setSelector(R.drawable.blue_deckpicker_list_selector);
lv.setDividerHeight(0);
break;
default:
break;
}
break;
case CALLER_CARDBROWSER:
if (mCurrentTheme == THEME_BLUE) {
switch (mCurrentTheme) {
case THEME_BLUE:
ListView lv = (ListView) view.findViewById(R.id.card_browser_list);
lv.setSelector(R.drawable.blue_cardbrowser_list_selector);
lv.setDividerHeight(0);
break;
case THEME_FLAT:
ListView lv = (ListView) view.findViewById(R.id.card_browser_list);
lv.setSelector(R.drawable.blue_cardbrowser_list_selector);
lv.setDividerHeight(0);
break;
default:
break;
}
break;
case CALLER_CARDEDITOR_INTENTDIALOG:
if (mCurrentTheme == THEME_BLUE) {
switch (mCurrentTheme) {
case THEME_BLUE:
ListView lv = (ListView) view;
lv.setSelector(R.drawable.blue_cardbrowser_list_selector);
lv.setDividerHeight(0);
break;
case THEME_FLAT:
ListView lv = (ListView) view;
lv.setSelector(R.drawable.blue_cardbrowser_list_selector);
lv.setDividerHeight(0);
break;
default:
break;
}
break;
case CALLER_DECKPICKER_DECK:
@ -164,10 +193,21 @@ public class Themes {
}
break;
case CALLER_REVIEWER:
((View)view.findViewById(R.id.main_layout)).setBackgroundResource(mReviewerBackground);
((View)view.findViewById(R.id.flashcard_border)).setBackgroundResource(mFlashcardBorder);
((View)view.findViewById(R.id.flashcard_frame)).setBackgroundResource(PrefSettings.getSharedPrefs(mContext).getBoolean("invertedColors", false) ? (mCurrentTheme == THEME_BLUE ? R.color.reviewer_night_card_background : R.color.black): R.color.white);
((View)view.findViewById(R.id.session_progress)).setBackgroundResource(mReviewerProgressbar);
((View)view.findViewById(R.id.main_layout)).setBackgroundResource(mReviewerBackground);
((View)view.findViewById(R.id.flashcard_border)).setBackgroundResource(mFlashcardBorder);
switch (mCurrentTheme) {
case THEME_ANDROID_DARK:
case THEME_ANDROID_LIGHT:
((View)view.findViewById(R.id.flashcard_frame)).setBackgroundResource(PrefSettings.getSharedPrefs(mContext).getBoolean("invertedColors", false) ? R.color.black : R.color.white);
break;
case THEME_BLUE:
((View)view.findViewById(R.id.flashcard_frame)).setBackgroundResource(PrefSettings.getSharedPrefs(mContext).getBoolean("invertedColors", false) ? R.color.reviewer_night_card_background : R.color.white);
break;
case THEME_FLAT:
((View)view.findViewById(R.id.flashcard_frame)).setBackgroundResource(PrefSettings.getSharedPrefs(mContext).getBoolean("invertedColors", false) ? R.color.reviewer_night_card_background : R.color.white);
break;
}
((View)view.findViewById(R.id.session_progress)).setBackgroundResource(mReviewerProgressbar);
break;
case CALLER_FEEDBACK:
((TextView)view).setTextColor(mProgressbarsFrameColor);
@ -248,7 +288,7 @@ public class Themes {
mPopupFullDark = R.drawable.popup_full_dark;
mDividerHorizontalBright = R.drawable.blue_divider_horizontal_bright;
mBackgroundColor = R.color.white;
break;
break;
case THEME_BLUE:
mProgressbarsBackgroundColor = R.color.studyoptions_progressbar_background_blue;
mProgressbarsFrameColor = R.color.studyoptions_progressbar_frame_light;
@ -282,6 +322,39 @@ public class Themes {
mPopupFullDark = R.drawable.blue_popup_full_dark;
mDividerHorizontalBright = R.drawable.blue_divider_horizontal_bright;
break;
case THEME_FLAT:
mProgressbarsBackgroundColor = R.color.studyoptions_progressbar_background_blue;
mProgressbarsFrameColor = R.color.studyoptions_progressbar_frame_light;
mProgressbarsMatureColor = R.color.studyoptions_progressbar_mature_light;
mProgressbarsYoungColor = R.color.studyoptions_progressbar_young_blue;
mProgressbarsDeckpickerYoungColor = R.color.deckpicker_progressbar_young_light;
mReviewerBackground = R.color.reviewer_background;
mFlashcardBorder = R.drawable.blue_bg_webview;
mDeckpickerItemBorder = R.drawable.blue_bg_deckpicker;
mTitleStyle = R.drawable.flat_title;
mTextViewStyle = R.drawable.blue_textview;
mWallpaper = R.drawable.flat_background;
mBackgroundColor = R.color.background_blue;
mToastBackground = R.drawable.blue_toast_frame;
mDialogBackgroundColor = R.color.background_dialog_blue;
mBackgroundDarkColor = R.color.background_dark_blue;
mReviewerProgressbar = R.color.reviewer_progressbar_session_blue;
mCardbrowserItemBorder = new int[] {R.drawable.blue_bg_cardbrowser, R.drawable.blue_bg_cardbrowser_marked, R.drawable.blue_bg_cardbrowser_suspended, R.drawable.blue_bg_cardbrowser_marked_suspended};
mChartColors = new int[] {Color.BLACK, Color.WHITE};
mPopupTopDark = R.drawable.blue_popup_top_dark;
mPopupTopBright = R.drawable.blue_popup_top_bright;
mPopupTopMedium = R.drawable.blue_popup_top_medium;
mPopupCenterDark = R.drawable.blue_popup_center_dark;
mPopupCenterBright = R.drawable.blue_popup_center_bright;
mPopupCenterMedium = R.drawable.blue_popup_center_medium;
mPopupBottomDark = R.drawable.blue_popup_bottom_dark;
mPopupBottomBright = R.drawable.blue_popup_bottom_bright;
mPopupBottomMedium = R.drawable.blue_popup_bottom_medium;
mPopupFullBright = R.drawable.blue_popup_full_bright;
mPopupFullMedium = R.drawable.blue_popup_full_medium;
mPopupFullDark = R.drawable.blue_popup_full_dark;
mDividerHorizontalBright = R.drawable.blue_divider_horizontal_bright;
break;
}
}
@ -500,6 +573,8 @@ public class Themes {
switch (mCurrentTheme) {
case THEME_BLUE:
return context.getResources().getColor(R.color.reviewer_night_card_background);
case THEME_FLAT:
return context.getResources().getColor(R.color.reviewer_night_card_background);
default:
return Color.BLACK;
}