System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories
| private val TickerCycleMillis = 150 | |
| private object AlphabetMapper { | |
| private val Alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789•".toList() | |
| val size: Int = Alphabet.size | |
| fun getLetterAt(index: Int): Char = Alphabet[index % size] | |
| fun getIndexOf(letter: Char, offset: Int = 0): TickerIndex { |
| /* | |
| * Copyright (c) 2022. Qamar A. Safadi | |
| */ | |
| package com.qamar.test.base | |
| import android.os.Bundle | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import android.view.WindowManager |
| *****Notes on Testing***** | |
| Why we need it:- | |
| It takes a lot of time and effort to test every functionality in our software manually. And every time we are about to scale our | |
| project we'd have to run our software and test each and every functionality manually to check whether it is still working correctly or not. | |
| To overcome this effort we write Test Cases for our app so that with single click we can check anytime that whether a given piece of code is working correctly or not. | |
| We get JUnit out of the box in our android project to test our code with a single click whenever we want to. | |
| There are basically three types of test cases:- | |
| -> Unit Tests:- |
| public enum MyPermission { | |
| // declare runtime permissions specific to your app here (don't keep unused ones) | |
| READ_PHONE_STATE(Manifest.permission.READ_PHONE_STATE), | |
| FINE_LOCATION(Manifest.permission.ACCESS_FINE_LOCATION); | |
| public static MyPermission fromAndroidPermission(String androidPermission) { | |
| for (MyPermission permission : MyPermission.values()) { | |
| if (permission.getAndroidPermission().equals(androidPermission)) { | |
| return permission; | |
| } |
| data class ErrorResponse( | |
| val status: String, | |
| val code: String, | |
| val message: String | |
| ) |
System directories
| Method | Result |
|---|---|
| Environment.getDataDirectory() | /data |
| Environment.getDownloadCacheDirectory() | /cache |
| Environment.getRootDirectory() | /system |
External storage directories