Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
msoucy committed Apr 16, 2021
1 parent c0de58b commit 70e313a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
8 changes: 2 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.4.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0-beta01'
implementation group: 'com.google.zxing', name: 'core', version: '3.3.3'
implementation group: 'com.google.zxing', name: 'core', version: '3.4.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
Expand Down
21 changes: 10 additions & 11 deletions app/src/main/java/com/chopshop166/cssignin/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.chopshop166.cssignin
import android.os.Bundle
import android.text.InputType
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.commit
import androidx.preference.EditTextPreference
import androidx.preference.PreferenceFragmentCompat

Expand All @@ -11,10 +12,9 @@ class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.settings_activity)
supportFragmentManager
.beginTransaction()
.replace(R.id.settings, SettingsFragment())
.commit()
supportFragmentManager.commit {
replace(R.id.settings, SettingsFragment())
}
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

Expand All @@ -23,16 +23,15 @@ class SettingsActivity : AppCompatActivity() {
setPreferencesFromResource(R.xml.root_preferences, rootKey)
setHasOptionsMenu(true)

val firstNamePreference = findPreference<EditTextPreference>("firstname_text")
firstNamePreference?.setOnBindEditTextListener { editText ->
val listener = EditTextPreference.OnBindEditTextListener { editText ->
editText.inputType = InputType.TYPE_TEXT_VARIATION_PERSON_NAME
editText.setSelectAllOnFocus(true)
editText.setSingleLine()
editText.maxLines = 1
}


val lastNamePreference = findPreference<EditTextPreference>("lastname_text")
lastNamePreference?.setOnBindEditTextListener { editText ->
editText.inputType = InputType.TYPE_TEXT_VARIATION_PERSON_NAME
}
findPreference<EditTextPreference>("firstname_text")?.setOnBindEditTextListener(listener)
findPreference<EditTextPreference>("lastname_text")?.setOnBindEditTextListener(listener)
}
}
}

0 comments on commit 70e313a

Please sign in to comment.