Updated on 2026-08-14
This commit is contained in:
commit
166819b549
6 changed files with 83 additions and 5 deletions
|
|
@ -2,12 +2,18 @@ package com.tangem.ui.fragment
|
|||
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.nfc.NfcAdapter
|
||||
import android.nfc.Tag
|
||||
import android.nfc.tech.IsoDep
|
||||
import android.os.Bundle
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.*
|
||||
import android.widget.PopupMenu
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.os.bundleOf
|
||||
|
|
@ -34,12 +40,13 @@ import com.tangem.ui.navigation.NavigationResultListener
|
|||
import com.tangem.util.CommonUtil
|
||||
import com.tangem.util.LOG
|
||||
import com.tangem.util.UtilHelper
|
||||
import com.tangem.util.extensions.colorFrom
|
||||
import com.tangem.wallet.BuildConfig
|
||||
import com.tangem.wallet.CoinEngineFactory
|
||||
import com.tangem.wallet.R
|
||||
import com.tangem.wallet.TangemContext
|
||||
import kotlinx.android.synthetic.main.fragment_main.*
|
||||
import kotlinx.android.synthetic.main.layout_touch_card.*
|
||||
import kotlinx.android.synthetic.main.main_fragment.*
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
|
|
@ -52,7 +59,7 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
val TAG: String = MainFragment::class.java.simpleName
|
||||
}
|
||||
|
||||
override val layoutId = R.layout.main_fragment
|
||||
override val layoutId = R.layout.fragment_main
|
||||
private lateinit var viewModel: MainViewModel
|
||||
private lateinit var nfcDeviceAntenna: NfcDeviceAntennaLocation
|
||||
private var unsuccessReadCount = 0
|
||||
|
|
@ -82,6 +89,25 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
|
||||
// set listeners
|
||||
fab.setOnClickListener { showMenu(it) }
|
||||
|
||||
setCardStoreLink()
|
||||
}
|
||||
|
||||
private fun setCardStoreLink() {
|
||||
val text = getString(R.string.main_screen_visit_store, getString(R.string.main_screen_store_address))
|
||||
val spannable = SpannableString(text)
|
||||
spannable.setSpan(
|
||||
ForegroundColorSpan(requireContext().colorFrom(R.color.colorAccent)),
|
||||
text.indexOf(getString(R.string.main_screen_store_address)),
|
||||
text.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
|
||||
tvBuyCards?.setText(spannable, TextView.BufferType.SPANNABLE)
|
||||
llShoppingView?.setOnClickListener {
|
||||
val uri = Uri.parse ("https://www.tangemcards.com")
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
|
|
|
|||
7
app/src/main/java/com/tangem/util/extensions/Context.kt
Normal file
7
app/src/main/java/com/tangem/util/extensions/Context.kt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package com.tangem.util.extensions
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.core.content.ContextCompat
|
||||
|
||||
fun Context.colorFrom(@ColorRes colorId: Int) = ContextCompat.getColor(this, colorId)
|
||||
9
app/src/main/res/drawable/ic_shopping_cart_black.xml
Normal file
9
app/src/main/res/drawable/ic_shopping_cart_black.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M7,18c-1.1,0 -1.99,0.9 -1.99,2S5.9,22 7,22s2,-0.9 2,-2 -0.9,-2 -2,-2zM1,2v2h2l3.6,7.59 -1.35,2.45c-0.16,0.28 -0.25,0.61 -0.25,0.96 0,1.1 0.9,2 2,2h12v-2L7.42,15c-0.14,0 -0.25,-0.11 -0.25,-0.25l0.03,-0.12 0.9,-1.63h7.45c0.75,0 1.41,-0.41 1.75,-1.03l3.58,-6.49c0.08,-0.14 0.12,-0.31 0.12,-0.48 0,-0.55 -0.45,-1 -1,-1L5.21,4l-0.94,-2L1,2zM17,18c-1.1,0 -1.99,0.9 -1.99,2s0.89,2 1.99,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_height="60dp"
|
||||
app:srcCompat="@drawable/tangem_logo_full_new" />
|
||||
|
||||
<include layout="@layout/layout_touch_card" />
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<TextView
|
||||
android:id="@+id/tvNFCHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:gravity="center"
|
||||
|
|
@ -43,6 +43,40 @@
|
|||
android:textColor="@color/primary_dark"
|
||||
android:textSize="@dimen/text_size_medium" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llShoppingView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:src="@drawable/ic_shopping_cart_black" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBuyCards"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:fontFamily="@font/maax"
|
||||
android:gravity="center_vertical|start"
|
||||
android:lineSpacingExtra="8dp"
|
||||
android:minHeight="200dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="@color/primary_dark"
|
||||
android:textSize="14sp"
|
||||
tools:text="Don't have a card?\nVisit our store at tangemcards.com" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
android:id="@+id/main"
|
||||
android:name="com.tangem.ui.fragment.MainFragment"
|
||||
android:label="fragment_main"
|
||||
tools:layout="@layout/main_fragment">
|
||||
tools:layout="@layout/fragment_main">
|
||||
<action
|
||||
android:id="@+id/action_main_to_loadedWalletFragment"
|
||||
app:destination="@id/loadedWalletFragment" />
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@
|
|||
<string name="main_screen_not_personalized">Not personalized</string>
|
||||
<string name="main_screen_new_version_toast">There is a new application version: %1$s</string>
|
||||
<string name="main_screen_btn_update">Update</string>
|
||||
<string name="main_screen_visit_store">Don\'t have a card?\n Visit our store at %1$s</string>
|
||||
<string name="main_screen_store_address">tangemcards.com</string>
|
||||
|
||||
<!-- LoadedWallet -->
|
||||
<string name="loaded_wallet_no_compatible_wallet">No compatible wallets installed</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue