New Commit of kotlin version - MVVM, retrofit2, Kodein

This commit is contained in:
2020-04-12 19:19:15 +01:00
parent 20298d5028
commit 13da00e96a
49 changed files with 1481 additions and 287 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -5,5 +5,5 @@
android:startColor="@color/colour_three"
android:endColor="@color/colour_two"
android:type="linear"
android:angle="45"/>
android:angle="45" />
</shape>

View File

@@ -1,111 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout 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">
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewmodel"
type="com.appttude.h_mal.easycc.mvvm.ui.app.MainViewModel" />
</data>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="12dp">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="false"
android:focusableInTouchMode="true"
tools:context="com.appttude.h_mal.easycc.mvvm.ui.app.MainActivity">
<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"
<RelativeLayout
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" />
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">
<androidx.cardview.widget.CardView
style="@style/cardview_theme">
<TextView
android:tag="top"
android:id="@+id/currency_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="@{viewmodel.rateIdFrom}"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</androidx.cardview.widget.CardView>
<EditText
android:id="@+id/topInsertValue"
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:text="@={viewmodel.topVal}"
android:hint="insert value one"
android:textColorHighlight="#608d91"
android:inputType="numberDecimal"
android:padding="12dp"
android:tag="from"
android:selectAllOnFocus="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.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="@{viewmodel.rateIdTo}"
android:tag="bottom"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</androidx.cardview.widget.CardView>
<EditText
android:id="@+id/bottomInsertValues"
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:text="@={viewmodel.bottomVal}"
android:hint="insert value two"
android:textColorHighlight="#608d91"
android:inputType="numberDecimal"
android:padding="12dp"
android:tag="to"
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"
android:visibility="gone"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</layout>

View File

@@ -6,7 +6,7 @@
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
<androidx.cardview.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"
@@ -15,6 +15,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:orientation="vertical">
<TextView
@@ -51,6 +52,6 @@
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
</LinearLayout>

View File

@@ -1,26 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<layout
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">
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewmodel"
type="com.appttude.h_mal.easycc.mvvm.ui.widget.WidgetViewModel" />
</data>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="false"
android:focusableInTouchMode="true"
tools:context=".mvvm.ui.widget.CurrencyAppWidgetConfigureActivityKotlin">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/whole_view">
android:layout_centerInParent="true"
android:layout_margin="12dp">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/whole_view">
<androidx.cardview.widget.CardView
style="@style/cardview_theme"
android:layout_margin="11dp">
@@ -29,14 +40,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency One"
android:onClick="@{viewmodel::selectCurrencyOnClick}"
android:tag="top"
android:text="@={viewmodel.rateIdFrom}"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
android:textSize="18sp"
tools:text="Currency One" />
</androidx.cardview.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
<androidx.cardview.widget.CardView
style="@style/cardview_theme"
android:layout_margin="11dp">
@@ -45,26 +58,31 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:text="Currency Two"
android:onClick="@{viewmodel::selectCurrencyOnClick}"
android:tag="bottom"
android:text="@={viewmodel.rateIdTo}"
android:textColor="@color/colour_five"
android:textSize="18sp" />
</android.support.v7.widget.CardView>
android:textSize="18sp"
tools:text="Currency Two" />
</androidx.cardview.widget.CardView>
</LinearLayout>
<TextView
android:layout_marginTop="12dp"
android:layout_marginEnd="22dp"
android:id="@+id/submit_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/whole_view"
android:layout_alignParentEnd="true"
android:textColor="@color/colour_five"
android:onClick="@{viewmodel::submitSelectionOnClick}"
android:text="Submit" />
</RelativeLayout>
</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>
</layout>

View File

@@ -0,0 +1,21 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#09C"
android:padding="@dimen/widget_margin">
<TextView
android:id="@+id/appwidget_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:background="#09C"
android:contentDescription="@string/appwidget_text"
android:text="@string/appwidget_text"
android:textColor="#ffffff"
android:textSize="24sp"
android:textStyle="bold|italic" />
</RelativeLayout>

View File

@@ -0,0 +1,27 @@
<?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="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@string/configure" />
<EditText
android:id="@+id/appwidget_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
<Button
android:id="@+id/add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/add_widget" />
</LinearLayout>

View File

@@ -6,9 +6,7 @@
android:backgroundTint="@android:color/transparent"
android:orientation="vertical">
<android.support.v7.widget.CardView
<androidx.cardview.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_weight="1"
android:layout_height="0dp"
@@ -23,8 +21,8 @@
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"
</androidx.cardview.widget.CardView>
<androidx.cardview.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"
@@ -38,6 +36,6 @@
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="Search Currency" />
</android.support.v7.widget.CardView>
</androidx.cardview.widget.CardView>
</LinearLayout>

View File

@@ -160,4 +160,5 @@
</string-array>
<string name="configure">Configure</string>
<string name="add_widget">Add widget</string>
<string name="appwidget_text">EXAMPLE</string>
</resources>

View File

@@ -1,6 +1,6 @@
<?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:configure="com.appttude.h_mal.easycc.legacy.CurrencyAppWidgetConfigureActivity"
android:initialKeyguardLayout="@layout/currency_app_widget"
android:initialLayout="@layout/currency_app_widget"
android:minHeight="40dp"

View File

@@ -0,0 +1,11 @@
<?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.mvvm.ui.widget.CurrencyAppWidgetConfigureActivityKotlin"
android:initialKeyguardLayout="@layout/currency_kotlin_app_widget"
android:initialLayout="@layout/currency_kotlin_app_widget"
android:minWidth="110dp"
android:minHeight="40dp"
android:previewImage="@drawable/example_appwidget_preview"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen|keyguard"></appwidget-provider>