Initial commit

This commit is contained in:
2019-02-23 14:08:10 +11:00
commit c1dc1ee96e
53 changed files with 2027 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

30
app/build.gradle Normal file
View File

@@ -0,0 +1,30 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.appttude.h_mal.easycc"
minSdkVersion 16
targetSdkVersion 26
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

25
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\HAIMALIK\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

BIN
app/release/app-release.apk Normal file

Binary file not shown.

1
app/release/output.json Normal file
View File

@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

@@ -0,0 +1,26 @@
package com.appttude.h_mal.easycc;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static junit.framework.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.appttude.h_mal.easycc", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appttude.h_mal.easycc">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.appttude.h_mal.easycc.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.appttude.h_mal.easycc.CurrencyAppWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/currency_app_widget_info" />
</receiver>
<activity android:name="com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,159 @@
package com.appttude.h_mal.easycc;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.util.Log;
import android.widget.RemoteViews;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URL;
import static com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity.loadTitlePref;
import static com.appttude.h_mal.easycc.PublicMethods.UriBuilder;
import static com.appttude.h_mal.easycc.PublicMethods.createUrl;
import static com.appttude.h_mal.easycc.PublicMethods.makeHttpRequest;
import static com.appttude.h_mal.easycc.PublicMethods.round;
/**
* Implementation of App Widget functionality.
* App Widget Configuration implemented in {@link CurrencyAppWidgetConfigureActivity CurrencyAppWidgetConfigureActivity}
*/
public class CurrencyAppWidget extends AppWidgetProvider {
static String LOG_TAG = CurrencyAppWidget.class.getSimpleName();
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
String s1 = loadTitlePref(context,appWidgetId,0);
String s2 = loadTitlePref(context,appWidgetId,1);
String URL = UriBuilder(s1,s2);
WidgetAsyncTask widgetAsyncTask = new WidgetAsyncTask(context,appWidgetId,appWidgetManager,s1.substring(0,3),s2.substring(0,3));
widgetAsyncTask.execute(URL);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
// When the user deletes the widget, delete the preference associated with it.
for (int appWidgetId : appWidgetIds) {
CurrencyAppWidgetConfigureActivity.deleteTitlePref(context, appWidgetId);
}
}
@Override
public void onEnabled(Context context) {
// Enter relevant functionality for when the first widget is created
}
@Override
public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled
}
private static class WidgetAsyncTask extends AsyncTask<String, Void, Double> {
private Context context;
private int appWidgetId;
private AppWidgetManager appWidgetManager;
private String s1;
private String s2;
public WidgetAsyncTask(Context context, int appWidgetId, AppWidgetManager appWidgetManager, String s1, String s2) {
this.context = context;
this.appWidgetId = appWidgetId;
this.appWidgetManager = appWidgetManager;
this.s1 = s1;
this.s2 = s2;
}
@Override
protected Double doInBackground(String... urlString) {
String jsonResponse = null;
if (urlString.length < 1 || urlString[0] == null) {
return null;
}
try {
URL url = createUrl(urlString[0]);
jsonResponse = makeHttpRequest(url);
} catch (IOException e) {
Log.e(getClass().getSimpleName(), "Problem making the HTTP request.", e);
}
return extractFeatureFromJson(jsonResponse, s1, s2);
}
@Override
protected void onPostExecute(Double result) {
super.onPostExecute(result);
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.currency_app_widget);
views.setTextViewText(R.id.exchangeName, s1 + s2);
views.setTextViewText(R.id.exchangeRate, round(result,2)+"");
float opacity = 0.3f; //opacity = 0: fully transparent, opacity = 1: no transparancy
int backgroundColor = 0x000000; //background color (here black)
views.setInt( R.id.widget_view, "setBackgroundColor", (int)(opacity * 0xFF) << 24 | backgroundColor);
Intent clickIntentTemplate = new Intent(context, MainActivity.class);
clickIntentTemplate.setAction(Intent.ACTION_MAIN);
clickIntentTemplate.addCategory(Intent.CATEGORY_LAUNCHER);
clickIntentTemplate.putExtra("parse_1",s1);
clickIntentTemplate.putExtra("parse_2",s2);
clickIntentTemplate.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, clickIntentTemplate, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.widget_view, configPendingIntent);
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
}
private static double extractFeatureFromJson(String newsJSON, String s1, String s2) {
double conversionValue = 0.00;
Log.i(LOG_TAG, "extractFeatureFromJson: " + newsJSON);
Log.i(LOG_TAG, "extractFeatureFromJson: " + s1 + "_" + s2);
if (TextUtils.isEmpty(newsJSON)) {
return 0.00;
}
try {
JSONObject jObject = new JSONObject(newsJSON);
conversionValue = jObject.getDouble(s1 + "_" + s2);
} catch (JSONException e) {
Log.e("MainActivity", "Problem parsing the JSON results", e);
}
return conversionValue;
}
}
}

