mirror of
https://github.com/hmalik144/easy_cc_flutter.git
synced 2026-01-31 02:51:50 +00:00
- Replaced API
- Updated available currencies - Updated unit tests - Fix for failure handling - Android release signing
This commit is contained in:
@@ -21,6 +21,11 @@ if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
def relStorePassword = System.getenv("storePassword")
|
||||
def relKeyPassword = System.getenv("keyPassword")
|
||||
def relKeyAlias = System.getenv("keyAlias")
|
||||
def relStoreFile = System.getenv("storeFile")
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
@@ -43,7 +48,6 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.appttude.h_mal.easycc"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
|
||||
@@ -53,11 +57,22 @@ android {
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storePassword relStorePassword
|
||||
keyPassword relKeyPassword
|
||||
keyAlias relKeyAlias
|
||||
storeFile file(relStoreFile)
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
signingConfig signingConfigs.release
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
useProguard true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,73 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.appttude.h_mal.easycc">
|
||||
<application
|
||||
android:label="easycc"
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
android:icon="@mipmap/launcher_icon"
|
||||
android:label="easycc">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:exported="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="es.antonborri.home_widget.action.LAUNCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="es.antonborri.home_widget.action.LAUNCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Home Widget -->
|
||||
<receiver
|
||||
android:name="AppWidgetProvider"
|
||||
android:exported="true">
|
||||
<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>
|
||||
<receiver
|
||||
android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="es.antonborri.home_widget.action.BACKGROUND" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<service
|
||||
android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
<!-- Home Widget -->
|
||||
|
||||
<!-- Home Widget -->
|
||||
<receiver android:name="AppWidgetProvider" android:exported="true">
|
||||
<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>
|
||||
<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="es.antonborri.home_widget.action.BACKGROUND" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true"/>
|
||||
<!-- Home Widget -->
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
package com.appttude.h_mal.easycc
|
||||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.Toast
|
||||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent
|
||||
import es.antonborri.home_widget.HomeWidgetLaunchIntent
|
||||
import es.antonborri.home_widget.HomeWidgetPlugin
|
||||
import es.antonborri.home_widget.HomeWidgetProvider
|
||||
|
||||
|
||||
class AppWidgetProvider : HomeWidgetProvider(){
|
||||
class AppWidgetProvider : HomeWidgetProvider() {
|
||||
override fun onUpdate(
|
||||
context: Context,
|
||||
appWidgetManager: AppWidgetManager,
|
||||
@@ -23,54 +20,46 @@ class AppWidgetProvider : HomeWidgetProvider(){
|
||||
) {
|
||||
appWidgetIds.forEach { widgetId ->
|
||||
val views = RemoteViews(context.packageName, R.layout.currency_app_widget).apply {
|
||||
// Data from background operation received
|
||||
val uri = createUpdateUri(widgetId)
|
||||
val backgroundIntent = HomeWidgetBackgroundIntent.getBroadcast(context, uri)
|
||||
// checks if forced update or period update
|
||||
val forcedUpdate: Boolean =
|
||||
widgetData.getBoolean("${widgetId}_forced_update", false)
|
||||
|
||||
if (!forcedUpdate) {
|
||||
widgetData.edit().putBoolean("${widgetId}_forced_update", true).apply()
|
||||
backgroundIntent.send()
|
||||
return@apply
|
||||
}
|
||||
|
||||
val from: String? = widgetData.getString("${widgetId}_from", null)
|
||||
val to: String? = widgetData.getString("${widgetId}_to", null)
|
||||
val rate: String? = widgetData.getString("${widgetId}_rate", null)
|
||||
|
||||
if (from.isNullOrBlank() or to.isNullOrBlank() or rate.isNullOrBlank()) {
|
||||
Toast.makeText(context, "Unable to review data for widget", Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "Unable to review data for widget", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
return@apply
|
||||
}
|
||||
|
||||
val titleString = "${from}${to}"
|
||||
setTextViewText(R.id.exchangeName, titleString)
|
||||
setTextViewText(R.id.exchangeRate, rate.toString())
|
||||
|
||||
val uri = Uri.parse("myAppWidget://updatewidget").buildUpon()
|
||||
.appendQueryParameter("id", widgetId.toString())
|
||||
.build()
|
||||
|
||||
setImageViewResource(R.id.refresh_icon, R.drawable.ic_refresh_white_24dp)
|
||||
val backgroundIntent = HomeWidgetBackgroundIntent.getBroadcast(context, uri)
|
||||
setOnClickPendingIntent(R.id.refresh_icon, backgroundIntent)
|
||||
|
||||
val pendingIntent = HomeWidgetLaunchIntent.getActivity(context,
|
||||
MainActivity::class.java)
|
||||
val pendingIntent = HomeWidgetLaunchIntent.getActivity(
|
||||
context,
|
||||
MainActivity::class.java
|
||||
)
|
||||
|
||||
widgetData.edit().putBoolean("${widgetId}_forced_update", false).apply()
|
||||
setOnClickPendingIntent(R.id.widget_view, pendingIntent)
|
||||
}
|
||||
appWidgetManager.updateAppWidget(widgetId, views)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
super.onReceive(context, intent)
|
||||
|
||||
when (intent?.action) {
|
||||
|
||||
}
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
val appWidgetIds = appWidgetManager.getAppWidgetIds(
|
||||
context?.let { ComponentName(it, this::class.java) })
|
||||
val widgetDate = context?.let { HomeWidgetPlugin.getData(it) }
|
||||
|
||||
appWidgetIds.forEach { widgetId ->
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDeleted(context: Context?, appWidgetIds: IntArray?) {
|
||||
super.onDeleted(context, appWidgetIds)
|
||||
|
||||
@@ -85,4 +74,11 @@ class AppWidgetProvider : HomeWidgetProvider(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send update broadcast to widget app class
|
||||
private fun createUpdateUri(widgetId: Int): Uri? {
|
||||
return Uri.parse("myAppWidget://updatewidget").buildUpon()
|
||||
.appendQueryParameter("id", widgetId.toString())
|
||||
.build()
|
||||
}
|
||||
}
|
||||
@@ -2,160 +2,43 @@
|
||||
<resources>
|
||||
|
||||
<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>
|
||||
<item>USD - US Dollar</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:configure="com.appttude.h_mal.easycc.CurrencyAppWidgetConfigureActivity"
|
||||
android:initialKeyguardLayout="@layout/currency_app_widget"
|
||||
android:initialLayout="@layout/currency_app_widget"
|
||||
@@ -7,5 +8,6 @@
|
||||
android:minHeight="40dp"
|
||||
android:previewImage="@drawable/easyycc_widget_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="3600000"
|
||||
android:widgetCategory="home_screen|keyguard" />
|
||||
android:updatePeriodMillis="14400000"
|
||||
android:widgetCategory="home_screen|keyguard"
|
||||
tools:targetApi="jelly_bean_mr1" />
|
||||
Reference in New Issue
Block a user