From 0a294ce29849c55a714ee4d9859942156e737beb Mon Sep 17 00:00:00 2001
From: Abdel Wadoud <88406384+rasmi-aw@users.noreply.github.com>
Date: Fri, 5 Aug 2022 21:46:21 +0200
Subject: [PATCH] Update README.md
---
README.md | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 60b9a24..0471fc0 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
# Localisation-lib
-A java application to add localisation to your apps
-
-Localisation is an open sour java Library, it's used to add localisation layer to your java apps, till now it contains, Countries,States and cities, later we will add languages separately.
+Localisation is an open source java Library, it's used to add localisation layer to your java apps, till now it contains, Countries,States and cities, later we will add languages separately.
**Note**: This library executes an **http request** to fetch the needed data.
@@ -14,28 +12,31 @@ This library can be used in many different ways, all versions are published on M
com.beastwall
localisation
- 1.0.1
+ 1.0.2
```
## 1.2 Gradle
```gradle
-implementation 'com.beastwall:localisation:1.0.1'
+implementation 'com.beastwall:localisation:1.0.2'
```
## 1.3 Other methods
For other usages (gradle kotlin, scala etc...), see the link below
-https://search.maven.org/artifact/com.beastwall/localisation/1.0.1/jar
+https://search.maven.org/artifact/com.beastwall/localisation/1.0.2/jar
# 2- How to use it ?
Till now, the only way to use this library is as follows:
+
+## Getting all countries
```java
// Fetch all countries with their cities and states
List countries = Localisation.getAllCountriesStatesAndCities();
```
+## Getting states
You might want to get states for a specific Country:
```java
@@ -46,7 +47,7 @@ You might want to get states for a specific Country:
}
```
-
+## Getting cities
You might want to get cities for a specific state:
```java
//Get cities for a state
@@ -56,6 +57,22 @@ You might want to get cities for a specific state:
```
+## Getting country flag
+In some cases you might want to display a specific country flag, and **getCountryFlagSVG(...)** method returns a byte array of a flag than can be saved as an SVG file, since it was an svg file before fetching it.
+
+To get a country flag, all you need to do is to specify it's code for examle **Algeria** => **dz**, and the format of the flag, whether it's a **RECTANGLE**, or a **SQUARE**.
+
+```java
+//Get countries Svg square flags
+for (Country c : countries) {
+ byte[] countryFlag = Localisation.getCountryFlagSVG(c.getIso2(), Form.SQUARE);
+ //Do something like saving the file
+}
+
+//Get Algeria's square flag with code "dz"
+byte[] dz = Localisation.getCountryFlagSVG("dz", Form.RECTANGLE);
+```
+
# Android
As you all know, Google has removed HttpClient java class from Android Sdk, and since this library uses **HttpClient**, there's a solution which is telling the system that we still want to use HttpClient, by adding the next line in your gradle file.
@@ -67,3 +84,7 @@ useLibrary 'org.apache.http.legacy'
}
```
+for more information check this response:
+https://stackoverflow.com/questions/49644066/what-are-the-implications-of-the-removal-of-httpclient-in-android-m
+
+