Giter Club home page Giter Club logo

androidessentials's Introduction

AndroidEssentials

AndroidEssentials is an android library that creates helper functions for performing common tasks in Android such as managing preferences, managing files, showing alerts, showing toasts, checking user country & checking network connection of users. All the methods of the class are static and should be accessed directly from the AndroidEssentials class.

Language

Kotlin

Installation

Gradle

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
 	repositories {
 		...
 		maven { url 'https://jitpack.io' }
 	}
 }

NB As of gradle 7.x.x allprojects has been depreciated in favor of Dependency Resolution Management. Go to settings.gradle and add the jitpack.io repository

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
      google()
      mavenCentral()
     
      // e.g this is how you would add jitpack
      maven { url "https://jitpack.io" }
      
  }
}
  1. Add the dependency
dependencies {
         implementation 'com.github.IsaacSichangi:AndroidEssentials:v1.0.1'
 }

Maven

  1. Add the JitPack repository to your build file
<repositories>
 	<repository>
 	    <id>jitpack.io</id>
 	    <url>https://jitpack.io</url>
 	</repository>
 </repositories>
  1. Add the dependency
<dependency>
      <groupId>com.github.IsaacSichangi</groupId>
      <artifactId>AndroidEssentials</artifactId>
      <version>v1.0.1</version>
  </dependency>

Preferences

AndroidEssentials.storeValueString(context: Context, key: String?, value: String?, app_name: String)

AndroidEssentials.storeValueDouble(context: Context, key: String?, value: Double, app_name: String)

AndroidEssentials.storeValueInt(context: Context, key: String?, value: Int, app_name: String)

AndroidEssentials.storeValueLong(context: Context, key: String?, value: Long, app_name: String)

AndroidEssentials.storeValueBoolean(context: Context, key: String?, value: Boolean, app_name: String)

AndroidEssentials.getValueBoolean(context: Context, key: String?, app_name: String):Boolean

AndroidEssentials.getValueInt(context: Context, key: String?, app_name: String):Int

AndroidEssentials.getValueDouble(context: Context, key: String?, app_name: String):Double

AndroidEssentials.getValueLong(context: Context, key: String?, app_name: String):Long

AndroidEssentials.getValueString(context: Context, key: String?, app_name: String):String

AndroidEssentials.clearValues(context: Context, app_name: String)

AndroidEssentials.deleteValue(context: Context, key: String?, app_name: String) 
      

File Management

AndroidEssentials.checkFileExistence(context: Context, filename: String):Boolean
       
AndroidEssentials.storeFile(title: String, contents: String?, context: Context):Boolean
       
AndroidEssentials.getFileContents(filename: String, context: Context):String

AndroidEssentials.deleteFile(title: String, context: Context)

Get User Country Code

AndroidEssentials.getUserCountry(context: Context):String

Check Network Connection

AndroidEssentials.checkConnection(context: Context): Boolean 

Device Details

AndroidEssentials.getDeviceAndroidVersion():String
AndroidEssentials.getDeviceBrand():String
AndroidEssentials.getDeviceModel():String
AndroidEssentials.getDeviceManufucturer():String

Show Alert & Toast

AndroidEssentials.showToast(context: Context?, message: String?)
  
AndroidEssentials.showAlert(activity: AppCompatActivity, message: String?)

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.