diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 676b396..f977d68 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,11 +16,11 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - - - + + + diff --git a/app/src/main/java/im/status/keycard/connect/card/InitCommand.kt b/app/src/main/java/im/status/keycard/connect/card/InitCommand.kt index 062d9d8..008e1a3 100644 --- a/app/src/main/java/im/status/keycard/connect/card/InitCommand.kt +++ b/app/src/main/java/im/status/keycard/connect/card/InitCommand.kt @@ -2,10 +2,10 @@ package im.status.keycard.connect.card import android.app.Activity import android.content.Intent -import im.status.keycard.connect.INIT_ACTIVITY_PAIRING -import im.status.keycard.connect.INIT_ACTIVITY_PIN -import im.status.keycard.connect.INIT_ACTIVITY_PUK -import im.status.keycard.connect.InitActivity +import im.status.keycard.connect.ui.INIT_ACTIVITY_PAIRING +import im.status.keycard.connect.ui.INIT_ACTIVITY_PIN +import im.status.keycard.connect.ui.INIT_ACTIVITY_PUK +import im.status.keycard.connect.ui.InitActivity import im.status.keycard.connect.data.PairingManager import im.status.keycard.io.APDUException import java.io.IOException diff --git a/app/src/main/java/im/status/keycard/connect/card/OpenSecureChannelCommand.kt b/app/src/main/java/im/status/keycard/connect/card/OpenSecureChannelCommand.kt index 115a454..8cf3af3 100644 --- a/app/src/main/java/im/status/keycard/connect/card/OpenSecureChannelCommand.kt +++ b/app/src/main/java/im/status/keycard/connect/card/OpenSecureChannelCommand.kt @@ -3,8 +3,9 @@ package im.status.keycard.connect.card import android.app.Activity import android.content.Intent import im.status.keycard.applet.KeycardCommandSet -import im.status.keycard.connect.* import im.status.keycard.connect.data.PairingManager +import im.status.keycard.connect.ui.PAIRING_ACTIVITY_PASSWORD +import im.status.keycard.connect.ui.PairingActivity import java.io.IOException class OpenSecureChannelCommand : CardCommand { diff --git a/app/src/main/java/im/status/keycard/connect/card/VerifyPINCommand.kt b/app/src/main/java/im/status/keycard/connect/card/VerifyPINCommand.kt index 3f1a64c..66789ca 100644 --- a/app/src/main/java/im/status/keycard/connect/card/VerifyPINCommand.kt +++ b/app/src/main/java/im/status/keycard/connect/card/VerifyPINCommand.kt @@ -2,9 +2,9 @@ package im.status.keycard.connect.card import android.app.Activity import android.content.Intent -import im.status.keycard.connect.PINActivity -import im.status.keycard.connect.PIN_ACTIVITY_ATTEMPTS -import im.status.keycard.connect.PIN_ACTIVITY_CARD_UID +import im.status.keycard.connect.ui.PINActivity +import im.status.keycard.connect.ui.PIN_ACTIVITY_ATTEMPTS +import im.status.keycard.connect.ui.PIN_ACTIVITY_CARD_UID import im.status.keycard.connect.data.PINCache import im.status.keycard.io.APDUException import im.status.keycard.io.WrongPINException diff --git a/app/src/main/java/im/status/keycard/connect/InitActivity.kt b/app/src/main/java/im/status/keycard/connect/ui/InitActivity.kt similarity index 95% rename from app/src/main/java/im/status/keycard/connect/InitActivity.kt rename to app/src/main/java/im/status/keycard/connect/ui/InitActivity.kt index 64f2a1c..44bf5bd 100644 --- a/app/src/main/java/im/status/keycard/connect/InitActivity.kt +++ b/app/src/main/java/im/status/keycard/connect/ui/InitActivity.kt @@ -1,4 +1,4 @@ -package im.status.keycard.connect +package im.status.keycard.connect.ui import android.app.Activity import android.content.Intent @@ -10,6 +10,7 @@ import im.status.keycard.globalplatform.Crypto import android.util.Base64.NO_PADDING import android.util.Base64.NO_WRAP import android.widget.TextView +import im.status.keycard.connect.R const val INIT_ACTIVITY_PIN = "initPIN" diff --git a/app/src/main/java/im/status/keycard/connect/MainActivity.kt b/app/src/main/java/im/status/keycard/connect/ui/MainActivity.kt similarity index 69% rename from app/src/main/java/im/status/keycard/connect/MainActivity.kt rename to app/src/main/java/im/status/keycard/connect/ui/MainActivity.kt index 51744d6..48d776b 100644 --- a/app/src/main/java/im/status/keycard/connect/MainActivity.kt +++ b/app/src/main/java/im/status/keycard/connect/ui/MainActivity.kt @@ -1,15 +1,11 @@ -package im.status.keycard.connect +package im.status.keycard.connect.ui import android.nfc.NfcAdapter import android.os.Bundle -import com.google.android.material.bottomnavigation.BottomNavigationView import androidx.appcompat.app.AppCompatActivity -import androidx.navigation.findNavController -import androidx.navigation.ui.AppBarConfiguration -import androidx.navigation.ui.setupActionBarWithNavController -import androidx.navigation.ui.setupWithNavController import im.status.keycard.android.NFCCardManager import android.content.Intent +import im.status.keycard.connect.R import im.status.keycard.connect.card.* import im.status.keycard.connect.data.PairingManager @@ -21,11 +17,7 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - val navView: BottomNavigationView = findViewById(R.id.nav_view) - val navController = findNavController(R.id.nav_host_fragment) - - val appBarConfiguration = AppBarConfiguration(setOf(R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)) PairingManager.init(this) @@ -36,9 +28,6 @@ class MainActivity : AppCompatActivity() { cardManager = NFCCardManager() cardManager.setCardListener(executor) cardManager.start() - - setupActionBarWithNavController(navController, appBarConfiguration) - navView.setupWithNavController(navController) } override fun onResume() { diff --git a/app/src/main/java/im/status/keycard/connect/PINActivity.kt b/app/src/main/java/im/status/keycard/connect/ui/PINActivity.kt similarity index 94% rename from app/src/main/java/im/status/keycard/connect/PINActivity.kt rename to app/src/main/java/im/status/keycard/connect/ui/PINActivity.kt index 3ce04a1..9ba8077 100644 --- a/app/src/main/java/im/status/keycard/connect/PINActivity.kt +++ b/app/src/main/java/im/status/keycard/connect/ui/PINActivity.kt @@ -1,12 +1,12 @@ -package im.status.keycard.connect +package im.status.keycard.connect.ui import android.app.Activity import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View -import android.view.View.INVISIBLE import android.widget.EditText import android.widget.TextView +import im.status.keycard.connect.R import im.status.keycard.connect.data.PINCache const val PIN_ACTIVITY_ATTEMPTS = "remainingAttempts" diff --git a/app/src/main/java/im/status/keycard/connect/PairingActivity.kt b/app/src/main/java/im/status/keycard/connect/ui/PairingActivity.kt similarity index 68% rename from app/src/main/java/im/status/keycard/connect/PairingActivity.kt rename to app/src/main/java/im/status/keycard/connect/ui/PairingActivity.kt index 8236165..24a45f7 100644 --- a/app/src/main/java/im/status/keycard/connect/PairingActivity.kt +++ b/app/src/main/java/im/status/keycard/connect/ui/PairingActivity.kt @@ -1,14 +1,12 @@ -package im.status.keycard.connect +package im.status.keycard.connect.ui import android.app.Activity import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.EditText -import im.status.keycard.connect.data.PINCache import android.content.Intent -import androidx.core.app.ComponentActivity.ExtraData -import androidx.core.content.ContextCompat.getSystemService +import im.status.keycard.connect.R const val PAIRING_ACTIVITY_PASSWORD = "pairingPassword" @@ -21,7 +19,10 @@ class PairingActivity : AppCompatActivity() { fun ok(view: View) { val intent = Intent() - intent.putExtra(PAIRING_ACTIVITY_PASSWORD, findViewById(R.id.passwordText).text.toString()) + intent.putExtra( + PAIRING_ACTIVITY_PASSWORD, findViewById( + R.id.passwordText + ).text.toString()) setResult(Activity.RESULT_OK, intent) finish() } diff --git a/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardFragment.kt b/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardFragment.kt deleted file mode 100644 index 46c44c8..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardFragment.kt +++ /dev/null @@ -1,26 +0,0 @@ -package im.status.keycard.connect.ui.dashboard - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders -import im.status.keycard.connect.R - -class DashboardFragment : Fragment() { - - private lateinit var dashboardViewModel: DashboardViewModel - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - dashboardViewModel = ViewModelProviders.of(this).get(DashboardViewModel::class.java) - val root = inflater.inflate(R.layout.fragment_dashboard, container, false) - val textView: TextView = root.findViewById(R.id.text_dashboard) - dashboardViewModel.text.observe(this, Observer { - textView.text = it - }) - return root - } -} \ No newline at end of file diff --git a/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardViewModel.kt b/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardViewModel.kt deleted file mode 100644 index bbee304..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/dashboard/DashboardViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package im.status.keycard.connect.ui.dashboard - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class DashboardViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is dashboard Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/java/im/status/keycard/connect/ui/home/HomeFragment.kt b/app/src/main/java/im/status/keycard/connect/ui/home/HomeFragment.kt deleted file mode 100644 index 47c3bd9..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/home/HomeFragment.kt +++ /dev/null @@ -1,29 +0,0 @@ -package im.status.keycard.connect.ui.home - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders -import im.status.keycard.connect.R - -class HomeFragment : Fragment() { - - private lateinit var homeViewModel: HomeViewModel - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - homeViewModel = ViewModelProviders.of(this).get(HomeViewModel::class.java) - - val root = inflater.inflate(R.layout.fragment_home, container, false) - val textView: TextView = root.findViewById(R.id.text_home) - - homeViewModel.text.observe(this, Observer { - textView.text = it - }) - - return root - } -} \ No newline at end of file diff --git a/app/src/main/java/im/status/keycard/connect/ui/home/HomeViewModel.kt b/app/src/main/java/im/status/keycard/connect/ui/home/HomeViewModel.kt deleted file mode 100644 index 328ca72..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/home/HomeViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package im.status.keycard.connect.ui.home - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class HomeViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is home Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsFragment.kt b/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsFragment.kt deleted file mode 100644 index 149e1dc..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsFragment.kt +++ /dev/null @@ -1,25 +0,0 @@ -package im.status.keycard.connect.ui.notifications - -import android.os.Bundle -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer -import androidx.lifecycle.ViewModelProviders -import im.status.keycard.connect.R - -class NotificationsFragment : Fragment() { - private lateinit var notificationsViewModel: NotificationsViewModel - - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { - notificationsViewModel = ViewModelProviders.of(this).get(NotificationsViewModel::class.java) - val root = inflater.inflate(R.layout.fragment_notifications, container, false) - val textView: TextView = root.findViewById(R.id.text_notifications) - notificationsViewModel.text.observe(this, Observer { - textView.text = it - }) - return root - } -} \ No newline at end of file diff --git a/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsViewModel.kt b/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsViewModel.kt deleted file mode 100644 index c45a6ab..0000000 --- a/app/src/main/java/im/status/keycard/connect/ui/notifications/NotificationsViewModel.kt +++ /dev/null @@ -1,13 +0,0 @@ -package im.status.keycard.connect.ui.notifications - -import androidx.lifecycle.LiveData -import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel - -class NotificationsViewModel : ViewModel() { - - private val _text = MutableLiveData().apply { - value = "This is notifications Fragment" - } - val text: LiveData = _text -} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml deleted file mode 100644 index 46fc8de..0000000 --- a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml deleted file mode 100644 index f8bb0b5..0000000 --- a/app/src/main/res/drawable/ic_home_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml deleted file mode 100644 index 78b75c3..0000000 --- a/app/src/main/res/drawable/ic_notifications_black_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/layout/activity_init.xml b/app/src/main/res/layout/activity_init.xml index 7fac678..bbafa1d 100644 --- a/app/src/main/res/layout/activity_init.xml +++ b/app/src/main/res/layout/activity_init.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".InitActivity"> + tools:context=".ui.InitActivity"> - - - - + android:paddingTop="?attr/actionBarSize" + tools:context=".ui.MainActivity"> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_pairing.xml b/app/src/main/res/layout/activity_pairing.xml index 88e3a03..488b4c9 100644 --- a/app/src/main/res/layout/activity_pairing.xml +++ b/app/src/main/res/layout/activity_pairing.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".PairingActivity"> + tools:context=".ui.PairingActivity"> + tools:context=".ui.PINActivity"> - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml deleted file mode 100644 index fba9341..0000000 --- a/app/src/main/res/layout/fragment_home.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml deleted file mode 100644 index 69bb426..0000000 --- a/app/src/main/res/layout/fragment_notifications.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_nav_menu.xml b/app/src/main/res/menu/bottom_nav_menu.xml deleted file mode 100644 index f4de4f8..0000000 --- a/app/src/main/res/menu/bottom_nav_menu.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml deleted file mode 100644 index e256867..0000000 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 883b12d..c4bbfa8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,8 +1,5 @@ Keycard Connect - Home - Dashboard - Notifications Insert your PIN %1$d retries left Insert your pairing password