ICP 4 - Gnkhakimova/CS5551 GitHub Wiki

ICP 4

Mobile application development

Source Code

Objectives

Mobile application which translated input text into selected language using Yandex API. Application has login page and home page. Home page has field where user can input text which needs to be translated. Also there are two spinners(selectors) from where user can select input language and select language to which text needs to be translated.

Steps

Login Page
On the login page user needs to enter correct username and password in order to log into application. If username or password is incorrect warring text will be displayed saying that credentials are not valid.

HomePage
Home page has a text field where user can type in text which needs to be translated also user can pick from and to which language input needs to be translated. Following page also has Logout button which takes us back to login page.

Code behind
Login Page validates username and password, if credentials are correct user is redirected to home page. Otherwise text is shown saying that username or password is incorrect.

Yandex API was used to translate the text. First I had generate spinner which has available languages: in order to do so I made an API call to Yandex API to get all available languages using GetLangugaes() function. Then I parsed through response and entered values into HashMap - which had language name and language code. Created Adapted with those languages which is used for two spinners.

When languages are selected from spinner language code is selected from Hashmap in order to make another api call to translate the text, which is done by using translateText() function. When logout button is clicked user is redirected to login page using intent.

Video

Presented ICP in class.