Package openfoodfacts.github.scrachx.openfood.utils

Types

Link copied to clipboard
interface AutoUpdatableAdapter
Link copied to clipboard
object CameraUtils
Link copied to clipboard
interface CoroutineDispatchers
Link copied to clipboard
class CoroutineDispatchersDefaultImpl @Inject constructor : CoroutineDispatchers
Link copied to clipboard
object DeserializerHelper
Link copied to clipboard
class FileDownloader @Inject constructor(    context: Context,     productsAPI: ProductsAPI,     dispatchers: CoroutineDispatchers)

File Downloader class which is used to download a file and write response to the disk.

Link copied to clipboard
class GenericFileProvider : FileProvider

Created by prajwalm on 05/04/18.

Link copied to clipboard
interface INavigationItem
Link copied to clipboard
class InstallationService @Inject constructor(context: Context)
Link copied to clipboard
@Singleton
class LocaleManager @Inject constructor(context: Context, sharedPreferences: SharedPreferences)

This class is used to change your application locale and persist this change for the next time that your app is going to be used.

Link copied to clipboard
object LocaleUtils
Link copied to clipboard
data class Measurement(val value: Float, val unit: MeasurementUnit)
Link copied to clipboard
object MediaTypes
Link copied to clipboard
interface NavigationDrawerListener

Created by Lobster on 06.03.18.

Link copied to clipboard
class OFFDatabaseHelper @JvmOverloads constructor(context: Context, factory: SQLiteDatabase.CursorFactory? = null)
Link copied to clipboard
interface OnKeyboardVisibilityChanged
Link copied to clipboard
@Singleton
class PhotoReceiverHandler @Inject constructor(sharedPreferences: SharedPreferences)

A class for handling photo receiver

Link copied to clipboard
class PreferencesService @Inject constructor(context: Context)
Link copied to clipboard
object ProductFragmentUtils
Link copied to clipboard
sealed class ProductInfoState<out T>

Created by Lobster on 10.03.18.

Link copied to clipboard
class ProductStringConverter constructor : StdConverter<String, String>
Link copied to clipboard
@RequiresApi(value = 24)
class ScanTileService : TileService
Link copied to clipboard
class ScopedExecutor(executor: Executor) : Executor

Wraps an existing executor to provide a .shutdown method that allows subsequent cancellation of submitted runnables.

Link copied to clipboard
Link copied to clipboard
enum SearchType : Enum<SearchType>

Created by Lobster on 10.03.18.

Link copied to clipboard
enum SortType : Enum<SortType>
Link copied to clipboard
enum SupportedLanguages : Enum<SupportedLanguages>
Link copied to clipboard
class SwipeController(context: Context, swipeController: SwipeController.Actions) : ItemTouchHelper.Callback

Created by Mehrosh.Mehboob on 19-Feb-18.

Link copied to clipboard
class SwipeDetector(view: View, swipeEventListener: SwipeDetector.OnSwipeEventListener?) : View.OnTouchListener
Link copied to clipboard
object Utils
Link copied to clipboard
enum ValueState : Enum<ValueState>

Functions

