Permission


Source link: https://github.com/karanchuri/PermissionManager

PermissionManager

This Library automatically search for permission in androidmanifests file and request for the same. Also, if request is cancelled it shows a popup window with alert to grant permission. If the app can no longer request permission due to "Don't ask again" on permission it will toast a message to grant permission from settings. All the action performed after grant or deny can be customized by overriding method shown below. Custom permission can be checked instead of all permission in androidmanifests file.

Setup: Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {

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

Step 2. Add the dependency

dependencies {

compile 'com.github.karanchuri:PermissionManager:0.1.0' 
}
 

//For Automatic Permission request.

//It Dynamically search for apps permission and request for the same.

//Below code in onCreate function.

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);
  permission=new PermissionManager() {

}
;  permission.checkAndRequestPermissions(this);

  
}
  

//Below code in onRequestPermissionsResult function

@Override
  public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) {

permission.checkResult(requestCode,permissions, grantResults);

  
}
 

//Customized by overriding method shown below.

permission=new PermissionManager() {

 @Override

 public void ifCancelledAndCanRequest(Activity activity) {

  // Do Customized operation if permission is cancelled without checking "Don't ask again"

  // Use super.ifCancelledAndCanRequest(activity);
 or Don't override this method if not in use

 
}

  @Override

 public void ifCancelledAndCannotRequest(Activity activity) {

  // Do Customized operation if permission is cancelled with checking "Don't ask again"

  // Use super.ifCancelledAndCannotRequest(activity);
 or Don't override this method if not in use

 
}

  @Override

 public List<String> setPermission() {

  // If You Don't want to check permission automatically and check your own custom permission

  // Use super.setPermission();
 or Don't override this method if not in use

  List<String> customPermission=new ArrayList<>();

customPermission.add(Manifest.permission.ACCESS_FINE_LOCATION);

  return customPermission;

 
}

}
; 

 //To initiate checking permission 


  permission.checkAndRequestPermissions(this);
 

//To get Granted Permission and Denied Permission

@Override
  public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) {

permission.checkResult(requestCode,permissions, grantResults);

//To get Granted Permission and Denied Permission

ArrayList<String> granted=permission.getStatus().get(0).granted;

ArrayList<String> denied=permission.getStatus().get(0).denied;
  
}
 

Resources

A Simple RxRetrofit Client.

An integration Module for injecting Google Architecture Components' ViewModel into Dagger2-injected Android activities and fragments.

Application to record audio and save it locally in the device. The application also visualizes the audio in wave format. It also supports recording in the background while you can continue using the device for other tasks.

Android gallery & photo/video functionality simplified with RxJava2.

A simple layout for displaying tickets, booking result with qr codes and pnr etc...

This is a indeterminate progress indicator for android that shows a dots bouncing animation for the progress indicator.

The dots are configurable for quantity, colour, size and spacing. There is also a built in show/hide delay feature that solved for the progress indicator flashing issue.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes