Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: theme support #41

Closed
adrcotfas opened this issue Jul 26, 2018 · 9 comments
Closed

Feature request: theme support #41

adrcotfas opened this issue Jul 26, 2018 · 9 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@adrcotfas
Copy link

adrcotfas commented Jul 26, 2018

Overwriting @style/AttribouterTheme is an option but it has its limitations if you have multiple themes in your app which can be switched.
I tried creating a separate Activity and then attach an About fragment to it which is great because you can switch the theme in onCreate.

        if (savedInstanceState == null) {
            Fragment fragment = Attribouter.from(this).withFile(R.xml.about).toFragment();

            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.replace(R.id.fragment, fragment);
            ft.commitAllowingStateLoss();
        }

Unfortunately the theme is not maintained to a section with overflow "0" which opens a new view.
Is there a solution for this?

@fennifith fennifith added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jul 27, 2018
@fennifith
Copy link
Owner

This is half a bug and half an enhancement idk what to label it

@fennifith
Copy link
Owner

I don't even use labels I shouldn't be thinking about this. Anyway, the theme isn't applied because the "overflow" screens are actually fullscreen dialogs, and I'm not quite sure how I should make them themable. My initial thought is to set the dialog themes as an attribute of the activity theme (possibly two attributes, one for profile dialogs and one for overflows), but idk how easy that would be to implement.

@fennifith fennifith added the enhancement New feature or request label Jul 27, 2018
fennifith added a commit that referenced this issue Aug 7, 2018
@adrcotfas
Copy link
Author

How is this supposed to be used?
I tried modifying the theme inside the sample app and it still uses the AttribouterTheme.

@fennifith
Copy link
Owner

@adrcotfas you can override the AttribouterTheme in your app's styles.xml. That's the method I wrote in the docs, anyway. You could also declare the Attribouter's activity in your manifest, add tools:replace="android:theme", and specify your own resource there.

@adrcotfas
Copy link
Author

I have multiple themes in my app which are changeable with a preference.
Overriding the AttribouterTheme is not an option for me because of this.
About declaring the Attribouter's activity in the manifest, I didn't quite understand if you mean the library's activity or my own about activity.

@fennifith
Copy link
Owner

@adrcotfas I meant the library's activity. If you want to change the theme during runtime, then the easiest option would be to create your own activity for Attribouter, then call setTheme() before adding Attribouter's fragment (obtained from Attribouter.from(context).toFragment()) to your layout.

@adrcotfas
Copy link
Author

adrcotfas commented Aug 14, 2018

create your own activity for Attribouter, then call setTheme() before adding Attribouter's fragment (obtained from Attribouter.from(context).toFragment()) to your layout.

That's exactly what I'm doing. The activity will use my theme but the dialogs will use the default or the overridden theme in this case.

@fennifith
Copy link
Owner

Whoa, I didn't respond to this. Were you able to get it working? I can verify that my suggestion works fine on my end; you can see a working example in Status, which currently has a dark theme in the beta channel.

I may reopen this to improve the functionality, though, as this method of theming is a little finicky. Maybe provide a default light/dark theme, then have two methods such as .withTheme(int) and .withDarkTheme(boolean)? Idk.

@adrcotfas
Copy link
Author

@fennifith No worries but I stopped using this library in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants