Giter VIP home page Giter VIP logo

consentdialog's Introduction

ConsentDialog

A Fully Customisable, Simple and Easy to use Library for Custom Consent Form.Looks alike Admob Consent Form and Does everything we want.This Library is for those who have more than 12 adproviders in admob..However can be used for universal AdNetworks.

MainLayout-Shown Immediately after Calling show Shown When users click on LearnHow in mainLayout Shown When Users Clicks on NonPersonalisedButton

Features

  • Fully Customisable (Colours Customisation will be added in future)
  • Google AdMob ConsentForm look Alike.
  • Simple Fast and Easy to use
  • Behaviour Similar to Admob Consent Form

How To Use

AdProviders Class Contains 3 childs.Create an arrayList of adProviders.We need to show list of adProviders and their privayPolicy to the end user..So we get list of adProviders from the respective adNetworks and add it to the AdProviders ArrayList

   ArrayList<AdProviders> adProviders = new ArrayList();
   
   adProviders.add(new AdProviders(id,name,privacyUrl))

   //Here id,name and privacyUrl are strings

NextCreate dialog as it is

   //Pass the adProviders arraylist in the constructor
   
   ConsentDialog consentDialog = new ConsentDialog.Builder(this,adProviders)
               .withSelectionListeners(new ConsentSelectionListener() {
                   @Override
                   public void onPersonalisedAdsSelected() {
                     //Called when user clicks on Choose Personalised Button
                   }

                   @Override
                   public void onNonPersonalisedAdsSelected() {
                     //WHen clicks agree on NonPersonalisedPage
                   }

                   @Override
                   public void onPaidServiceSelected() {
                       //WHen user clicks paidButton
                   }
               })
               .appName("AppName")
               .icon(getResources().getDrawable(R.mipmap.ic_launcher))
               .privacyUrl("https://saiakhil.com")
               
          //Choose the Buttons u want
          
               .withPaidOption()
               .withPersonalisedAdsOption()
               .withNonPersonalisedAdsOption()
               
          //Set if u want privacyPolicyClickListener
               .withPrivacyPolicyClickListener(new ConsentDialog.Builder.PrivacyPolicyClickListener() {
                   @Override
                   public void onPrivacyPolicyClicked(String privacyUrl) {
                                        
                   }
               })   
               
          //Build     
          
               .build();

       //Show Consent Dialog
       consentDialog.show();



Texts can be customised Completely


   
   ConsentDialog consentDialog = new ConsentDialog.Builder(this,adProviders)
               .withSelectionListeners(new ConsentSelectionListener() {
                   @Override
                   public void onPersonalisedAdsSelected() {
                     //Called when user clicks on Choose Personalised Button
                   }

                   @Override
                   public void onNonPersonalisedAdsSelected() {
                     //WHen clicks agree on NonPersonalisedPage
                   }

                   @Override
                   public void onPaidServiceSelected() {
                       //WHen user clicks paidButton
                   }
               })
               .appName("AppName")
               .icon(getResources().getDrawable(R.mipmap.ic_launcher))
               .privacyUrl("https://saiakhil.com")
               
          //Choose the Buttons u want
          
               .withPaidOption()
               .withPersonalisedAdsOption()
               .withNonPersonalisedAdsOption()
               
          //Customise Texts
               .agreeButtonText("Agree")
               .backButtonText("Back")
               .mainLabelText("We collect etc etc")
               .mainPageExplanationAndLearnHowLabel("Ex","LearnHow")
               
          //Build     
          
               .build();

       //Show Consent Dialog
       consentDialog.show();

Note

  • Set .appName() and .icon() compulsory.

  • Set Required Button..If u dont set Dialog wont show any ..Set Buttons in this way .withPersonalisedAdsOption().

  • Set PrivacyClickListener if required -- .withPrivacyPolicyListener(PrivacyPolicyListener).

Installation

Add Jitpack to ur Project build.gradle

   repositories {
       maven { url 'https://jitpack.io' }
   }

Add ConsentDialog to ur app Build.gradle

   implementation 'com.github.saiakhil90:ConsentDialog:v(LatestRelease)'

Credits

This project was initiated by SaiAkhil V(IGCORPORATION.IN). You can contribute to this project by submitting issues or/and by forking this repo and sending a pull request.

Follow us on:

Twitter

Hire Me On:

Upwork

Author: SaiAkhil

License

    Copyright (C) 2018  VENKATA SAI AKHIL KUMAR VEMULA (IGCORPORATION.IN)

    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.

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.