Skip to content

Commit

Permalink
check context - still broken C
Browse files Browse the repository at this point in the history
  • Loading branch information
MatrixMike committed May 6, 2021
1 parent 297fa6c commit fd77853
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.electroteach.mytabs"
Expand All @@ -27,13 +27,13 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.electroteach.mytabs
package consulting.hewittenterprises.gearstabs

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.electroteach.mytabs.ui.main.SectionsPagerAdapter
import consulting.hewittenterprises.gearstabs.MainActivity // TODD
import com.electroteach.mytabs.R // TODO
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
Expand All @@ -14,10 +15,13 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager)
// TODO content changes around here
val viewPager: ViewPager = findViewById(R.id.view_pager)
viewPager.adapter = sectionsPagerAdapter

val tabs: TabLayout = findViewById(R.id.tabs)
tabs.setupWithViewPager(viewPager)

val fab: FloatingActionButton = findViewById(R.id.fab)

fab.setOnClickListener { view ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.electroteach.mytabs.ui.main
package consulting.hewittenterprises.gearstabs

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.electroteach.mytabs.ui.main
package consulting.hewittenterprises.gearstabs

import android.os.Bundle
import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.electroteach.mytabs.ui.main
package consulting.hewittenterprises.gearstabs

import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.electroteach.mytabs.R
import consulting.hewittenterprises.gearstabs.PlaceholderFragment
import kotlin.Int as KotlinInt

private val TAB_TITLES = arrayOf(
Expand All @@ -26,7 +27,7 @@ class SectionsPagerAdapter(private val context: Context, fm: FragmentManager) :
return PlaceholderFragment.newInstance(position + 1)
}

override fun getPageTitle(position: KotlinInt): CharSequence? {
override fun getPageTitle(position: KotlinInt): CharSequence {
return context.resources.getString(TAB_TITLES[position] as KotlinInt)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package consulting.hewittenterprises.gearstabs

fun gearsOut(): String {
// val gearsRatio = listOf(0.0)
val gearsRatio: MutableList<Double> = mutableListOf()
Expand All @@ -15,7 +17,7 @@ fun gearsOut(): String {
) // number of teeth on gear is an integer
for (f in frontGears) {
for (r in rearGears) {
formatted = formatted + String.format("*%.2f %.2f %.2f \n", f / r, f, r)
formatted += String.format("*%.2f %.2f %.2f \n", f / r, f, r)
gearsRatio.add(f / r)
}
println("next f")
Expand All @@ -24,7 +26,7 @@ fun gearsOut(): String {
// now the sorted list
gearsRatio
.sortedBy { it }
.forEach { formatted = formatted + String.format("# %.2f \n", it) }
.forEach { formatted += String.format("# %.2f \n", it) }
// .forEach{ println("%6.2f ".format(it))}
return formatted
}
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.72"
ext.kotlin_version = "1.4.31" // was "1.3.72"
repositories {
google()
jcenter()
jcenter() // TODO
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -17,7 +17,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
jcenter() // TODO
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

0 comments on commit fd77853

Please # to comment.