View File

@@ -0,0 +1,225 @@
package com.appttude.h_mal.easycc;
import android.app.Activity;
import android.app.Dialog;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
/**
* The configuration screen for the {@link CurrencyAppWidget CurrencyAppWidget} AppWidget.
*/
public class CurrencyAppWidgetConfigureActivity extends Activity {
private static final String PREFS_NAME = "com.example.haimalik.myapplication.CurrencyAppWidget";
private static final String PREF_PREFIX_KEY = "appwidget_";
private static final int PRIMARY = 0;
private static final int SECONDARY = 1;
int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
View.OnClickListener mOnClickListener = new View.OnClickListener() {
public void onClick(View v) {
final Context context = CurrencyAppWidgetConfigureActivity.this;
final Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
dialog.setCancelable(false);
dialog.setContentView(R.layout.confirm_dialog);
TextView text = (TextView) dialog.findViewById(R.id.confirm_text);
text.setText(new StringBuilder().append("Create widget for ")
.append(loadTitlePref(context, mAppWidgetId, PRIMARY))
.append(loadTitlePref(context, mAppWidgetId, SECONDARY))
.append("?").toString());
TextView yes = dialog.findViewById(R.id.confirm_yes);
yes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//do for yes
// It is the responsibility of the configuration activity to update the app widget
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
CurrencyAppWidget.updateAppWidget(context, appWidgetManager, mAppWidgetId);
// Make sure we pass back the original appWidgetId
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_OK, resultValue);
finish();
}
});
TextView no = dialog.findViewById(R.id.confirm_no);
no.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}
};
public CurrencyAppWidgetConfigureActivity() {
super();
}
// Write the prefix to the SharedPreferences object for this widget
static void saveCurrencyPref(Context context, int appWidgetId, String text, int item) {
SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
prefs.putString(PREF_PREFIX_KEY + appWidgetId + "_" + item, text);
prefs.apply();
}
// Read the prefix from the SharedPreferences object for this widget.
// If there is no preference saved, get the default from a resource
static String loadTitlePref(Context context, int appWidgetId, int item) {
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
String titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId + "_" + item, null);
if (titleValue != null) {
return titleValue;
} else {
return context.getResources().getStringArray(R.array.currency_arrays)[0].substring(0,3);
}
}
static void deleteTitlePref(Context context, int appWidgetId) {
SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
prefs.remove(PREF_PREFIX_KEY+ appWidgetId + "_0");
prefs.remove(PREF_PREFIX_KEY+ appWidgetId + "_1");
prefs.apply();
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.
setResult(RESULT_CANCELED);
setContentView(R.layout.currency_app_widget_configure);
final TextView currencyOne = findViewById(R.id.currency_one);
final TextView currencyTwo = findViewById(R.id.currency_two);
TextView submit = findViewById(R.id.submit_widget);
// Find the widget id from the intent.
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
// If this activity was started with an intent without an app widget ID, finish with an error.
if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish();
return;
}
currencyOne.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomDialogClass dialogClass = new CustomDialogClass(CurrencyAppWidgetConfigureActivity.this,currencyOne,PRIMARY);
dialogClass.show();
}
});
currencyTwo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomDialogClass dialogClass = new CustomDialogClass(CurrencyAppWidgetConfigureActivity.this,currencyTwo,SECONDARY);
dialogClass.show();
}
});
submit.setOnClickListener(mOnClickListener);
}
private class CustomDialogClass extends Dialog implements android.view.View.OnClickListener{
Context context;
ListView listView;
TextView textView;
EditText editText;
int item;
public CustomDialogClass(@NonNull Context context, TextView textView, int item) {
super(context);
this.context = context;
this.textView = textView;
this.item = item;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_dialog);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
listView = (ListView) findViewById(R.id.list_view);
editText = (EditText) findViewById(R.id.search_text) ;
final ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(context,R.array.currency_arrays,android.R.layout.simple_list_item_1);
listView.setAdapter(arrayAdapter);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
arrayAdapter.getFilter().filter(charSequence);
}
@Override
public void afterTextChanged(Editable editable) {
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String text = adapterView.getItemAtPosition(i).toString().substring(0,3);
textView.setText(adapterView.getItemAtPosition(i).toString());
saveCurrencyPref(context,mAppWidgetId,text,item);
dismiss();
}
});
}
@Override
public void onClick(View view) {
}
}
}

