Created SplashActivity and LicenseActivity. Created a MaterialComponents button style with its state list animator.
This commit is contained in:
parent
93f2abfb0e
commit
f19556c925
11 changed files with 228 additions and 4 deletions
|
@ -12,9 +12,8 @@
|
||||||
android:theme="@style/Theme.Bitsy"
|
android:theme="@style/Theme.Bitsy"
|
||||||
tools:ignore="GoogleAppIndexingWarning">
|
tools:ignore="GoogleAppIndexingWarning">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.MainActivity"
|
android:name=".activities.SplashActivity"
|
||||||
android:label="@string/app_name"
|
android:theme="@style/SplashTheme">
|
||||||
android:theme="@style/Theme.Bitsy">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
|
@ -29,6 +28,8 @@
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".activities.ReceiveTransactionActivity">
|
<activity android:name=".activities.ReceiveTransactionActivity">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".activities.MainActivity"/>
|
||||||
|
<activity android:name=".activities.LicenseActivity"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1,34 @@
|
||||||
|
package cy.agorise.bitsybitshareswallet.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.preference.PreferenceManager
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import cy.agorise.bitsybitshareswallet.R
|
||||||
|
import cy.agorise.bitsybitshareswallet.utils.Constants
|
||||||
|
import kotlinx.android.synthetic.main.activity_license.*
|
||||||
|
|
||||||
|
class LicenseActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_license)
|
||||||
|
|
||||||
|
// Get version number of the last agreed license version
|
||||||
|
val agreedLicenseVersion = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
|
.getInt(Constants.KEY_LAST_AGREED_LICENSE_VERSION, 0)
|
||||||
|
|
||||||
|
// If the last agreed license version is the actual one then proceed to the following Activities
|
||||||
|
if (agreedLicenseVersion == 1) {
|
||||||
|
agree()
|
||||||
|
} else {
|
||||||
|
wbLA.loadData(getString(R.string.licence_html), "text/html", "UTF-8")
|
||||||
|
|
||||||
|
btnDisagree.setOnClickListener { finish() }
|
||||||
|
|
||||||
|
btnAgree.setOnClickListener { agree() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun agree() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
|
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
|
||||||
|
navigation.selectedItemId = R.id.navigation_balances
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBalancesFragment() {
|
private fun loadBalancesFragment() {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cy.agorise.bitsybitshareswallet.activities
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
|
class SplashActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val intent = Intent(this, LicenseActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,11 @@ package cy.agorise.bitsybitshareswallet.utils
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key used to store the number of the last agreed License version
|
||||||
|
*/
|
||||||
|
const val KEY_LAST_AGREED_LICENSE_VERSION = "last_agreed_license_version"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key used to store the night mode setting into the shared preferences
|
* Key used to store the night mode setting into the shared preferences
|
||||||
*/
|
*/
|
||||||
|
|
93
app/src/main/res/animator/button_state_list_anim.xml
Normal file
93
app/src/main/res/animator/button_state_list_anim.xml
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<!-- Pressed state -->
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_pressed="true">
|
||||||
|
<set>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="100"
|
||||||
|
android:propertyName="translationZ"
|
||||||
|
android:valueTo="2dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="elevation"
|
||||||
|
android:valueTo="6dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
</set>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Hover state. This is triggered via mouse. -->
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_hovered="true">
|
||||||
|
<set>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="100"
|
||||||
|
android:propertyName="translationZ"
|
||||||
|
android:valueTo="2dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="elevation"
|
||||||
|
android:valueTo="6dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
</set>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Focused state. This is triggered via keyboard. -->
|
||||||
|
<item
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:state_focused="true">
|
||||||
|
<set>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="100"
|
||||||
|
android:propertyName="translationZ"
|
||||||
|
android:valueTo="2dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="elevation"
|
||||||
|
android:valueTo="6dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
</set>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Base state (enabled, not pressed) -->
|
||||||
|
<item android:state_enabled="true">
|
||||||
|
<set>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="100"
|
||||||
|
android:propertyName="translationZ"
|
||||||
|
android:startDelay="100"
|
||||||
|
android:valueTo="0dp"
|
||||||
|
android:valueType="floatType"
|
||||||
|
tools:ignore="UnusedAttribute" />
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="elevation"
|
||||||
|
android:valueTo="6dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
</set>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Disabled state -->
|
||||||
|
<item>
|
||||||
|
<set>
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="translationZ"
|
||||||
|
android:valueTo="0dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
<objectAnimator
|
||||||
|
android:duration="0"
|
||||||
|
android:propertyName="elevation"
|
||||||
|
android:valueTo="0dp"
|
||||||
|
android:valueType="floatType" />
|
||||||
|
</set>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
13
app/src/main/res/drawable/splash_screen.xml
Normal file
13
app/src/main/res/drawable/splash_screen.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:drawable="@color/colorPrimary"/>
|
||||||
|
|
||||||
|
<!--<item> TODO add app logo in png format-->
|
||||||
|
<!--<bitmap-->
|
||||||
|
<!--android:gravity="center"-->
|
||||||
|
<!--android:src="@drawable/bts_logo"/>-->
|
||||||
|
<!--</item>-->
|
||||||
|
|
||||||
|
</layer-list>
|
41
app/src/main/res/layout/activity_license.xml
Normal file
41
app/src/main/res/layout/activity_license.xml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/wbLA"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnAgree"
|
||||||
|
style="@style/Widget.PalmPay.Button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:backgroundTint="@color/colorPrimary"
|
||||||
|
android:text="@string/button__agree" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnDisagree"
|
||||||
|
style="@style/Widget.PalmPay.Button.TextButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:layout_toStartOf="@id/btnAgree"
|
||||||
|
android:text="@string/button__disagree"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#0099d6</color>
|
<color name="colorPrimary">#0099d6</color>
|
||||||
<color name="colorPrimaryDark">#0099d6</color>
|
<color name="colorPrimaryDark">#006ba4</color>
|
||||||
<color name="colorAccent">#669900</color>
|
<color name="colorAccent">#669900</color>
|
||||||
|
|
||||||
<color name="black">#000</color>
|
<color name="black">#000</color>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,6 +25,20 @@
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Custom widget styles -->
|
||||||
|
<style name="SplashTheme" parent="Theme.Bitsy.NoActionBar">
|
||||||
|
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.PalmPay.Button" parent="Widget.MaterialComponents.Button">
|
||||||
|
<item name="android:textColor">@android:color/white</item>
|
||||||
|
<item name="android:stateListAnimator">@animator/button_state_list_anim</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.PalmPay.Button.TextButton" parent="Widget.MaterialComponents.Button.TextButton">
|
||||||
|
<item name="android:textColor">?android:attr/colorPrimaryDark</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Text styles -->
|
<!-- Text styles -->
|
||||||
<style name="TextAppearance.Body1" parent="TextAppearance.MaterialComponents.Body1" />
|
<style name="TextAppearance.Body1" parent="TextAppearance.MaterialComponents.Body1" />
|
||||||
<style name="TextAppearance.Body2" parent="TextAppearance.MaterialComponents.Body2" />
|
<style name="TextAppearance.Body2" parent="TextAppearance.MaterialComponents.Body2" />
|
||||||
|
|
Loading…
Reference in a new issue