{"id":13643560,"url":"https://github.com/52inc/Scoops","last_synced_at":"2025-04-21T02:30:34.237Z","repository":{"id":57716412,"uuid":"60648874","full_name":"52inc/Scoops","owner":"52inc","description":"Android library for managing and applying multiple themes and custom theme modification","archived":false,"fork":false,"pushed_at":"2017-10-18T09:04:48.000Z","size":346,"stargazers_count":793,"open_issues_count":7,"forks_count":101,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-04T12:52:07.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/52inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-07T21:50:06.000Z","updated_at":"2024-12-10T11:30:16.000Z","dependencies_parsed_at":"2022-08-26T09:30:31.616Z","dependency_job_id":null,"html_url":"https://github.com/52inc/Scoops","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52inc%2FScoops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52inc%2FScoops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52inc%2FScoops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/52inc%2FScoops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/52inc","download_url":"https://codeload.github.com/52inc/Scoops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249986022,"owners_count":21356310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:49.280Z","updated_at":"2025-04-21T02:30:33.643Z","avatar_url":"https://github.com/52inc.png","language":"Java","readme":"\u003cimg src=\"art/web_hi_res_512.png\" width=\"190\" align=\"right\" hspace=\"20\" /\u003e\n\nScoops\n======\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.52inc/scoops/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.52inc/scoops) [![Build Status](https://travis-ci.org/52inc/Scoops.svg?branch=master)](https://travis-ci.org/52inc/Scoops)\n\nAndroid library for managing and applying multiple defined `R.style.Theme....` themes at runtime for dyanically changing the look and feel of your application\n\n---\n## Demo\n\n![demo gif](http://i.imgur.com/5SqjbhL.gif) ![demo gif 2](http://i.imgur.com/WPTjYUP.gif)\n\n--- \n## Installation\n\nAdd this line to your gradle/dependencies group:\n\n```groovy\ncompile 'com.52inc:scoops:1.0.0'\n```\n\nThen you will need to initialize the singleton in your `Application` subclass like this:\n\n```java\nScoop.waffleCone()\n        .addFlavor(\"Default\", R.style.Theme_Scoop, true)\n        .addFlavor(\"Light\", R.style.Theme_Scoop_Light)\n        .addDayNightFlavor(\"DayNight\", R.style.Theme_Scoop_DayNight)\n        .addFlavor(\"Alternate 1\", R.style.Theme_Scoop_Alt1)\n        .addFlavor(\"Alternate 2\", R.style.Theme_Scoop_Alt2, R.style.Theme_Scoop_Al2_Dialog)\n        .setSharedPreferences(PreferenceManager.getDefaultSharedPreferences(this))\n        .initialize();\n```\n\n## Use \n\nBasic usage is to call the `.apply(...)` method in your activities before you call `setContentView(R.layout.some_layout)` like this:\n\n```java\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    // Apply Scoop to the activity\n    Scoop.getInstance().apply(this);\n\n    // Set the activity content\n    setContentView(R.layout.activity_main);\n\n    ...\n}\n```\n\nYou can also use `.applyDialog(...)` to apply the specified dialog theme resource to an activity (to make an activity appear as a dialog with the correct theme)\n\n### Advanced Use\n\nThere are a few custom attributes you can use to make sure your application has the correct styling when switching themes. These are:\n\n```xml\n\u003cattr name=\"toolbarTheme\" format=\"reference\" /\u003e\n\u003cattr name=\"toolbarPopupTheme\" format=\"reference\" /\u003e\n\u003cattr name=\"toolbarItemTint\" format=\"reference|color\" /\u003e\n```\n\nThen in your layouts, apply the toolbar themes like so:\n\n```xml\n\u003candroid.support.v7.widget.Toolbar\n        ...\n        \n        android:theme=\"?attr/toolbarTheme\"\n        app:popupTheme=\"?attr/toolbarPopupTheme\"\n        \n        /\u003e\n```\n\nThen define the attribute in your themes like this:\n\n\n```xml\n\u003cstyle name=\"Theme.Scoop\" parent=\"Theme.AppCompat.NoActionBar\"\u003e\n\t...\n    \u003citem name=\"toolbarTheme\"\u003e@style/ThemeOverlay.AppCompat.Dark.ActionBar\u003c/item\u003e\n    \u003citem name=\"toolbarPopupTheme\"\u003e@style/ThemeOverlay.AppCompat.Light\u003c/item\u003e\n    \u003citem name=\"toolbarItemTint\"\u003e#fff\u003c/item\u003e\n\u003c/style\u003e\n```\n\nYou can also apply the `toolbarItemTint` color to all the icons in the toolbar by calling `.apply(Context, Menu)` \n\n\t\n### Settings Menu\n\nThis library provides a built in theme chooser settings screen to use called `ScoopSettingsActivity` that you can use by utilizing one of it's static Intent factories:\n\n```java\nScoopSettingsActivity.createIntent(Context);\nScoopSettingsActivity.createIntent(Context, R.string.some_title_to_use);\nScoopSettingsActivity.createIntent(Context, \"Some title to use\");\n```\n\n# Dynamic color property changing\n\nThis is the ability to have a view or attribute update it's color (background, src, text, etc) whenever the user/developer chnages the color for a defined property, or `Topping`. Please refer to [Sample App](https://github.com/52inc/Scoops/tree/feature-dynamic-color-attr/app/src/main/java/com/ftinc/themeenginetest) for actual code references.\n\n## Installation\n\n```groovy\nbuildscript {\n    repositories {\n       jcenter()\n    }\n    dependencies {\n\t \t...\n    \tclasspath 'com.neenbedankt.gradle.plugins:android-apt:1.8'\n    }\n}\n```\n\n```groovy\ncompile 'com.52inc:scoops:1.0.0'\napt 'com.52inc:scoops-compiler:1.0.0'\n```\n\n## Manual Implementation  \n_This does not require the compiler dependency to use._\n\n```java\nToolbar mAppBar;\n\n@Override\npublic void onCreate(Bundle savedInstanceState){\n\tsuper.onCreate(savedInstanceState);\n\tsetContentView(R.layout.some_layout);\n\t\n\tScoop.getInstance().bind(this, Toppings.PRIMARY, mAppBar)\n\t\t\t\t\t .bindStatusBar(this, Toppings.PRIMARY_DARK);\n}\n\n@Override\npublic void onDestroy(){\n\tsuper.onDestroy();\n\tScoop.getInstance().unbind(this);\n}\t\n\nvoid onSomeEvent(){\n\tScoop.getInstance().update(Toppings.PRIMARY, someColorInt) \n \t\t\t\t\t .update(Toppings.PRIMARY_DARK, someDarkColorInt);\n}\n\n```\n\n## Annotated Implementation\nThere are two annotations to use to binding views and the like to color properties that can be dynamically updated (i.e. palette, etc) which are `@BindTopping()` and `@BindToppingStatus()`.\n\n### `@BindTopping()`\nThis annotation is for binding View's to certain color properties, aka `Topping`, so that when you later update that color property say after running Palette on an image, or for whatever reason, the view you binded will be automatically updated. The topping Id is the value required for the annotation but you can optionally define a `ColorAdapter` (Used to determine how the color change is applied to your View) you want to use and an `Interpolator` to customize the color change animation.\n\n### `@BindToppingStatus()`\nThis annotation is used to bind an Activities status bar color to a color property so you can dynamically change the color the window's status bar. Like `@BindTopping()` you can also define an `Interpolator` to use in the animation, however a `ColorAdapter` is not an option here since there is only one way to apply color to a status bar.\n\n### Example\n\n```java\n@BindToppingStatus(Toppings.PRIMARY_DARK)\npublic class MainActivity extends AppCompatActivity {\n\n    @BindTopping(Toppings.PRIMARY)\n    @BindView(R.id.appbar)\n    Toolbar mAppBar;\n\n    @BindTopping(\n            value = Toppings.ACCENT,\n            adapter = FABColorAdapter.class,\n            interpolator = AccelerateInterpolator.class\n    )\n    @BindView(R.id.fab)\n    FloatingActionButton mFab;\n    \n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        // Bind ButterKnife\n        ButterKnife.bind(this);\n\n        // Bind Scoops\n        Scoop.getInstance().bind(this);\n\t\t\n\t\t...\n    }\n\n    @Override\n    protected void onDestroy() {\n        Scoop.getInstance().unbind(this);\n        super.onDestroy();\n    }\n}\n```\n\n## Snapshot\n\n```groovy\nallprojects {\n    repositories {\n        jcenter()\n        maven { url \"https://oss.sonatype.org/content/repositories/snapshots/\" }\n    }\n}\n```\n\n```groovy\ncompile 'com.52inc:scoops:1.0.1-SNAPSHOT`\napt `com.52inc:scoops-compiler:1.0.1-SNAPSHOT`\n```\n\n\n## License\n\n\tCopyright (c) 2016 52inc\n\n\tLicensed under the Apache License, Version 2.0 (the \"License\");\n\tyou may not use this file except in compliance with the License.\n\tYou may obtain a copy of the License at\n\n\t\thttp://www.apache.org/licenses/LICENSE-2.0\n\n\tUnless required by applicable law or agreed to in writing,\n\tsoftware distributed under the License is distributed on an\n\t\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n\teither express or implied. See the License for the specific\n\tlanguage governing permissions and limitations under the License.\n\n","funding_links":[],"categories":["主题样式"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F52inc%2FScoops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F52inc%2FScoops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F52inc%2FScoops/lists"}