View File

@@ -0,0 +1,376 @@
package com.appttude.h_mal.easycc;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URL;
import java.text.DecimalFormat;
import static com.appttude.h_mal.easycc.PublicMethods.UriBuilder;
import static com.appttude.h_mal.easycc.PublicMethods.createUrl;
import static com.appttude.h_mal.easycc.PublicMethods.makeHttpRequest;
public class MainActivity extends AppCompatActivity {
EditText currencyOneEditText;
EditText currencyTwoEditText;
TextView currencyOne;
TextView currencyTwo;
double conversionRateOne;
ProgressBar spinner;
LinearLayout wholeView;
private String URL = "https://free.currencyconverterapi.com/api/v3/convert?";
private String CURRENCY_ONE = "currency_one_pref";
private String CURRENCY_TWO = "currency_two_pref";
private static final String LOG_TAG = MainActivity.class.getSimpleName();
SharedPreferences pref;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
currencyOneEditText = (EditText) findViewById(R.id.editText);
currencyTwoEditText = (EditText) findViewById(R.id.editText2);
currencyOne = (TextView) findViewById(R.id.currency_one);
currencyTwo = (TextView) findViewById(R.id.currency_two);
if (getIntent().getExtras() != null) {
Bundle b = getIntent().getExtras();
currencyOne.setText(arrayEntry(b.getString("parse_1")));
currencyTwo.setText(arrayEntry(b.getString("parse_2")));
}else{
if (pref != null) {
currencyOne.setText(pref.getString(CURRENCY_ONE, String.valueOf(getResources().getTextArray(R.array.currency_arrays)[0])));
currencyTwo.setText(pref.getString(CURRENCY_TWO, String.valueOf(getResources().getTextArray(R.array.currency_arrays)[0])));
}else{
currencyOne.setText(getResources().getTextArray(R.array.currency_arrays)[0]);
currencyTwo.setText(getResources().getTextArray(R.array.currency_arrays)[0]);
}
}
currencyOneEditText.addTextChangedListener(TextWatcherClass);
currencyTwoEditText.addTextChangedListener(TextWatcherClass2);
spinner = (ProgressBar) findViewById(R.id.progressBar);
spinner.setVisibility(View.GONE);
wholeView = findViewById(R.id.whole_view);
// addListenerOnSpinnerItemSelection();
currencyOne.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomDialogClass dialogClass = new CustomDialogClass(MainActivity.this,currencyOne);
dialogClass.show();
}
});
currencyTwo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CustomDialogClass dialogClass = new CustomDialogClass(MainActivity.this,currencyTwo);
dialogClass.show();
}
});
String stringURL = UriBuilder(currencyOne.getText().toString().substring(0,3),
currencyTwo.getText().toString().substring(0,3));
MyAsyncTask task = new MyAsyncTask();
task.execute(stringURL);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (getIntent().getExtras() != null) {
Bundle b = getIntent().getExtras();
currencyOne.setText(arrayEntry(b.getString("parse_1")));
currencyTwo.setText(arrayEntry(b.getString("parse_2")));
}
}
private TextWatcher TextWatcherClass = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
currencyTwoEditText.removeTextChangedListener(TextWatcherClass2);
if(currencyOneEditText.getText().toString().isEmpty()){
currencyTwoEditText.setText("");
return;
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
try{
Double topValue = Double.parseDouble(currencyOneEditText.getText().toString());
Double bottomValue = topValue * conversionRateOne;
DecimalFormat df = new DecimalFormat("#.##");
bottomValue = Double.valueOf(df.format(bottomValue));
currencyTwoEditText.setText(bottomValue.toString());
}
catch (NumberFormatException e){
Log.e(LOG_TAG, "no numbers inserted");
}
currencyTwoEditText.addTextChangedListener(TextWatcherClass2);
}
};
private TextWatcher TextWatcherClass2 = new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
currencyOneEditText.removeTextChangedListener(TextWatcherClass);
if(currencyTwoEditText.getText().toString().isEmpty()){
currencyOneEditText.setText("");
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
try{
Double bottomValue = Double.parseDouble(currencyTwoEditText.getText().toString());
Double topValue = bottomValue * (1 / conversionRateOne);
DecimalFormat df = new DecimalFormat("#.##");
topValue = Double.valueOf(df.format(topValue));
currencyOneEditText.setText(topValue.toString());
}
catch (NumberFormatException e){
Log.e(LOG_TAG, "no numbers inserted");
}
currencyOneEditText.addTextChangedListener(TextWatcherClass);
}
};
private double extractFeatureFromJson(String newsJSON) {
double conversionValue = 0.00;
Log.i(LOG_TAG, "extractFeatureFromJson: " + newsJSON);
String currencyOneVal = currencyOne.getText().toString().substring(0,3);
String currencyTwoVal = currencyTwo.getText().toString().substring(0,3);
Log.i(LOG_TAG, "extractFeatureFromJson: " + currencyOneVal + "_" + currencyTwoVal);
if (TextUtils.isEmpty(newsJSON)) {
return 0.00;
}
try {
JSONObject jObject = new JSONObject(newsJSON);
conversionValue = jObject.getDouble(currencyOneVal + "_" + currencyTwoVal);
} catch (JSONException e) {
Log.e("MainActivity", "Problem parsing the JSON results", e);
}
return conversionValue;
}
protected class MyAsyncTask extends AsyncTask<String, Void, Double> {
@Override
protected Double doInBackground(String... urlString) {
String jsonResponse = null;
if (urlString.length < 1 || urlString[0] == null) {
return null;
}
try {
URL url = createUrl(urlString[0]);
jsonResponse = makeHttpRequest(url);
} catch (IOException e) {
Log.e(LOG_TAG, "Problem making the HTTP request.", e);
}
if (jsonResponse.equals("")){
return null;
}
return extractFeatureFromJson(jsonResponse);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
spinner.setVisibility(View.VISIBLE);
AlphaAnimation animation1 = new AlphaAnimation(1.0f, 0.2f);
animation1.setDuration(200);
wholeView.startAnimation(animation1);
wholeView.setAlpha(0.2f);
}
@Override
protected void onPostExecute(Double result) {
super.onPostExecute(result);
spinner.setVisibility(View.GONE);
wholeView.setAlpha(1.0f);
if (result == null){
Toast.makeText(MainActivity.this, "Failed to retrieve exchange rate", Toast.LENGTH_SHORT).show();
}else{
conversionRateOne = result;
}
}
}
private class CustomDialogClass extends Dialog implements android.view.View.OnClickListener{
Context context;
ListView listView;
TextView textView;
EditText editText;
int selection;
public CustomDialogClass(@NonNull Context context, TextView textView) {
super(context);
this.context = context;
this.textView = textView;
if (textView.getId() == R.id.currency_one){
selection = 1;
}else{
selection = 2;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_dialog);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
listView = (ListView) findViewById(R.id.list_view);
editText = (EditText) findViewById(R.id.search_text) ;
final ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(context,R.array.currency_arrays,android.R.layout.simple_list_item_1);
listView.setAdapter(arrayAdapter);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
arrayAdapter.getFilter().filter(charSequence);
}
@Override
public void afterTextChanged(Editable editable) {
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
textView.setText(adapterView.getItemAtPosition(i).toString());
SharedPreferences.Editor editor = pref.edit();
if (selection == 1) {
editor.putString(CURRENCY_ONE,adapterView.getItemAtPosition(i).toString());
}else{
editor.putString(CURRENCY_TWO,adapterView.getItemAtPosition(i).toString());
}
editor.apply();
currencyOneEditText.setText("");
currencyTwoEditText.setText("");
String stringURL = UriBuilder(currencyOne.getText().toString().substring(0,3),
currencyTwo.getText().toString().substring(0,3));
MyAsyncTask task = new MyAsyncTask();
task.execute(stringURL);
dismiss();
}
});
}
@Override
public void onClick(View view) {
}
}
private String arrayEntry (String s){
String[] strings = getResources().getStringArray(R.array.currency_arrays);
String returnString = strings[0];
for (String string : strings) {
if (s.equals(string.substring(0, 3))) {
returnString = string;
}
}
return returnString;
}
}