Link copied to clipboard
fun NachoTextView.areChipsDifferent(toCompare: List<String>): Boolean
Link copied to clipboard
fun NachoTextView.areChipsEquals(toCompare: List<String>): Boolean
Link copied to clipboard
inline fun <T, R> AbstractDao<T, R>.build(builderAction: QueryBuilder<T>.() -> Unit): QueryBuilder<T>
Link copied to clipboard
inline fun buildAccountHeader(builder: AccountHeaderBuilder.() -> Unit = {}): AccountHeader
Link copied to clipboard
inline fun buildData(buildAction: Data.Builder.() -> Unit): Data
Link copied to clipboard
inline fun <T, R> AbstractDao<T, R>.buildDelete(builderAction: QueryBuilder<T>.() -> Unit): DeleteQuery<T>
Link copied to clipboard
inline fun buildDrawer(activity: Activity, builderAction: DrawerBuilder.() -> Unit = {}): Drawer
Link copied to clipboard
inline fun OkHttpClient.buildUpon(builderAction: OkHttpClient.Builder.() -> Unit): OkHttpClient
inline fun Request.buildUpon(builderAction: Request.Builder.() -> Unit): Request
Link copied to clipboard
fun Context.clearCameraCache()
Link copied to clipboard
inline fun ClickableSpan(crossinline onClick: (View) -> Unit): ClickableSpan
Link copied to clipboard
inline fun ConnectionSpec(connectionSpec: ConnectionSpec, builderAction: ConnectionSpec.Builder.() -> Unit): ConnectionSpec
Link copied to clipboard
inline fun Constraints(buildAction: Constraints.Builder.() -> Unit): Constraints
Link copied to clipboard
fun Measurement.convertEnergyTo(targetUnit: MeasurementUnit): Measurement
Link copied to clipboard
fun Measurement.convertTo(unit: MeasurementUnit): Measurement
Link copied to clipboard
fun Measurement.convertToGrams(): Measurement

Converts a given measurement to grams.

Link copied to clipboard
fun createNotificationManager(context: Context): NotificationManager
Link copied to clipboard
fun Int.darken(ratio: Float): Int
Link copied to clipboard
fun dividerItem(builderAction: DividerDrawerItem.() -> Unit = {}): DividerDrawerItem
Link copied to clipboard
fun Date.durationToNowFormatted(context: Context): String
Link copied to clipboard
fun Measurement.forPortion(portion: Measurement): Measurement
Link copied to clipboard
fun Context.getAppPreferences(mode: Int = Context.MODE_PRIVATE): SharedPreferences
Link copied to clipboard
fun getAsFloat(number: Any?, defaultValue: Float): Float
fun getAsFloat(    imgDetails: Map<String, *>?,     key: String?,     defaultValue: Float): Float
Link copied to clipboard
fun getAsInt(number: Any?, defaultValue: Int): Int
fun getAsInt(    imgDetails: Map<String, *>?,     key: String?,     defaultValue: Int): Int
Link copied to clipboard
fun Context.getCameraCacheLocation(): File
Link copied to clipboard
fun EditText?.getContent(): String?
Link copied to clipboard
@Contract(pure = true)
fun getCsvFolderName(): String
Link copied to clipboard
fun NutrimentLevel.getDesc(context: Context): String

Returns the description of this NutrimentLevel

Link copied to clipboard
fun NutrimentLevel.getDescRes(): Int
Link copied to clipboard
fun TextView.getDoubleValue(): Double?

fun getDoubleValue(text: String?): Double?

Retrieve the float value from strings like "1.03" or "1,03"

Link copied to clipboard
fun HistoryProduct?.getEcoscoreResource(): Int
fun SearchProduct?.getEcoscoreResource(): Int
Link copied to clipboard
fun TextView.getFloatValue(): Float?

fun getFloatValue(initText: String?): Float?

Retrieve the float value from strings like "> 1.03"

Link copied to clipboard
fun TextView.getFloatValueOr(defaultValue: Float): Float
Link copied to clipboard
fun NutrimentLevel.getImgRes(): Int
Link copied to clipboard
fun Context.getLoginPassword(defValue: String? = null): String?
Link copied to clipboard
fun Context.getLoginPreferences(mode: Int = Context.MODE_PRIVATE): SharedPreferences
Link copied to clipboard
fun Context.getLoginUsername(defValue: String? = null): String?
Link copied to clipboard
fun getNovaGroupExplanation(novaGroup: String, context: Context): String?

Returns the NOVA group explanation given the group

Link copied to clipboard
fun HistoryProduct?.getNovaGroupResource(): Int

fun SearchProduct?.getNovaGroupResource(): Int

Returns the NOVA group graphic asset given the group

