Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.1gravity:android-colorpicker
Advanced tools
The Android Color Picker is a beautifully designed component based on Lars Werkman's color picker: https://github.com/LarsWerkman/HoloColorPicker. Unlike the original it's shown in a dialog box, allows entering an (A)RGB value and includes a color picker Preference. A demo app can be found here: https://play.google.com/store/apps/details?id=com.onegravity.colorpicker.demo.
The color picker allows to:
Add this to your Gradle build file:
dependencies {
compile 'com.1gravity:android-colorpicker:2.2.3'
}
Simply use one of the AppCompat themes (Theme.AppCompat, Theme.AppCompat.Light or one of its derivatives).
To use the color picker as a preference add this to your preferences file:
<com.onegravity.colorpreference.ColorPickerPreference
android:key="my_setting"
android:title="@string/my_setting"
android:summary="@string/my_setting_summary"
alphaSlider="true"
android:defaultValue="@color/default_color_1"/>
The alphaSlider attribute can be used to show/hide the slider for the alpha slider (opacity). The (A)RGB input field will reflect this attribute as well (allow/disallow entering an alpha value).
To use the color picker as a dialog call:
int dialogId = new ColorPickerDialog(this, initialColor, true).show();
ColorPickerListenerEvent.setListener(mDialogId, this);
The first line creates and opens the color picker dialog. The context is used to build the dialog. Make sure it's the the correct context in terms of theming. The initialColor is the initial color to show in the color picker. This is also the color used if the user re-sets the color or cancels the dialog. Set useOpacityBar to True if the user should be able to change the opacity / alpha channel.
The color picker communicates the color changes to its caller through the ColorPickerListener. Instead of simply passing the listener to the ColorPickerDialog constructor (or using a setter method), we use EventBus. Whoever has dealt with dialogs and orientation changes knows the numerous issues especially if you expect some return value from that dialog (a color in this case). Using a unique identifier for the color picker dialog and EventBus allows to re-set the listener after an orientation change very easily. All you need to do is save the unique identifier in onSaveInstanceState and restore it in onCreate (fragments will usually persist the identifier) and call ColorPickerListenerEvent.setListener() again. Please check out the included demo for some sample code.
If you have an issues with this library, please open a issue here: https://github.com/1gravity/Android-ColorPicker/issues and provide enough information to reproduce it reliably. The following information needs to be provided:
Copyright 2022 Emanuel Moecklin
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.
FAQs
Android ColorPicker is a color picker component
We found that com.1gravity:android-colorpicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.