View File

@@ -0,0 +1,110 @@
package com.appttude.h_mal.easycc;
import android.net.Uri;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
public class PublicMethods {
private static String TAG = PublicMethods.class.getSimpleName();
private static String URL = "https://free.currencyconverterapi.com/api/v3/convert?";
public PublicMethods() {
}
static String UriBuilder(String s1, String s2){
s1 = s1.substring(0,3);
s2 = s2.substring(0,3);
Log.i(TAG, "UriBuilder: " + s1 + "_" + s2);
Uri baseUri = Uri.parse(URL);
Uri.Builder builder = baseUri.buildUpon();
builder.appendQueryParameter("q", s1 + "_" + s2)
.appendQueryParameter("compact", "ultra")
.appendQueryParameter("apiKey", "a4f93cc2ff05dd772321");
return builder.build().toString();
}
static java.net.URL createUrl(String stringUrl) {
URL url = null;
try {
url = new URL(stringUrl);
} catch (MalformedURLException e) {
Log.e(TAG, "Error with creating URL ", e);
}
return url;
}
static String makeHttpRequest(URL url) throws IOException {
String jsonResponse = "";
if (url == null) {
return jsonResponse;
}
HttpURLConnection urlConnection = null;
InputStream inputStream = null;
try {
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setReadTimeout(30000);
urlConnection.setConnectTimeout(30000);
urlConnection.setRequestMethod("GET");
urlConnection.connect();
if (urlConnection.getResponseCode() == 200) {
inputStream = urlConnection.getInputStream();
jsonResponse = readFromStream(inputStream);
} else {
Log.e(TAG, "Error response code: " + urlConnection.getResponseCode());
}
} catch (IOException e) {
Log.e(TAG, "Problem retrieving the JSON results.", e);
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
if (inputStream != null) {
inputStream.close();
}
}
return jsonResponse;
}
private static String readFromStream(InputStream inputStream) throws IOException {
StringBuilder output = new StringBuilder();
if (inputStream != null) {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8"));
BufferedReader reader = new BufferedReader(inputStreamReader);
String line = "";
while (line != null) {
output.append(line);
line = reader.readLine();
}
}
Log.d(TAG, output.toString());
return output.toString();
}
public static double round(double value, int places) {
if (places < 0) throw new IllegalArgumentException();
long factor = (long) Math.pow(10, places);
value = value * factor;
long tmp = Math.round(value);
return (double) tmp / factor;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#b3001b"
android:endColor="#262626"
android:type="linear"
android:angle="45"/>
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/colour_three"
android:endColor="@color/colour_two"
android:type="linear"
android:angle="45"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="@color/colour_two" />
<corners
android:bottomRightRadius="22dp"
android:bottomLeftRadius="22dp"
android:topLeftRadius="22dp"
android:topRightRadius="22dp" />
</shape>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:orientation="vertical"
android:focusable="false"
android:focusableInTouchMode="true"
tools:context="com.appttude.h_mal.easycc.MainActivity">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="12dp">
<LinearLayout
android:id="@+id/whole_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="18dp"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
style="@style/cardview_theme">
<TextView
android:id="@+id/currency_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency One"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:layout_marginTop="6dp"
android:background="@drawable/round_edit_text"
android:ems="10"
android:hint="insert value one"
android:textColorHighlight="#608d91"
android:inputType="numberDecimal"
android:padding="12dp"
android:selectAllOnFocus="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
style="@style/cardview_theme">
<TextView
android:id="@+id/currency_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency Two"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_weight="7"
android:background="@drawable/round_edit_text"
android:ems="10"
android:hint="insert value two"
android:textColorHighlight="#608d91"
android:inputType="numberDecimal"
android:padding="12dp"
android:selectAllOnFocus="true" />
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:indeterminateTint="@color/colour_four"
android:indeterminateTintMode="src_atop" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@android:color/transparent"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@color/colour_three"
card_view:cardCornerRadius="22dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/confirm_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Create widget for AUDGBP?"
android:textColor="@color/colour_five" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal">
<TextView
android:id="@+id/confirm_yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@android:string/yes"
android:textColor="@color/colour_five" />
<TextView
android:id="@+id/confirm_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@android:string/no"
android:textColor="@color/colour_five" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

View File

@@ -0,0 +1,36 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_view"
android:layout_width="match_parent"
android:layout_height="72dp"
android:orientation="vertical">
<TextView
android:id="@+id/exchangeName"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="3dp"
android:layout_weight="1"
android:autoSizeMaxTextSize="100sp"
android:autoSizeMinTextSize="8sp"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:gravity="center"
android:textColor="#ffffff"
tools:text="AUDGBP" />
<TextView
android:id="@+id/exchangeRate"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:autoSizeMaxTextSize="100sp"
android:autoSizeMinTextSize="6sp"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:gravity="center"
android:textColor="#ffffff"
android:textStyle="bold"
tools:text="0.56" />
</LinearLayout>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/whole_view">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
style="@style/cardview_theme"
android:layout_margin="11dp">
<TextView
android:id="@+id/currency_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency One"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
style="@style/cardview_theme"
android:layout_margin="11dp">
<TextView
android:id="@+id/currency_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency Two"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
</LinearLayout>
<TextView
android:layout_marginTop="12dp"
android:layout_marginRight="22dp"
android:id="@+id/submit_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/whole_view"
android:layout_alignParentRight="true"
android:textColor="@color/colour_five"
android:text="Submit" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@android:color/transparent"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_weight="1"
android:layout_height="0dp"
android:layout_width="match_parent"
card_view:cardCornerRadius="22dp"
card_view:cardBackgroundColor="@color/colour_three"
android:layout_marginTop="45dp">
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
android:layout_marginTop="20dp"
card_view:cardBackgroundColor="@color/colour_three"
card_view:cardCornerRadius="22dp">
<EditText
android:id="@+id/search_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="Search Currency" />
</android.support.v7.widget.CardView>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
<dimen name="widget_margin">0dp</dimen>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colour_one">#253031</color>
<color name="colour_two">#315659</color>
<color name="colour_three">#2978A0</color>
<color name="colour_four">#8549ff</color>
<color name="colour_five">#C6E0FF</color>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
<dimen name="widget_margin">8dp</dimen>
</resources>

View File

@@ -0,0 +1,163 @@
<resources>
<string name="app_name">easyCC</string>
<string-array name="currency_arrays">
<item>ALL - Albanian Lek</item>
<item>AFN - Afghan Afghani</item>
<item>DZD - Algerian Dinar</item>
<item>AOA - Angolan Kwanza</item>
<item>ARS - Argentine Peso</item>
<item>AMD - Armenian Dram</item>
<item>AWG - Aruban Florin</item>
<item>AUD - Australian Dollar</item>
<item>AZN - Azerbaijani Manat</item>
<item>BSD - Bahamian Dollar</item>
<item>BHD - Bahraini Dinar</item>
<item>BDT - Bangladeshi Taka</item>
<item>BBD - Barbadian Dollar</item>
<item>BYR - Belarusian Ruble</item>
<item>BZD - Belize Dollar</item>
<item>BTN - Bhutanese Ngultrum</item>
<item>BTC - Bitcoin</item>
<item>BOB - Bolivian Boliviano</item>
<item>BAM - Bosnia And Herzegovina Konvertibilna Marka</item>
<item>BWP - Botswana Pula</item>
<item>BRL - Brazilian Real</item>
<item>GBP - British Pound</item>
<item>BND - Brunei Dollar</item>
<item>BGN - Bulgarian Lev</item>
<item>BIF - Burundi Franc</item>
<item>KHR - Cambodian Riel</item>
<item>CAD - Canadian Dollar</item>
<item>CVE - Cape Verdean Escudo</item>
<item>KYD - Cayman Islands Dollar</item>
<item>XAF - Central African CFA Franc</item>
<item>XPF - CFP Franc</item>
<item>CLP - Chilean Peso</item>
<item>CNY - Chinese Yuan</item>
<item>COP - Colombian Peso</item>
<item>KMF - Comorian Franc</item>
<item>CDF - Congolese Franc</item>
<item>CRC - Costa Rican Colon</item>
<item>HRK - Croatian Kuna</item>
<item>CUP - Cuban Peso</item>
<item>CZK - Czech Koruna</item>
<item>DKK - Danish Krone</item>
<item>DJF - Djiboutian Franc</item>
<item>DOP - Dominican Peso</item>
<item>XCD - East Caribbean Dollar</item>
<item>EGP - Egyptian Pound</item>
<item>ERN - Eritrean Nakfa</item>
<item>ETB - Ethiopian Birr</item>
<item>EUR - Euro</item>
<item>FKP - Falkland Islands Pound</item>
<item>FJD - Fijian Dollar</item>
<item>GMD - Gambian Dalasi</item>
<item>GEL - Georgian Lari</item>
<item>GHS - Ghanaian Cedi</item>
<item>GIP - Gibraltar Pound</item>
<item>GTQ - Guatemalan Quetzal</item>
<item>GNF - Guinean Franc</item>
<item>GYD - Guyanese Dollar</item>
<item>HTG - Haitian Gourde</item>
<item>HNL - Honduran Lempira</item>
<item>HKD - Hong Kong Dollar</item>
<item>HUF - Hungarian Forint</item>
<item>ISK - Icelandic Kr\u00f3na</item>
<item>INR - Indian Rupee</item>
<item>IDR - Indonesian Rupiah</item>
<item>IRR - Iranian Rial</item>
<item>IQD - Iraqi Dinar</item>
<item>ILS - Israeli New Sheqel</item>
<item>JMD - Jamaican Dollar</item>
<item>JPY - Japanese Yen</item>
<item>JOD - Jordanian Dinar</item>
<item>KZT - Kazakhstani Tenge</item>
<item>KES - Kenyan Shilling</item>
<item>KWD - Kuwaiti Dinar</item>
<item>KGS - Kyrgyzstani Som</item>
<item>LAK - Lao Kip</item>
<item>LVL - Latvian Lats</item>
<item>LBP - Lebanese Lira</item>
<item>LSL - Lesotho Loti</item>
<item>LRD - Liberian Dollar</item>
<item>LYD - Libyan Dinar</item>
<item>MOP - Macanese Pataca</item>
<item>MKD - Macedonian Denar</item>
<item>MGA - Malagasy Ariary</item>
<item>MWK - Malawian Kwacha</item>
<item>MYR - Malaysian Ringgit</item>
<item>MVR - Maldivian Rufiyaa</item>
<item>MRO - Mauritanian Ouguiya</item>
<item>MUR - Mauritian Rupee</item>
<item>MXN - Mexican Peso</item>
<item>MDL - Moldovan Leu</item>
<item>MNT - Mongolian Tugrik</item>
<item>MAD - Moroccan Dirham</item>
<item>MZN - Mozambican Metical</item>
<item>MMK - Myanma Kyat</item>
<item>NAD - Namibian Dollar</item>
<item>NPR - Nepalese Rupee</item>
<item>ANG - Netherlands Antillean Gulden</item>
<item>TWD - New Taiwan Dollar</item>
<item>NZD - New Zealand Dollar</item>
<item>NIO - Nicaraguan Cordoba</item>
<item>NGN - Nigerian Naira</item>
<item>KPW - North Korean Won</item>
<item>NOK - Norwegian Krone</item>
<item>OMR - Omani Rial</item>
<item>TOP - Paanga</item>
<item>PKR - Pakistani Rupee</item>
<item>PAB - Panamanian Balboa</item>
<item>PGK - Papua New Guinean Kina</item>
<item>PYG - Paraguayan Guarani</item>
<item>PEN - Peruvian Nuevo Sol</item>
<item>PHP - Philippine Peso</item>
<item>PLN - Polish Zloty</item>
<item>QAR - Qatari Riyal</item>
<item>RON - Romanian Leu</item>
<item>RUB - Russian Ruble</item>
<item>RWF - Rwandan Franc</item>
<item>SHP - Saint Helena Pound</item>
<item>WST - Samoan Tala</item>
<item>STD - Sao Tome And Principe Dobra</item>
<item>SAR - Saudi Riyal</item>
<item>RSD - Serbian Dinar</item>
<item>SCR - Seychellois Rupee</item>
<item>SLL - Sierra Leonean Leone</item>
<item>SGD - Singapore Dollar</item>
<item>SBD - Solomon Islands Dollar</item>
<item>SOS - Somali Shilling</item>
<item>ZAR - South African Rand</item>
<item>KRW - South Korean Won</item>
<item>XDR - Special Drawing Rights</item>
<item>LKR - Sri Lankan Rupee</item>
<item>SDG - Sudanese Pound</item>
<item>SRD - Surinamese Dollar</item>
<item>SZL - Swazi Lilangeni</item>
<item>SEK - Swedish Krona</item>
<item>CHF - Swiss Franc</item>
<item>SYP - Syrian Pound</item>
<item>TJS - Tajikistani Somoni</item>
<item>TZS - Tanzanian Shilling</item>
<item>THB - Thai Baht</item>
<item>TTD - Trinidad and Tobago Dollar</item>
<item>TND - Tunisian Dinar</item>
<item>TRY - Turkish New Lira</item>
<item>TMT - Turkmenistan Manat</item>
<item>AED - UAE Dirham</item>
<item>UGX - Ugandan Shilling</item>
<item>UAH - Ukrainian Hryvnia</item>
<item>USD - United States Dollar</item>
<item>UYU - Uruguayan Peso</item>
<item>UZS - Uzbekistani Som</item>
<item>VUV - Vanuatu Vatu</item>
<item>VEF - Venezuelan Bolivar</item>
<item>VND - Vietnamese Dong</item>
<item>XOF - West African CFA Franc</item>
<item>YER - Yemeni Rial</item>
<item>ZMW - Zambian Kwacha</item>
</string-array>
<string name="configure">Configure</string>
<string name="add_widget">Add widget</string>
</resources>

View File

@@ -0,0 +1,32 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colour_two</item>
<item name="colorPrimaryDark">@color/colour_two</item>
<item name="colorAccent">@color/colour_two</item>
<item name="android:windowBackground">@drawable/gradient_colour</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:editTextColor">@color/colour_five</item>
<item name="android:textColorPrimary">@color/colour_five</item>
</style>
<style name="cardview_theme" parent="CardView">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="cardBackgroundColor">@color/colour_three</item>
<item name="cardCornerRadius">22dp</item>
<!--<item name="cardElevation">0dp</item>-->
</style>
<style name="edittext_theme">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:ems">10</item>
<item name="android:inputType">numberDecimal</item>
<item name="android:selectAllOnFocus">true</item>
</style>
</resources>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity"
android:initialKeyguardLayout="@layout/currency_app_widget"
android:initialLayout="@layout/currency_app_widget"
android:minHeight="40dp"
android:minWidth="110dp"
android:minResizeHeight="40dp"
android:minResizeWidth="40dp"
android:previewImage="@drawable/easyycc_widget_preview"
android:resizeMode="horizontal"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen">
</appwidget-provider>

View File

@@ -0,0 +1,17 @@
package com.appttude.h_mal.easycc;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}