{"id":13498287,"url":"https://github.com/dhruv1110/Android-Shortify","last_synced_at":"2025-03-29T00:34:12.989Z","repository":{"id":89045359,"uuid":"66126423","full_name":"dhruv1110/Android-Shortify","owner":"dhruv1110","description":"An Android library used for making an Android application more faster with less amount of code. Shortify for Android provides basic functionalities of view and resource binding, view customization, JSON parsing, AJAX, various readymade dialogs and much more.","archived":false,"fork":false,"pushed_at":"2017-06-02T00:17:33.000Z","size":111,"stargazers_count":22,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T15:38:35.694Z","etag":null,"topics":["ajax","android","android-development","android-library","android-shortify","dialog","event-handlers","java","json","parse"],"latest_commit_sha":null,"homepage":"https://dhruv1110.github.io/Android-Shortify/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dhruv1110.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-08-20T03:36:35.000Z","updated_at":"2023-11-07T12:43:07.000Z","dependencies_parsed_at":"2023-06-13T16:30:35.853Z","dependency_job_id":null,"html_url":"https://github.com/dhruv1110/Android-Shortify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv1110%2FAndroid-Shortify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv1110%2FAndroid-Shortify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv1110%2FAndroid-Shortify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhruv1110%2FAndroid-Shortify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhruv1110","download_url":"https://codeload.github.com/dhruv1110/Android-Shortify/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":["ajax","android","android-development","android-library","android-shortify","dialog","event-handlers","java","json","parse"],"created_at":"2024-07-31T21:00:21.435Z","updated_at":"2025-03-29T00:34:12.669Z","avatar_url":"https://github.com/dhruv1110.png","language":"Java","readme":"# Shortify for Android\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Shortify%20for%20Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5815) [![API](https://img.shields.io/badge/API-15%2B-orange.svg?style=flat)](https://android-arsenal.com/api?level=15)\n\nShortify is used for minimizing your coding effort in your development environment. It has some builtin method and classes which helps you in creating mostly used element and tasks in Android app.\n## Download\nGrab library via Gradle\n```groovy\ncompile 'net.dhruvpatel:shortify:1.2.4'\n```\nor Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003enet.dhruvpatel\u003c/groupId\u003e\n  \u003cartifactId\u003eshortify\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.4\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Features\n\n- [Binding of views](#binding-of-any-views)\n- [Binding of resources](#binding-of-resources)\n- [Customize views](#customize-views)\n- [Parsing JSON data](#parsing-json-data)\n- [AJAX](#ajax)\n- [Event handlers](#event-handlers)\n- [Dialogs](#dialogs)\n- [Other functions](#other-functions)\n\n## How to use\nInitialize library before using it in `onCreate` method\n```java\n$.init(this);\n```\n\n## Binding of any views\n```java\n// Basic \nEditText editText = (EditText) context.findViewById(R.id.editText1);\ncom.example.view.CustomView customView = (com.example.view.CustomView) context.findViewById(R.id.view);\n\n// Shortify\nEditText editText = $.bind(R.id.editText1);\ncom.example.view.CustomView customView = $.bind(R.id.view);\n```\n\n## Binding of resources\n```java\n// Basic \nString str = getApplicationContext().getString(R.string.app_name);\nDrawable drawable = getApplicationContext().getDrawable(R.drawable.example);\nAnimation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation1);\n\n// Shortify\nString str           = $.bindString(R.string.app_name);\nDrawable drawable    = $.bindDrawable(R.drawable.example);\nAnimation animation  = $.bindAnimation(R.anim.animation1);\n.\n.\n.\n//List of binders\n$.bindString(R.string.example);\n$.bindDimension(R.dimen.example);\n$.bindAnimation(R.anim.example);\n$.bindDrawable(R.drawable.example);\n$.bindColor(R.color.example);\n$.bindInteger(R.integer.example);\n$.bindBoolean(R.bool.example);\n```\n\n## Customize views\n```java\n//Basic\nTextView textView = (TextView) findViewById(R.id.textView);\ntextView.setText(getApplicationContext().getString(R.string.app_name));\ntextView.setTextColor(Color.BLUE);\ntextView.setTextSize(16f);\ntextView.setAllCaps(true);\nLinkify.addLinks(textView, Linkify.ALL);\n\n//Shortify\n$.id(R.id.textView).text(R.string.app_name)\n   .color(Color.BLUE)\n   .size(16)\n   .allcapital()\n   .linkify();\n```\n## Parsing JSON data\nShortify can parse long and complex JSON data in simplest way. You can parse any type of data like `integer`, `long`, `double`, `boolean`, `String`\n```java\nint value = $.getIntFromJSON(path, JSON_STRING);\nString str = $.getStringFromJSON(path, JSON_STRING);\nlong value = $.getLongFromJSON(path, JSON_STRING);\ndouble value = $.getDoubleFromJSON(path, JSON_STRING);;\nboolean value = $.getBooleanFromJSON(path, JSON_STRING);\n```\n\u003e ### Example 1\n\u003e ```json\n\u003e {\n\u003e      \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n\u003e      \"title\": \"Product\",\n\u003e      \"description\": \"A product from Acme's catalog\",\n\u003e      \"type\": \"object\",\n\u003e      \"properties\": {\n\u003e          \"id\": {\n\u003e              \"description\": \"The unique identifier for a product\",\n\u003e              \"type\": \"integer\"\n\u003e          },\n\u003e          \"name\": {\n\u003e              \"description\": \"Name of the product\",\n\u003e              \"type\": \"string\"\n\u003e          },\n\u003e          \"price\": {\n\u003e              \"type\": \"number\",\n\u003e              \"minimum\": 0,\n\u003e              \"exclusiveMinimum\": true\n\u003e          },\n\u003e          \"tags\": {\n\u003e              \"type\": \"array\",\n\u003e              \"items\": {\n\u003e                  \"type\": \"string\"\n\u003e              },\n\u003e              \"minItems\": 1,\n\u003e              \"uniqueItems\": true\n\u003e          }\n\u003e      },\n\u003e      \"required\": [\"id\", \"name\", \"price\"]\n\u003e  }\n\u003e  ```\n\u003e \n\u003e  1. Now suppose we want to get value of `properties \u003e price \u003e minimum`\n\u003e\t\n\u003e    ```java\n\u003e    \n\u003e    int value = $.getStringFromJSON(\"properties.price.minimum\", JSON_STRING);\n\u003e    \n\u003e    ```\n\u003e  2. Suppose we want to get value of `properties \u003e tags \u003e items \u003e type`\n\u003e  \n\u003e    ```java\n\u003e    String value = $.getStringFromJSON(\"properties.tags.items.type\", JSON_STRING);\n\u003e    \n\u003e    ```\n\u003e  3. If we want to get 2nd element of `required` object\n\u003e  \n\u003e    ```java\n\u003e    String value = $.getStringFromJSON(\"required[1]\", JSON_STRING);\n\u003e    \n\u003e    ```\n\u003e  ### Example 2\n\u003e  This example has array of user and no object is assigned to whole array\n\u003e  ```json\n\u003e  [\n\u003e    {\n\u003e      \"name\":{\n\u003e        \"first\": \"first name 1\",\n\u003e        \"last\": \"last name 1\"\n\u003e      },\n\u003e      \"dob\":{\n\u003e        \"month\": \"January\",\n\u003e        \"day\": 1\n\u003e      }\n\u003e    },\n\u003e    {\n\u003e      \"name\":{\n\u003e        \"first\": \"first name 2\",\n\u003e        \"last\": \"last name 2\"\n\u003e      },\n\u003e      \"dob\":{\n\u003e        \"month\": \"May\",\n\u003e        \"day\": 2\n\u003e      }\n\u003e    }\n\u003e  ]\n\u003e  ```\n\u003e  \n\u003e  Now suppose we want to get value of 1st user's first name\n\u003e  ```java\n\u003e  String name = $.getStringFromJSON(\"[0].name.first\", JSON_STRING);\n\u003e  \n\u003e  ```\n\n## AJAX\nShortify enables you to send AJAX request to server via both GET and POST method and it can also retrive response from webpage\n\u003e ### GET method\n\u003e\n\u003e```java\n\u003e$.httpGet(\"http://example.com/rest/api\", new AJAX.AJAXCallback() {\n\u003e    @Override\n\u003e    public void onComplete(String response) {\n\u003e        Log.d(TAG, response);\n\u003e    }\n\u003e});\n\u003e```\n\u003e ### POST method\n\u003e\n\u003e```java\n\u003eHashMap\u003cString, Object\u003e queryStringData = new HashMap\u003c\u003e();\n\u003equeryStringData.put(\"name\",\"Dhruv\");\n\u003equeryStringData.put(\"age\",22);\n\u003equeryStringData.put(\"auth\",true);\n\u003e\n\u003e$.httpPost(\"http://example.com/rest/api\",queryStringData,  new AJAX.AJAXCallback() {\n\u003e    @Override\n\u003e    public void onComplete(String response) {\n\u003e        Log.d(TAG, response);\n\u003e    }\n\u003e});\n\u003e```\n\n## Event handlers\n```java\n//Basic\nButton button = (Button) findViewById(R.id.button);\nbutton.setOnClickListener(new View.OnClickListener() {\n    @Override\n    public void onClick(View view) {\n        ...\n    }\n});\n   \n//Shortify     \n$.id(R.id.button).click(new Task() {\n    @Override\n    public void perform() {\n        ...\n    }\n});\n```\n\n## Dialogs\n```java\n//Simple alert dialog box\n$.alertDialog(\"Title\",\"Description\");\n\n//Generates and shows dialog with OK button with onClick event handlers\n$.confirmDialog(\"Title\", \"Description\", new Click() {\n    @Override\n    public void ok() {\n                \n    }\n});\n\n//Generates and shows dialog with YES and NO button with onClick event handlers\n$.yesNoDialog(\"Title\", \"Description\", new Agree() {\n    @Override\n    public void yes() {\n            \n    }\n\n    @Override\n    public void no() {\n\n    }\n});\n ```\n \n## Other functions\n```java\n//Check, if app is installed or not in device \n$.checkIfAppInstalled(PKG_NAME);\n\n//Open current or any other app page in Play store app\n$.openAppInStore();\n$.openAppInStore(PKG_NAME);\n\n//Showing toast\n$.toast(MESSAGE);\n\n//Get current date and time in any format\n$.time(\"d m y\");\n\n//Check app permission (used for Runntime Permission Model)\n$.checkPermission(PERMISSION_STRING);\n\n//Navigate to any activity with or without passing data\n$.open(Activity.class);\n$.open(Activity.class, bundle);\n```\n\n### Apps using Shortify for Android\n\n| |Apps|\n| :---: | :---: |\n| [![Slefie Flashlight](https://lh3.googleusercontent.com/YP_NG-SSwsJMk8WcGSvqttU-XQvxI73mEcBRjibEkCoO5yOOGghjuLObIUF-4_3VOQ=w96-rw)](https://play.google.com/store/apps/details?id=net.dhruvpatel.selfieflashlight) | [Selfie Flashlight](https://play.google.com/store/apps/details?id=net.dhruvpatel.selfieflashlight) |\n| [![Material Music Player](https://lh3.googleusercontent.com/04srswX9QpZCpqhPJf7G8-Z0lhdmh5Zh1XWXU9rInjcmOQa_U0Am2ci_o8Rzbqw6xp8=w96-rw)](https://play.google.com/store/apps/details?id=net.dhruvpatel.musicplayer) | [Material Music Player](https://play.google.com/store/apps/details?id=net.dhruvpatel.musicplayer) |\n\n[Ping me](mailto:dp270894@gmail.com) for adding your app in this list\n\nThanks for using. if you have any suggestions or bug report please create new issue [here](https://github.com/dhruv1110/Android-Shortify/issues)\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruv1110%2FAndroid-Shortify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhruv1110%2FAndroid-Shortify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhruv1110%2FAndroid-Shortify/lists"}