Skip to content

Commit fe57399

Browse files
committed
the one before theme change and with a calendar activity
1 parent 4d03558 commit fe57399

File tree

5 files changed

+119
-2
lines changed

5 files changed

+119
-2
lines changed
0 Bytes
Binary file not shown.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/org/codedocs/codedocsapp/MainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class MainActivity : AppCompatActivity() {
3030
R.id.xweird -> {
3131
val fm=supportFragmentManager
3232
val ft=fm.beginTransaction()
33-
33+
val fragment=calander()
34+
ft.replace(R.id.container,fragment).addToBackStack(null).commit();
3435
return@OnNavigationItemSelectedListener true
3536
}
3637
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package org.codedocs.codedocsapp
2+
3+
import android.content.Context
4+
import android.net.Uri
5+
import android.os.Bundle
6+
import android.support.v4.app.Fragment
7+
import android.view.LayoutInflater
8+
import android.view.View
9+
import android.view.ViewGroup
10+
11+
12+
// TODO: Rename parameter arguments, choose names that match
13+
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
14+
private const val ARG_PARAM1 = "param1"
15+
private const val ARG_PARAM2 = "param2"
16+
17+
/**
18+
* A simple [Fragment] subclass.
19+
* Activities that contain this fragment must implement the
20+
* [calander.OnFragmentInteractionListener] interface
21+
* to handle interaction events.
22+
* Use the [calander.newInstance] factory method to
23+
* create an instance of this fragment.
24+
*
25+
*/
26+
class calander : Fragment() {
27+
var mView:View?=null
28+
// TODO: Rename and change types of parameters
29+
private var param1: String? = null
30+
private var param2: String? = null
31+
private var listener: OnFragmentInteractionListener? = null
32+
33+
override fun onCreate(savedInstanceState: Bundle?) {
34+
super.onCreate(savedInstanceState)
35+
arguments?.let {
36+
param1 = it.getString(ARG_PARAM1)
37+
param2 = it.getString(ARG_PARAM2)
38+
}
39+
}
40+
41+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
42+
savedInstanceState: Bundle?): View? {
43+
mView=inflater.inflate(R.layout.fragment_calander, container, false)
44+
return mView
45+
}
46+
47+
// TODO: Rename method, update argument and hook method into UI event
48+
fun onButtonPressed(uri: Uri) {
49+
listener?.onFragmentInteraction(uri)
50+
}
51+
52+
override fun onAttach(context: Context) {
53+
super.onAttach(context)
54+
if (context is OnFragmentInteractionListener) {
55+
listener = context
56+
} else {
57+
58+
}
59+
}
60+
61+
override fun onDetach() {
62+
super.onDetach()
63+
listener = null
64+
}
65+
66+
/**
67+
* This interface must be implemented by activities that contain this
68+
* fragment to allow an interaction in this fragment to be communicated
69+
* to the activity and potentially other fragments contained in that
70+
* activity.
71+
*
72+
*
73+
* See the Android Training lesson [Communicating with Other Fragments]
74+
* (http://developer.android.com/training/basics/fragments/communicating.html)
75+
* for more information.
76+
*/
77+
interface OnFragmentInteractionListener {
78+
// TODO: Update argument type and name
79+
fun onFragmentInteraction(uri: Uri)
80+
}
81+
82+
companion object {
83+
/**
84+
* Use this factory method to create a new instance of
85+
* this fragment using the provided parameters.
86+
*
87+
* @param param1 Parameter 1.
88+
* @param param2 Parameter 2.
89+
* @return A new instance of fragment calander.
90+
*/
91+
// TODO: Rename and change types and number of parameters
92+
@JvmStatic
93+
fun newInstance(param1: String, param2: String) =
94+
calander().apply {
95+
arguments = Bundle().apply {
96+
putString(ARG_PARAM1, param1)
97+
putString(ARG_PARAM2, param2)
98+
}
99+
}
100+
}
101+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
tools:context=".calander"
7+
android:orientation="vertical">
8+
9+
<CalendarView
10+
android:id="@+id/calander"
11+
android:layout_width="match_parent"
12+
android:layout_height="wrap_content"/>
13+
14+
15+
</LinearLayout>

0 commit comments

Comments
 (0)