Archived
Edited the Food Fragment Kotlin file, small changes to Settings Java, changed RecyclerView in Food Layout to match_parent
This commit is contained in:
+66
-13
@@ -1,13 +1,66 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -53,6 +53,7 @@ dependencies {
|
||||
annotationProcessor "androidx.room:room-compiler:$room_version"
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1"
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -1,4 +1,61 @@
|
||||
package com.denizd.substitutionplan
|
||||
|
||||
class FoodFragment {
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.madapps.prefrences.EasyPrefrences
|
||||
|
||||
class FoodFragment : Fragment(R.layout.food_layout) {
|
||||
|
||||
private lateinit var foodArrayList: ArrayList<Food>
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private val mAdapter = FoodAdapter(foodArrayList)
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.food_layout, null)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val pullToRefresh = getView()?.findViewById(R.id.pullToRefresh) as SwipeRefreshLayout
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(activity) as SharedPreferences
|
||||
val edit = prefs.edit() as SharedPreferences.Editor
|
||||
val easyPrefs = EasyPrefrences(context!!)
|
||||
val foodListPopulation = ArrayList<String>(easyPrefs.getListString("foodListPrefs"))
|
||||
|
||||
try {
|
||||
recyclerView = getView()?.findViewById(R.id.linear_food) as RecyclerView
|
||||
recyclerView.hasFixedSize()
|
||||
recyclerView.layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL ,false)
|
||||
recyclerView.adapter = mAdapter
|
||||
|
||||
try {
|
||||
recyclerView.removeAllViews()
|
||||
} catch (e: NullPointerException) {}
|
||||
|
||||
for (i in 0..foodListPopulation.size) {
|
||||
foodArrayList.add(Food(foodListPopulation[i]))
|
||||
mAdapter.setFood(foodArrayList)
|
||||
recyclerView.scheduleLayoutAnimation()
|
||||
}
|
||||
} catch (e: NullPointerException) {}
|
||||
|
||||
if (prefs.getBoolean("autoRefresh", false)) {
|
||||
pullToRefresh.isRefreshing = true
|
||||
// coroutines
|
||||
}
|
||||
|
||||
pullToRefresh.setOnRefreshListener {
|
||||
pullToRefresh.isRefreshing = true
|
||||
// coroutines
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -556,7 +556,7 @@ public class FragmentSettings extends Fragment {
|
||||
alertDialogDev.setView(dialogView);
|
||||
alertDialogDev.show();
|
||||
|
||||
} else if (dialogEditText.getText().toString().equals("Tim Bergling")) {
|
||||
} else if (dialogEditText.getText().toString().equals("2018-04-20")) {
|
||||
Toast.makeText(getActivity(), "◢ ◤",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/linear_food"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
Reference in New Issue
Block a user