Git Product home page Git Product logo

holoaccent's Introduction

Description

Android library to customize the Holo theme with a custom accent color. The color can even be set programmatically, allowing the UI to change dynamically.

It currently supports Android 4.0+ projects (minSdkVersion="14"). Each theme defined in the project corresponds to a default android theme:

  • Theme.Holo > Theme.HoloAccent
  • Theme.Holo.Light > Theme.HoloAccent.Light
  • Theme.Holo.Light.DarkActionBar > Theme.HoloAccent.Light.DarkActionBar

There are other ColoredActionBar themes that allow further customization. See the appropriate wiki page for further information.

See the 'Getting Started' section for links to get more information.

Features

  • Change the accent color in one place and apply it everywhere
  • Programmatically override the accent color set in the theme
  • All the UI components from "Holo Colors Generator" supported
  • Themes with different accent colors within the same app
  • Full focused state support (navigate with hardware keys)
  • Colored button styles
  • Overscroll glow color customization
  • Dialog customization with divider color correctly set
  • Switch and SwitchPreference implementation
  • Full right-to-left locale support
  • Themes can be extended to meet your needs

Getting Started

Before starting you can install the sample app from the Play Store to get a quick look at the features.

For details on how to set up the project and technical information, you can visit the wiki page.

License

Copyright 2013 NEGU Soft

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

holoaccent's People

Contributors

blurkidi avatar intrications avatar mariusvolkhart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

holoaccent's Issues

Hard key menu touch feedback

I found no way to customize the blue touch feedback in the menu when it's triggered via the hard menu key. Can this library override it?

MenuItem background selector doesn't have same color

I test this app in 2 devices: Nexus 7 2013 (Android 4.4.2) and Galaxy S3 (Android 4.3.1) and see its MenuItem background is different. I choose theme Light Colored ActionBar Inverse

  • Nexus 7 2013:
    image
  • Galaxy S3:
    image

You will notice in Nexus 7 2013, when selected Dialog Fragment MenuItem, its background turns to green, while in Galaxy S3 is default holo color.

Do you know why?

BTW, do you also notice although I choose Light Colored ActionBar Inverse but it seems MenuItem in Nexus 7 is Dark while in Galaxy S3 is Light theme. Is it expected behavior?

Colors defined as ?attr/accentColor reference aren't overridden by AccentHelper

I've overridden getOverrideAccentColor() and getOverrideAccentColorDark() from AccentActivity and it works great in most cases. However with layout defineded as:

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/accentColorDark"
    android:textColor="?attr/accentColor"
    android:text="someText" />

Color of text and background is the same as color defined in XML. It's not overridden by AccentHelper, so I'm left with my base color.

I was looking into some internals and colors that are defined in XML as ?attr/accentColor are not resolved by AccentHelper/AccentResources. Do you have solution for that? Or maybe there is other way to access accent color from XML?

Support for ActionBarActivity

It would be great if you could add support for ActionBarActivity and FragmentActivity as a lot of apps (including mine) still uses support library. It shouldn't be a big deal, except need of adding dependency to support library.

Android Studio - Layout preview problem

For a fragment layout that contains a ListView, the layout preview in Android Studio doesn't render anything and tells me:

Failed to find style 'listViewStyle' in current theme
(29 similar errors not shown)
Failed to convert ?textColorHighlight into a ColorStateList
(12 similar errors not shown)

I'm not sure if the problem is based in holoaccent or in Android Studio. But before using the library the preview rendered fine. If I switch back my theme to inherit from "android:Theme.Holo.Light", preview rendering is fine again.

Any idea?

crash on Android L

Works fine on 4.4 and crash on Android L

Log:

06-28 16:36:41.816: E/AndroidRuntime(9650): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ha__actionbar_item_background.xml from drawable resource ID #0x7f02003a
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.content.res.Resources.loadDrawableForCookie(Resources.java:2363)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.content.res.Resources.loadDrawable(Resources.java:2265)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.content.res.TypedArray.getDrawable(TypedArray.java:743)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.view.View.(View.java:3693)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.view.ViewGroup.(ViewGroup.java:487)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.widget.LinearLayout.(LinearLayout.java:200)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.widget.LinearLayout.(LinearLayout.java:196)
06-28 16:36:41.816: E/AndroidRuntime(9650): at android.widget.Li
06-28 16:36:41.820: E/ActivityManager(767): Invalid thumbnail dimensions: 768x768

How to use HoloAccent with ActionBarCompat

I want to know how to use HoloAccent with ActionBarCompat (or with ActionBarSherlock - but it's deprecated now, so we're safely to ignore it).

To use HoloAccent, all activities must extent AccentActivity while ActionBarCompat is ActionBarActivity.

I know we can make main activity extends ActionBarActivity, then follow guide in https://github.com/negusoft/holoaccent/wiki/Pro-Tips-&-Tricks to theme this activity. Moreover, an ActionBarActivity activity must have theme Theme.AppCompat.

