Kaynağa Gözat

Added a kotlin Activity

Thomas Chef 3 yıl önce
ebeveyn
işleme
af32860d46

+ 1 - 0
.idea/misc.xml

@@ -4,6 +4,7 @@
     <option name="filePathToZoomLevelMap">
       <map>
         <entry key="app/src/main/res/layout/activity_main.xml" value="0.375" />
+        <entry key="app/src/main/res/layout/activity_main_screen.xml" value="0.16770833333333332" />
       </map>
     </option>
   </component>

+ 1 - 0
app/build.gradle

@@ -1,5 +1,6 @@
 plugins {
     id 'com.android.application'
+    id 'org.jetbrains.kotlin.android'
 }
 
 android {

+ 9 - 8
app/src/main/AndroidManifest.xml

@@ -6,14 +6,6 @@
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 
-    <!-- Recommended for Android 9 (API level 28) and lower. -->
-    <!-- Required for Android 10 (API level 29) and higher. -->
-    <!--<service
-        android:name="MyNavigationService"
-        android:foregroundServiceType="location"
- Any inner elements would go here.
-</service>-->
-
     <application
         android:allowBackup="true"
         android:dataExtractionRules="@xml/data_extraction_rules"
@@ -24,6 +16,15 @@
         android:supportsRtl="true"
         android:theme="@style/Theme.JourneyGPSTracker"
         tools:targetApi="31">
+        <activity
+            android:name=".MainScreenActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
         <activity
             android:name=".MainActivity"
             android:exported="true">

+ 12 - 0
app/src/main/java/com/flacksta/chef/journeygpstracker/MainScreenActivity.kt

@@ -0,0 +1,12 @@
+package com.flacksta.chef.journeygpstracker
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+
+class MainScreenActivity : AppCompatActivity() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_main_screen)
+    }
+}

+ 30 - 0
app/src/main/res/layout/activity_main_screen.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".MainScreenActivity">
+
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:text="Thomas Kotlin Activity"
+        android:textSize="20sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <Switch
+        android:id="@+id/switch1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="8dp"
+        android:text="Enable Tracking"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
build.gradle

@@ -2,6 +2,7 @@
 plugins {
     id 'com.android.application' version '7.2.1' apply false
     id 'com.android.library' version '7.2.1' apply false
+    id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
 }
 
 task clean(type: Delete) {