From f6098e9ed4019a49208d4681a9b5f55a6711ab59 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 12 May 2020 20:10:51 -0700 Subject: [PATCH] Start working on statistics menu. --- app/build.gradle | 12 +++++---- app/src/main/AndroidManifest.xml | 3 ++- .../danilafe/fencelessgrazing/MainActivity.kt | 1 + .../fencelessgrazing/StatisticsActivity.kt | 26 ++++++++++++++++++ .../main/res/layout/activity_statistics.xml | 27 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 app/src/main/java/com/danilafe/fencelessgrazing/StatisticsActivity.kt create mode 100644 app/src/main/res/layout/activity_statistics.xml diff --git a/app/build.gradle b/app/build.gradle index a0aae65..9e314c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,22 +25,24 @@ android { repositories { mavenCentral() + google() maven { url 'https://jitpack.io' } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.core:core-ktx:1.0.2' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.android.volley:volley:1.1.1' implementation 'com.google.code.gson:gson:2.8.6' testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'org.osmdroid:osmdroid-android:6.1.5' - implementation "androidx.preference:preference-ktx:1.1.0" + implementation "androidx.preference:preference-ktx:1.1.1" implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' + implementation 'com.google.android.material:material:1.1.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a983e9c..96973c7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,8 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + + diff --git a/app/src/main/java/com/danilafe/fencelessgrazing/MainActivity.kt b/app/src/main/java/com/danilafe/fencelessgrazing/MainActivity.kt index 8450e0f..3cf4cf3 100644 --- a/app/src/main/java/com/danilafe/fencelessgrazing/MainActivity.kt +++ b/app/src/main/java/com/danilafe/fencelessgrazing/MainActivity.kt @@ -15,6 +15,7 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + startActivity(Intent(this, StatisticsActivity::class.java)) } fun attemptLogin(view: View) { diff --git a/app/src/main/java/com/danilafe/fencelessgrazing/StatisticsActivity.kt b/app/src/main/java/com/danilafe/fencelessgrazing/StatisticsActivity.kt new file mode 100644 index 0000000..1769e1e --- /dev/null +++ b/app/src/main/java/com/danilafe/fencelessgrazing/StatisticsActivity.kt @@ -0,0 +1,26 @@ +package com.danilafe.fencelessgrazing + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import androidx.viewpager.widget.ViewPager +import androidx.viewpager2.widget.ViewPager2 +import com.google.android.material.tabs.TabLayout +import com.google.android.material.tabs.TabLayoutMediator + +class StatisticsActivity : AppCompatActivity() { + + private lateinit var tabLayout: TabLayout + private lateinit var viewPager: ViewPager2 + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_statistics) + + tabLayout = findViewById(R.id.statisticsTabs) + viewPager = findViewById(R.id.statisticsPager) + + TabLayoutMediator(tabLayout, viewPager) { tab, position -> + tab.text = "Tab ${position + 1}" + } + } +} diff --git a/app/src/main/res/layout/activity_statistics.xml b/app/src/main/res/layout/activity_statistics.xml new file mode 100644 index 0000000..3f9774f --- /dev/null +++ b/app/src/main/res/layout/activity_statistics.xml @@ -0,0 +1,27 @@ + + + + + + + + + \ 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 fc2c294..469f1e3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,4 +6,5 @@ http://dev.danilafe.com:8090 Currently at %1f, %2f Required %1d stimuli in the last 24 hours + Distance Traveled