{"id":13498281,"url":"https://github.com/anitaa1990/Optimize","last_synced_at":"2025-03-29T00:34:12.533Z","repository":{"id":117940666,"uuid":"134869503","full_name":"anitaa1990/Optimize","owner":"anitaa1990","description":"Android library for displaying data based on JSON configuration fetched from server. With this library, you can kiss goodbye to string.xml, dimen.xml, arrays.xml. Keep all your string/integer/array config in one file. The library will automatically fetch the data from the url you provide. ","archived":false,"fork":false,"pushed_at":"2019-03-20T11:44:46.000Z","size":297,"stargazers_count":36,"open_issues_count":0,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-26T00:51:20.910Z","etag":null,"topics":["abtesting","android-development","android-library","backend","dimens","httpurlconnection","json","workmanager"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anitaa1990.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-25T14:51:07.000Z","updated_at":"2024-02-16T18:31:02.000Z","dependencies_parsed_at":"2024-01-18T23:04:41.298Z","dependency_job_id":"3e4e2000-e60d-4d4e-837b-21d92db46f4a","html_url":"https://github.com/anitaa1990/Optimize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anitaa1990%2FOptimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anitaa1990%2FOptimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anitaa1990%2FOptimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anitaa1990%2FOptimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anitaa1990","download_url":"https://codeload.github.com/anitaa1990/Optimize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122259,"owners_count":20726822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abtesting","android-development","android-library","backend","dimens","httpurlconnection","json","workmanager"],"created_at":"2024-07-31T21:00:21.338Z","updated_at":"2025-03-29T00:34:12.031Z","avatar_url":"https://github.com/anitaa1990.png","language":"Java","readme":"# Optimize\n\u003cimg src=\"https://img.shields.io/badge/API-14%2B-orange.svg?style=flat\" alt=\"API\" data-canonical-src=\"https://img.shields.io/badge/API-14%2B-orange.svg?style=flat\" style=\"max-width:100%;\"\u003e \u003ca href=\"https://android-arsenal.com/details/1/7135\"\u003e\u003cimg src=\"https://img.shields.io/badge/Android%20Arsenal-Optimize%20SDK-green.svg?style=flat\" alt=\"Android Arsenal\" data-canonical-src=\"https://img.shields.io/badge/Android%20Arsenal-Optimize%20SDK-green.svg?style=flat\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\u003c/br\u003e\nAndroid library for displaying data based on JSON configuration fetched from server.\u003c/br\u003e\u003c/br\u003e \nWith this library, you can kiss goodbye to string.xml, dimen.xml, arrays.xml. Keep all your string/integer/array config in one file. The library will automatically fetch the data from the url you provide. \u003c/br\u003e\u003c/br\u003e \n\n\n\u003cp\u003e\u003ca href=\"https://github.com/anitaa1990/Optimize/blob/master/media/1.png\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/anitaa1990/Optimize/blob/master/media/1.png\" width=\"180\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\n\u003ch2\u003eHow it works?\u003c/h2\u003e\nHave you ever had to work on an app, make it production ready and upload it to PlayStore. Then there comes a tiny modification where you need to change the text in a screen or the color of a button in another screen? Or perhaps we need to change the number of times a certain background task should run? Or maybe change the time a certain task is executed? Or maybe your case is similar to mine and we need to keep the error messages and the default app messages the same as displayed in the web. Or in the ios version of the app. So there is a single file that all 3 systems can reuse. \u003c/br\u003e\nFor example, all my app messages are kept in string.xml file. Suppose they were kept in a json file in the backend.\u003c/br\u003e\nAnd everytime the app is opened the latest data is downloaded and cached locally in the app.\u003c/br\u003e\u003c/br\u003e\n\nFor example, in the sample app, you will see the url that I have given is \u003c/br\u003e\nhttps://s3-ap-southeast-1.amazonaws.com/android-optimize/optimize.json\u003c/br\u003e\nThis is used to fetch my data from the backend asynchrously and cache it in app. \u003c/br\u003e\nEverytime the app is opened the data is fetched and based on the whether the content is changed or not, the data is cached locally.\u003c/br\u003e \nNote: The library is implemented using the \u003ca href=\"https://developer.android.com/topic/libraries/architecture/workmanager\" target=\"_blank\"\u003eWork Manager API\u003c/a\u003e provided by Google.\u003c/br\u003e\n\n\u003ch2\u003eHow to integrate the library in your app?\u003c/h2\u003e\n\n\u003cb\u003eGradle Dependecy\u003c/b\u003e\u003c/br\u003e\n\n```gradle\ndependencies {\n        implementation 'com.an.optimize:optimize:0.1.0'\n}\n```\n\n\u003cb\u003eMaven Dependecy\u003c/b\u003e\u003c/br\u003e\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.an.optimize\u003c/groupId\u003e\n  \u003cartifactId\u003eoptimize\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.0\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n\u003ch2\u003eUsage\u003c/h2\u003e\n\u003cb\u003eStep 1: Add the internet permission in the Android Manifest file\u003c/b\u003e\u003c/br\u003e\n\n```xml\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n```\n\u003c/br\u003e\n\u003cb\u003eStep 2: Add the following code to your Application class or your Main Activity file\u003c/b\u003e\u003c/br\u003e\n\n```java\nOptimize.getInstance().init(getApplicationContext(), \"\u003cAdd the url of the json file\u003e\");\n```\n\u003c/br\u003e\n\u003cb\u003eStep 3: All you have to do now to display a value from the json file is to call the below code\u003c/b\u003e\u003c/br\u003e\n\n```java\nString stringData = Optimize.getInstance().getStringValue(\"\u003cthe name of the param key\u003e\", \"\u003cDefault value to be displayed in case the backend data does not contain this key\u003e\");\n\n//The same can be applied for Integers:\nOptimize.getInstance().getIntegerValue(\"\u003cthe name of the param key\u003e\", \u003cDefault value in case the backend data does not contain this key\u003e);\n\n//The same can be applied for Double:\nDouble doubleData = Optimize.getInstance().getDoubleValue(\"\u003cthe name of the param key\u003e\", 0.00);\n\n//The same can be applied for Boolean:\nBoolean booleanData = Optimize.getInstance().getBooleanValue(\"boolean_data\", false);\n\n//The same can be applied for Number:\nNumber floatData = Optimize.getInstance().getNumberValue(\"float_data\", -1.1);\n\n//The same can be applied for a List:\nList\u003cString\u003e listData = Optimize.getInstance().getList(\"list_data\", Collections.emptyList());\n```\n \n \n And that's it! It's super simple.\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanitaa1990%2FOptimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanitaa1990%2FOptimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanitaa1990%2FOptimize/lists"}