-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
PennMobile/src/main/java/com/pennapps/labs/pennmobile/SubletteeFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.pennapps.labs.pennmobile | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
|
||
// TODO: Rename parameter arguments, choose names that match | ||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
private const val ARG_PARAM1 = "param1" | ||
private const val ARG_PARAM2 = "param2" | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [SubletteeFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
class SubletteeFragment : Fragment() { | ||
|
||
|
||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_sublettee_view, container, false) | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
PennMobile/src/main/java/com/pennapps/labs/pennmobile/SubletterFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.pennapps.labs.pennmobile | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
|
||
// TODO: Rename parameter arguments, choose names that match | ||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | ||
private const val ARG_PARAM1 = "param1" | ||
private const val ARG_PARAM2 = "param2" | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [SubletterFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
*/ | ||
class SubletterFragment : Fragment() { | ||
|
||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
return inflater.inflate(R.layout.fragment_subletter_view, container, false) | ||
} | ||
|
||
|
||
|
||
} |
15 changes: 15 additions & 0 deletions
15
PennMobile/src/main/java/com/pennapps/labs/pennmobile/SublettingAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.pennapps.labs.pennmobile | ||
|
||
import androidx.fragment.app.Fragment | ||
import androidx.viewpager2.adapter.FragmentStateAdapter | ||
|
||
class SublettingAdapter(fm: Fragment) : FragmentStateAdapter(fm) { | ||
override fun getItemCount(): Int = 2 | ||
override fun createFragment(position: Int): Fragment { | ||
return if (position == 0) { | ||
SubletterFragment() | ||
} else { | ||
SubletteeFragment() | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
PennMobile/src/main/java/com/pennapps/labs/pennmobile/SublettingFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.pennapps.labs.pennmobile | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.coordinatorlayout.widget.CoordinatorLayout | ||
import androidx.viewpager.widget.ViewPager | ||
import com.google.android.material.tabs.TabLayout | ||
import com.pennapps.labs.pennmobile.adapters.DiningPagerAdapter | ||
import com.pennapps.labs.pennmobile.components.collapsingtoolbar.ToolbarBehavior | ||
import com.pennapps.labs.pennmobile.utils.Utils | ||
import kotlinx.android.synthetic.main.fragment_dining.view.dining_swiperefresh | ||
import kotlinx.android.synthetic.main.fragment_dining_holder.view.appbar_home_holder | ||
import kotlinx.android.synthetic.main.fragment_dining_holder.view.date_view | ||
import kotlinx.android.synthetic.main.fragment_gsr_tabs.view.appbar_home | ||
import kotlinx.android.synthetic.main.fragment_gsr_tabs.view.date_view | ||
import kotlinx.android.synthetic.main.fragment_gsr_tabs.view.title_view | ||
import kotlinx.android.synthetic.main.include_main.toolbar | ||
|
||
/** | ||
* A simple [Fragment] subclass. | ||
* Use the [SublettingFragment.newInstance] factory method to | ||
* create an instance of this fragment. | ||
* https://tutorials.eu/viewpager2-with-fragmentstateadapter-in-android/ | ||
*/ | ||
class SublettingFragment : Fragment() { | ||
lateinit var pagerAdapter: SublettingAdapter | ||
private lateinit var mActivity: MainActivity | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
mActivity = activity as MainActivity | ||
mActivity.closeKeyboard() | ||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
val view = inflater.inflate(R.layout.fragment_subletting, container, false) | ||
initAppBar(view) | ||
// Inflate the layout for this fragment | ||
return view | ||
} | ||
|
||
|
||
private fun initAppBar(view: View) { | ||
(view.appbar_home_holder.layoutParams as CoordinatorLayout.LayoutParams).behavior = ToolbarBehavior() | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
14 changes: 14 additions & 0 deletions
14
PennMobile/src/main/res/layout/fragment_sublettee_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="sublettee" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
13 changes: 13 additions & 0 deletions
13
PennMobile/src/main/res/layout/fragment_subletter_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="subletter" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent"/> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?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=".MainActivity"> | ||
|
||
<androidx.viewpager2.widget.ViewPager2 | ||
android:id="@+id/viewPager2" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<com.google.android.material.tabs.TabLayout | ||
android:id="@+id/subletting_tab_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
</androidx.viewpager2.widget.ViewPager2> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters