Giter Site home page Giter Site logo

rammadogs / permissions-helper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from minj2me/permissions-helper

0.0 1.0 0.0 4.79 MB

A library that generates an activity based on the required permissions for your app. It loads the permissions into a list and will request them upon continuing through the activity flow.

Home Page: http://andrew-quebe.github.io/Permissions-Helper/

Java 100.00%

permissions-helper's Introduction

Permissions-Helper Download

A library that generates an activity based on the required permissions for your app. It loads the permissions into a list and will request them upon continuing through the activity flow.

Compile in your Project

The library is on jCenter by default. Add this in your app's build.gradle file:

dependencies {
	compile 'com.amqtech:perms-helper:1.0.2'
}

Download the Sample (Optional)

Get it on Google Play

How to Use

To launch the permissions activity, simply write the following code:

// Sample set up that explains to the user that you need access to device location.
new PermissionsActivity(getBaseContext())
	// Your app name. You MUST set this, otherwise bad things will happen!
    .withAppName(getResources().getString(R.string.app_name))
    // The permissions you need
    .withPermissions(new Permission(Permissions.ACCESS_FINE_LOCATION, Permissions.ACCESS_FINE_LOCATION))
    // Callback
    .withPermissionFlowCallback(new PermissionsActivity.PermissionFlowCallback() {
        @Override
        public void onPermissionGranted(Permission permission) {
    		// if the permission was granted
            
        }

        @Override
        public void onPermissionDenied(Permission permission) {
            // if the permission was denied
            
        }
    })
    // Set status bar color
    .setStatusBarColor(Color.parseColor("#ffffff"))
    // Set status bar icon color - true = dark icons; false (default) = light icons
    .isStatusBarLight(true)
    // Set background color
    .setBackgroundColor(Color.parseColor("#ffffff"))
    // Set background color behind the buttons
    .setBarColor(Color.parseColor("#ffffff"))
    // Set main text color 
    .setMainTextColor(Color.parseColor("#444444"))
    // Set bar button text color
    .setBarTextColor(Color.parseColor("#444444"))
    // Set navigation bar color
    .setNavBarColor(Color.parseColor("#ffffff"))
    // Change color of icons - it is advised that this be the same color as your text
    .setIconColor(Color.parseColor("#444444"))
    // Launch the permissions activity
    .launch();

The color methods are optional, and have defaults already set. The withAppName(), withPermissions(), withPermissionsFlowCallback(), and launch() methods are required for the library to work properly. Also, these methods are called only once. You don't need to call withPermissions() for each permission you are requesting, but rather pass all of them in one method call. Refer to the sample app to see how this is done.

Default Explanations

The library comes preloaded with default permission explanations if you wish to use them.

// Example - you don't need a second parameter for using the default explanations.
new Permission(Permissions.ACCESS_FINE_LOCATION)

Java Documentation

If you would like to view the Javadocs for this library, click here.

Developer Info

Andrew Quebe
[email protected]

Contributions

If you'd like to contribute to this library, feel free to make a pull request with your changes.

Contributors

Patrick J - Google+ | Github

Heinrich Reimer - Google+ | Github

Rodrigo Martins - Github

License

Copyright 2016 Andrew Quebe

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.

Apps that use this library

None yet! If you would like your app listed here, please make a new issue with your app's name, Play Store link, and screenshots proving your usage. Please do not post alpha/beta opt-in links.

My Inspiration

I was exploring the Android Auto app when I noticed the way they present required permissions to the user. That got me thinking that I could create a library that does exactly that.

(Google's Version) (My Version)

permissions-helper's People

Contributors

pddstudio avatar janheinrichmerker avatar rammadogs avatar

Watchers

James Cloos avatar

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.