Link copied to clipboard
fun HistoryProduct.getNutriScoreResource(vertical: Boolean = false): Int
fun SearchProduct?.getNutriScoreResource(vertical: Boolean = false): Int
Link copied to clipboard
fun SearchProduct.getProductBrandsQuantityDetails(): String
Link copied to clipboard
fun Activity.getProductState(): ProductState?
fun Fragment.getProductState(): ProductState?
Link copied to clipboard
fun Activity.getRootView(): View?
Link copied to clipboard
fun getRoundNumber(value: CharSequence, locale: Locale = Locale.getDefault()): CharSequence

Return a round float value with 2 decimals

fun getRoundNumber(value: Number, locale: Locale = Locale.getDefault()): CharSequence
fun getRoundNumber(measurement: Measurement, locale: Locale = Locale.getDefault()): CharSequence
Link copied to clipboard
fun Fragment.getSendProduct(): SendProduct?
Link copied to clipboard
fun getServingIn(servingSize: String, unit: MeasurementUnit): Measurement?
Link copied to clipboard
fun getServingInL(servingSize: String): Measurement?
Link copied to clipboard
fun getServingInOz(servingSize: String): Measurement?
Link copied to clipboard
fun getUserAgent(): String
fun getUserAgent(type: String): String
Link copied to clipboard
fun Context.getUserSession(): String?
Link copied to clipboard
fun Context.getVersionName(): String
Link copied to clipboard
inline fun <T : View> ViewGroup.getViewsByType(): List<T?>
fun <T : View> ViewGroup.getViewsByType(klass: Class<T>): List<T?>
Link copied to clipboard
fun CustomValidatingEditTextView.hasUnit(): Boolean
Link copied to clipboard
fun Activity.hideKeyboard()
Link copied to clipboard
inline fun HttpLoggingInterceptor(builderAction: HttpLoggingInterceptor.() -> Unit): HttpLoggingInterceptor
Link copied to clipboard
inline fun Intent(builderAction: Intent.() -> Unit): Intent
inline fun <T> Intent(context: Context, builderAction: Intent.() -> Unit = {}): Intent
inline fun Intent(action: String?, builderAction: Intent.() -> Unit): Intent
Link copied to clipboard
fun isAbsoluteUrl(url: String?): Boolean
Link copied to clipboard
fun isApplicationInstalled(context: Context, packageName: String): Boolean

Check if a certain application is installed on a device.

Link copied to clipboard
fun TextView.isBlank(): Boolean
Link copied to clipboard
fun EditText.isContentDifferent(toCompare: String?): Boolean
Link copied to clipboard
fun EditText?.isEmpty(): Boolean

@Contract(pure = true)
fun AbstractDao<*, *>.isEmpty(): Boolean

Checks whether table is empty

Link copied to clipboard
fun Context.isFastAdditionMode(defValue: Boolean = false): Boolean
Link copied to clipboard
fun Context.isHardwareCameraInstalled(): Boolean

fun isHardwareCameraInstalled(context: Context): Boolean

Check if the device has a camera installed.

Link copied to clipboard
fun Context.isImageLoadingDisabled(): Boolean
Link copied to clipboard
fun isLocaleFile(url: String?): Boolean
Link copied to clipboard
fun Context.isNetworkAvailable(): Boolean

Check if the user is connected to a network. This can be any network.

Link copied to clipboard
fun EditText?.isNotEmpty(): Boolean
Link copied to clipboard
fun Product.isPerServingInLiter(): Boolean?
Link copied to clipboard
fun Context.isPowerSaveMode(): Boolean
Link copied to clipboard
fun Context.isUserSet(): Boolean
Link copied to clipboard
fun EditText.isValueDifferent(toCompare: Float?): Boolean
Link copied to clipboard
fun Int.lighten(ratio: Float): Int
Link copied to clipboard
inline fun <T, R> AbstractDao<T, R>.list(builderAction: QueryBuilder<T>.() -> Unit = {}): List<T>
Link copied to clipboard
Link copied to clipboard
@Contract(pure = true)
fun <T : TaxonomyEntity> logDownload(taxonomy: Taxonomy<T>)
Link copied to clipboard
fun measure(value: Float, unit: MeasurementUnit): Measurement
Link copied to clipboard
inline fun OkHttpClient(builderAction: OkHttpClient.Builder.() -> Unit): OkHttpClient
Link copied to clipboard
inline fun <T : ListenableWorker> OneTimeWorkRequest(builderAction: OneTimeWorkRequest.Builder.() -> Unit = {}): OneTimeWorkRequest
Link copied to clipboard
fun parseServing(servingSize: String): Pair<String, MeasurementUnit?>
Link copied to clipboard
inline fun Picasso(context: Context, builderAction: Picasso.Builder.() -> Unit = {}): Picasso
Link copied to clipboard
inline fun primaryItem(builderAction: PrimaryDrawerItem.() -> Unit = {}): PrimaryDrawerItem
Link copied to clipboard
inline fun profileItem(builderAction: ProfileDrawerItem.() -> Unit = {}): ProfileDrawerItem
Link copied to clipboard
inline fun profileSettingItem(builderAction: ProfileSettingDrawerItem.() -> Unit = {}): ProfileSettingDrawerItem
Link copied to clipboard
fun <T : Preference?> PreferenceScreen.requirePreference(key: String): T
fun <T : Preference?> PreferencesFragment.requirePreference(key: String): T
inline fun <T : Preference?> PreferencesFragment.requirePreference(key: String, action: T.() -> Unit)
Link copied to clipboard
fun Activity.requireProductState(): ProductState
fun Fragment.requireProductState(): ProductState
Link copied to clipboard
fun Fragment.requireSendProduct(): SendProduct
Link copied to clipboard
fun Retrofit(builderAction: Retrofit.Builder.() -> Unit): Retrofit
Link copied to clipboard
fun Float.saltToSodium(): Float
fun Measurement.saltToSodium(): Measurement
Link copied to clipboard
inline fun sectionItem(builderAction: SectionDrawerItem.() -> Unit = {}): SectionDrawerItem
Link copied to clipboard
fun Context.setLogin(username: String, password: String)
Link copied to clipboard
fun Context.shouldLoadImages(): Boolean
Link copied to clipboard
fun FragmentManager.showBottomSheet(result: JsonNode?, additive: AdditiveName)
fun showBottomSheet(    result: JsonNode,     category: CategoryName,     fragmentManager: FragmentManager)
fun showBottomSheet(    result: JsonNode?,     allergen: AllergenName,     fragmentManager: FragmentManager)
fun showBottomSheet(    result: JsonNode?,     label: LabelName,     fragmentManager: FragmentManager)
Link copied to clipboard
fun Activity.showKeyboard()
Link copied to clipboard
fun Float.sodiumToSalt(): Float
fun Measurement.sodiumToSalt(): Measurement
Link copied to clipboard
fun Activity.stopListeningToKeyboardVisibilityChanges()
Link copied to clipboard
fun Measurement.toDisplayString(modifier: Modifier? = null): String
Link copied to clipboard
fun Number.toPx(context: Context): Int
Link copied to clipboard
fun <T> Result<T>.toWorkResult(): ListenableWorker.Result
Link copied to clipboard
inline fun <T, R> AbstractDao<T, R>.unique(builderAction: QueryBuilder<T>.() -> Unit): T?
Link copied to clipboard
fun <T> QueryBuilder<T>.whereOr(list: List<WhereCondition>)
Link copied to clipboard
fun writeHistoryToFile(    context: Context,     productList: List<HistoryProduct>,     csvUri: Uri)
Link copied to clipboard
fun writeListToFile(    context: Context,     productList: ProductLists,     csvUri: Uri)

Properties

Link copied to clipboard
val Measurement.grams: Measurement
Link copied to clipboard
const val LOCALE_FILE_SCHEME: String
Link copied to clipboard
val Spinner.modifier: Modifier?
Link copied to clipboard
const val MY_PERMISSIONS_REQUEST_CAMERA: Int = 1
Link copied to clipboard
const val MY_PERMISSIONS_REQUEST_STORAGE: Int = 2