But do you have any simpler solution to combine HoloAccent with ActionBarCompat?

Typo: Colorede?

In the sample, "Theme & color" has these values which I think it's typo:

  • ColoredeActionBar
  • ColoredeActionBar (Inverse)
  • Light.ColoredeActionBar
  • Light.ColoredeActionBar (Inverse)

Should it be ColoredActionBar instead of ColoredeActionBar (an e character is redundant)?

ClassCastException in themed HandleView

Seems there's some issue with themed text selection handle.

This problem happens on Japanese phones mostly.

java.lang.ClassCastException: android.graphics.drawable.LayerDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
at android.widget.Editor$HandleView.updateDrawable(Editor.java:3148)
at android.widget.Editor$HandleView.<init>(Editor.java:3134)
at android.widget.Editor$InsertionHandleView.<init>(Editor.java:3520)
at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:3796)
at android.widget.Editor$InsertionPointCursorController.show(Editor.java:3771)
at android.widget.Editor.onTouchUpEvent(Editor.java:1669)
at android.widget.TextView.onTouchEvent(TextView.java:7574)
at android.view.View.dispatchTouchEvent(View.java:7134)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1946)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1400)
at android.app.Activity.dispatchTouchEvent(Activity.java:2403)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1894)
at android.view.View.dispatchPointerEvent(View.java:7314)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3291)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3236)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4277)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4256)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4348)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:4903)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
at dalvik.system.NativeStart.main(Native Method)

AccentAlertDialog doesn't work without message

When creating a AccentAlertDialog without a message, the divider does not get painted.

screenshot_2014-07-14-15-12-11

Code causing problem:

AlertDialog dialog = new AccentAlertDialog.Builder(getActivity())
        .setTitle(R.string.prompt_confirm)
        .setPositiveButton(R.string.button_yes_delete, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // Do stuff
            }
        })
        .setNegativeButton(R.string.prompt_no, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // Do stuff
            }
        })
        .show();
new DividerPainter(getActivity()).paint(dialog.getWindow());

The activity is an AccentFragmentActivity as per the Wiki.

Adding a message solves the problem.

Missing styles. Is the correct theme chosen for this layout?

Android Studio can't preview any theme that reference to HoloAccent Theme.

Rendering Problems

Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'textViewStyle' in current theme (16 similar errors not shown)

<style name="Theme.MyTheme" parent="Theme.HoloAccent.Light.DarkActionBar">
</style>

Tab TEXT FIELDS: autocomplete doesn't have visual guide

In HolloAccentSample, tab TEXT FIELDS, guide of autocomplete is not so helpful. Its hint is "autocomplete" but I don't know what kind of autocomplete text is. I must read resource (string.xml > list_items) to know it's autocomplete of number (from one to thirteen).

I think you should change its hint to "autocomplete (number)", or change data of list_items to countries.

BTW, your HoloAccent lib is so great. Just change 1 line of code and my app has new theme. Many thanks.

Assets not generated on L-Preview

I don't think it is an high priority issue, but running an application on a Nexus 5 with Android L-Preview doesn't generate button assets and ActionBar background colors.
Buttons appear like white boxes, ActionBar is black.

Upload to Maven Central

It would be very helpful to have this library mirrored on maven central. With it being open source, Sonatype will even host it for free!

Resources not loaded on some devices

Seen on Galaxy Note (GT-N7000). The resources are not correctly loaded on the MainActivity, although if we start any other activity, they will look correct.
galaxy_not_bug

Any plan to add sliding side menu?

Hi there, quick question : is there any plan of adding the sliding left menu style that we can see more and more everywhere to the App template?

Accent is defaulting to blue.

Hey I'm trying to use HoloAccent and up until a few days ago the accent has been using my custom style, but now it seems to be defaulting to the Android blue.

ColoredActionBar with TitleInverse style

The ColoredActionBar style makes app look great and is really useful when we need to customize app to make it different from default Holo (Dark, Light) theme.

Sometimes I use ColoredActionBar with 'Light' theme to make app looks brighter. However, I also want to keep ActionBar title & subtitle is white instead of dark.

So, could you please add a new theme Light/Dark ColoredActionBar TitleInverse which make title&subtitle text color is the same as current theme?

StackOverflowError in AccentResources.checkInitialized()

I got the following exception on at least three different devices:

Caused by: java.lang.StackOverflowError
at com.negusoft.holoaccent.AccentResources.checkInitialized(AccentResources.java:148)
at com.negusoft.holoaccent.AccentResources.getColor(AccentResources.java:214)
at android.content.res.TypedArray.getThemeColor(TypedArray.java:751)
at android.content.res.TypedArray.getColor(TypedArray.java:319)
at com.negusoft.holoaccent.AccentResources.initPalette(AccentResources.java:179)
at com.negusoft.holoaccent.AccentResources.initialize(AccentResources.java:154)

at com.negusoft.holoaccent.AccentResources.checkInitialized(AccentResources.java:148)
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.