From bff5795f8f372f81d95ed979e2ca3137c180d0b3 Mon Sep 17 00:00:00 2001 From: Yogesh Kumar Date: Sat, 12 Dec 2020 12:18:12 +0530 Subject: [PATCH] timetable-updated --- app/src/main/assets/timetable/cs1sem.json | 107 ++++++++++++------ app/src/main/assets/timetable/csai1sem.json | 86 ++++++++++++++ app/src/main/assets/timetable/it1sem.json | 105 +++++++++++------ .../app/activities/AskDetailActivity.java | 29 ++++- .../app/activities/TimeTableActivity.java | 30 +++-- .../iiitl/app/adapter/PagerViewAdapter.kt | 6 +- .../iiitl/app/fragments/timetable/Sat.kt | 49 ++++++++ .../iiitl/app/fragments/timetable/Sun.kt | 49 ++++++++ app/src/main/res/layout/fragment_sat.xml | 45 ++++++++ app/src/main/res/layout/fragment_sun.xml | 45 ++++++++ app/src/main/res/layout/tab_bar.xml | 32 +++++- app/src/main/res/values/strings.xml | 1 + 12 files changed, 503 insertions(+), 81 deletions(-) create mode 100644 app/src/main/assets/timetable/csai1sem.json create mode 100644 app/src/main/java/govind/iiitl/app/fragments/timetable/Sat.kt create mode 100644 app/src/main/java/govind/iiitl/app/fragments/timetable/Sun.kt create mode 100644 app/src/main/res/layout/fragment_sat.xml create mode 100644 app/src/main/res/layout/fragment_sun.xml diff --git a/app/src/main/assets/timetable/cs1sem.json b/app/src/main/assets/timetable/cs1sem.json index b0c436a..f89efb1 100644 --- a/app/src/main/assets/timetable/cs1sem.json +++ b/app/src/main/assets/timetable/cs1sem.json @@ -1,47 +1,86 @@ { "Monday": { - "9:00-10:00": "SM130", - "10:00-11:00": "FEE132", - "11:00-11:15": "Break", - "11:15-12:15": "LA130", - "12:15-1:15": "IITP132", - "1:15-3:00": "Lunch", - "3:00-6:00": "FEE132 LAB" + "08:00-09:00": "-", + "09:00-10:00": "PC130", + "10:00-11:00": "-", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "IITP132", + "14:00-15:00": "IITP132 LAB", + "15:00-16:00": "IITP132 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" }, "Tuesday": { - "9:00-10:00": "SM130", - "10:00-11:00": "LA130", - "11:00-11:15": "Break", - "11:15-12:15": "FEE132", - "12:15-1:15": "IITP132", - "1:15-3:00": "Lunch", - "3:00-6:00": "IITP132 LAB" + "08:00-09:00": "-", + "09:00-10:00": "IITP132", + "10:00-11:00": "-", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "", + "14:00-15:00": "", + "15:00-16:00": "IITP132 LAB", + "16:00-17:00": "IITP132 LAB", + "17:00-18:00": "" }, "Wednesday": { - "9:00-10:00": "IITP132", - "10:00-11:00": "PC130", - "11:00-11:15": "Break", - "11:15-12:15": "LA130", - "12:15-1:15": "FEE132", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "IITP132", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "", + "14:00-15:00": "", + "15:00-16:00": "FEE132 LAB", + "16:00-17:00": "FEE132 LAB", + "17:00-18:00": "" }, "Thursday": { - "9:00-10:00": "PC130", - "10:00-11:00": "SM130", - "11:00-11:15": "Break", - "11:15-12:15": "-", - "12:15-1:15": "-", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "-", + "11:00-12:00": "PC130", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:00-17:00": "-", + "17:00-18:00": "-" }, "Friday": { - "9:00-10:00": "PC130", + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "-", + "11:00-12:00": "PC130", + "12:00-12:15": "Break", + "12:15-13:15": "FEE132 LAB", + "14:00-15:00": "FEE132 LAB", + "15:00-16:00": "-", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Saturday": { + "08:00-09:00": "-", + "09:00-10:00": "SM130", + "10:00-11:00": "-", + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "SM130 LAB", + "15:00-16:00": "SM130 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Sunday": { + "08:00-09:00": "-", + "09:00-10:00": "-", "10:00-11:00": "-", - "11:00-11:15": "Break", - "11:15-12:15": "-", - "12:15-1:15": "-", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "11:00-12:00": "SM130", + "12:00-12:15": "Break", + "12:15-13:15": "SM130", + "14:00-15:00": "SM130 LAB", + "15:00-16:00": "SM130 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" } } diff --git a/app/src/main/assets/timetable/csai1sem.json b/app/src/main/assets/timetable/csai1sem.json new file mode 100644 index 0000000..f89efb1 --- /dev/null +++ b/app/src/main/assets/timetable/csai1sem.json @@ -0,0 +1,86 @@ +{ + "Monday": { + "08:00-09:00": "-", + "09:00-10:00": "PC130", + "10:00-11:00": "-", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "IITP132", + "14:00-15:00": "IITP132 LAB", + "15:00-16:00": "IITP132 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Tuesday": { + "08:00-09:00": "-", + "09:00-10:00": "IITP132", + "10:00-11:00": "-", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "", + "14:00-15:00": "", + "15:00-16:00": "IITP132 LAB", + "16:00-17:00": "IITP132 LAB", + "17:00-18:00": "" + }, + "Wednesday": { + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "IITP132", + "11:00-12:00": "Calc", + "12:00-12:15": "Break", + "12:15-13:15": "", + "14:00-15:00": "", + "15:00-16:00": "FEE132 LAB", + "16:00-17:00": "FEE132 LAB", + "17:00-18:00": "" + }, + "Thursday": { + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "-", + "11:00-12:00": "PC130", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Friday": { + "08:00-09:00": "Sports-1", + "09:00-10:00": "FEE132", + "10:00-11:00": "-", + "11:00-12:00": "PC130", + "12:00-12:15": "Break", + "12:15-13:15": "FEE132 LAB", + "14:00-15:00": "FEE132 LAB", + "15:00-16:00": "-", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Saturday": { + "08:00-09:00": "-", + "09:00-10:00": "SM130", + "10:00-11:00": "-", + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "SM130 LAB", + "15:00-16:00": "SM130 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" + }, + "Sunday": { + "08:00-09:00": "-", + "09:00-10:00": "-", + "10:00-11:00": "-", + "11:00-12:00": "SM130", + "12:00-12:15": "Break", + "12:15-13:15": "SM130", + "14:00-15:00": "SM130 LAB", + "15:00-16:00": "SM130 LAB", + "16:00-17:00": "-", + "17:00-18:00": "-" + } +} diff --git a/app/src/main/assets/timetable/it1sem.json b/app/src/main/assets/timetable/it1sem.json index 5ac0dcd..fa64bce 100644 --- a/app/src/main/assets/timetable/it1sem.json +++ b/app/src/main/assets/timetable/it1sem.json @@ -1,47 +1,86 @@ { "Monday": { - "9:00-10:00": "LA132", + "08:00-09:00": "Sports-1", + "09:00-10:00": "Calc", "10:00-11:00": "IITP132", - "11:00-11:15": "Break", - "11:15-12:15": "SM130", - "12:15-1:15": "FEE132", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "FEE132", + "15:00-16:00": "-", + "16:30-17:30": "IITP132 LAB", + "17:30-18:30": "IITP132 LAB" }, "Tuesday": { - "9:00-10:00": "FEE132", + "08:00-09:00": "Sports-1", + "09:00-10:00": "Calc", "10:00-11:00": "PC130", - "11:00-11:15": "Break", - "11:15-12:15": "IITP132", - "12:15-1:15": "SM130", - "1:15-3:00": "Lunch", - "3:00-6:00": "IITP132 LAB" + "11:00-12:00": "IITP132", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:30-17:30": "-", + "17:30-18:30": "-" }, "Wednesday": { - "9:00-10:00": "LA130", - "10:00-11:00": "FEE132", - "11:00-11:15": "Break", - "11:15-12:15": "SM130", - "12:15-1:15": "IITP132", - "1:15-3:00": "Lunch", - "3:00-6:00": "FEE132 LAB" + "08:00-09:00": "Sports-1", + "09:00-10:00": "Calc", + "10:00-11:00": "-", + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "IITP132", + "14:00-15:00": "-", + "15:00-16:00": "FEE132 LAB", + "16:30-17:30": "FEE132 LAB", + "17:30-18:30": "-" }, "Thursday": { - "9:00-10:00": "LA130", - "10:00-11:00": "PC130", - "11:00-11:15": "Break", - "11:15-12:15": "-", - "12:15-1:15": "-", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "08:00-09:00": "-", + "09:00-10:00": "PC130", + "10:00-11:00": "-", + "11:00-12:00": "FEE132", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:30-17:30": "FEE132 LAB", + "17:30-18:30": "FEE132 LAB" }, "Friday": { - "9:00-10:00": "-", - "10:00-11:00": "PC130", - "11:00-11:15": "Break", - "11:15-12:15": "-", - "12:15-1:15": "-", - "1:15-3:00": "Lunch", - "3:00-6:00": "-" + "08:00-09:00": "-", + "09:00-10:00": "PC130", + "10:00-11:00": "-", + "11:00-12:00": "FEE132", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:30-17:30": "FEE132 LAB", + "17:30-18:30": "FEE132 LAB" + }, + "Saturday": { + "08:00-09:00": "-", + "09:00-10:00": "-", + "10:00-11:00": "SM130", + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:30-17:30": "SM130 LAB", + "17:30-18:30": "SM130 LAB" + }, + "Sunday": { + "08:00-09:00": "-", + "09:00-10:00": "SM130", + "10:00-11:00": "SM130", + "11:00-12:00": "-", + "12:00-12:15": "Break", + "12:15-13:15": "-", + "14:00-15:00": "-", + "15:00-16:00": "-", + "16:30-17:30": "SM130 LAB", + "17:30-18:30": "SM130 LAB" } } diff --git a/app/src/main/java/govind/iiitl/app/activities/AskDetailActivity.java b/app/src/main/java/govind/iiitl/app/activities/AskDetailActivity.java index c4d9c38..f09044e 100644 --- a/app/src/main/java/govind/iiitl/app/activities/AskDetailActivity.java +++ b/app/src/main/java/govind/iiitl/app/activities/AskDetailActivity.java @@ -90,7 +90,34 @@ public void onClick(View view) { conc = "it8sem.json"; break; } - }else { + }else if(course.equals("CSAI (B.Tech)")){ + switch (yearse) { + case "1": + conc = "csai1sem.json"; + break; +// case "2": +// conc = "csai2sem.json"; +// break; +// case "3": +// conc = "csai3sem.json"; +// break; +// case "4": +// conc = "csai4sem.json"; +// break; +// case "5": +// conc = "csai5sem.json"; +// break; +// case "6": +// conc = "csai6sem.json"; +// break; +// case "7": +// conc = "csai7sem.json"; +// break; + default: + conc = "cs2sem.json"; + break; + } + } else{ switch (yearse) { case "1": conc = "mcs1sem.json"; diff --git a/app/src/main/java/govind/iiitl/app/activities/TimeTableActivity.java b/app/src/main/java/govind/iiitl/app/activities/TimeTableActivity.java index efc7222..2815a2e 100644 --- a/app/src/main/java/govind/iiitl/app/activities/TimeTableActivity.java +++ b/app/src/main/java/govind/iiitl/app/activities/TimeTableActivity.java @@ -14,7 +14,7 @@ public class TimeTableActivity extends AppCompatActivity { ViewPager viewPager; - TextView Mon,Tue,Wed,Thu,Fri; + TextView Mon,Tue,Wed,Thu,Fri,Sat,Sun; PagerViewAdapter pagerViewAdapter; @@ -30,6 +30,8 @@ protected void onCreate(Bundle savedInstanceState) { Wed = findViewById(R.id.Wed); Thu = findViewById(R.id.Thu); Fri = findViewById(R.id.Fri); + Sat = findViewById(R.id.Sat); + Sun = findViewById(R.id.Sun); Intent intent = getIntent(); s = intent.getStringExtra("cs2sem.json"); @@ -42,6 +44,8 @@ protected void onCreate(Bundle savedInstanceState) { Wed.setOnClickListener( (View view) -> viewPager.setCurrentItem(2)); Thu.setOnClickListener( (View view) -> viewPager.setCurrentItem(3)); Fri.setOnClickListener( (View view) -> viewPager.setCurrentItem(4)); + Sat.setOnClickListener( (View view) -> viewPager.setCurrentItem(5)); + Sun.setOnClickListener( (View view) -> viewPager.setCurrentItem(6)); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @@ -69,28 +73,40 @@ private void onChangeTab(int position) { Thu.setTextColor(white); Fri.setTextSize(20); Fri.setTextColor(white); + Sat.setTextSize(20); + Sat.setTextColor(white); + Sun.setTextSize(20); + Sun.setTextColor(white); switch(position){ case 0: - Mon.setTextSize(28); + Mon.setTextSize(25); Mon.setTextColor(accentColor); break; case 1: - Tue.setTextSize(28); + Tue.setTextSize(25); Tue.setTextColor(accentColor); break; case 2: - Wed.setTextSize(28); + Wed.setTextSize(25); Wed.setTextColor(accentColor); break; case 3: - Thu.setTextSize(28); + Thu.setTextSize(25); Thu.setTextColor(accentColor); break; - default: - Fri.setTextSize(28); + case 4: + Fri.setTextSize(25); Fri.setTextColor(accentColor); break; + case 5: + Sat.setTextSize(25); + Sat.setTextColor(accentColor); + break; + case 6: + Sun.setTextSize(25); + Sun.setTextColor(accentColor); + break; } } diff --git a/app/src/main/java/govind/iiitl/app/adapter/PagerViewAdapter.kt b/app/src/main/java/govind/iiitl/app/adapter/PagerViewAdapter.kt index 6ec4b0a..8c0e132 100644 --- a/app/src/main/java/govind/iiitl/app/adapter/PagerViewAdapter.kt +++ b/app/src/main/java/govind/iiitl/app/adapter/PagerViewAdapter.kt @@ -5,6 +5,8 @@ import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentPagerAdapter import govind.iiitl.app.fragments.timetable.Fri import govind.iiitl.app.fragments.timetable.Mon +import govind.iiitl.app.fragments.timetable.Sat +import govind.iiitl.app.fragments.timetable.Sun import govind.iiitl.app.fragments.timetable.Thu import govind.iiitl.app.fragments.timetable.Tue import govind.iiitl.app.fragments.timetable.Wed @@ -18,11 +20,13 @@ class PagerViewAdapter(fm: FragmentManager?) : FragmentPagerAdapter(fm!!) { 2 -> fragment = Wed() 3 -> fragment = Thu() 4 -> fragment = Fri() + 5 -> fragment = Sat() + 6 -> fragment = Sun() } return fragment!! } override fun getCount(): Int { - return 5 + return 7 } } \ No newline at end of file diff --git a/app/src/main/java/govind/iiitl/app/fragments/timetable/Sat.kt b/app/src/main/java/govind/iiitl/app/fragments/timetable/Sat.kt new file mode 100644 index 0000000..c2a411c --- /dev/null +++ b/app/src/main/java/govind/iiitl/app/fragments/timetable/Sat.kt @@ -0,0 +1,49 @@ +package govind.iiitl.app.fragments.timetable + +import android.os.Bundle +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 govind.iiitl.app.R +import govind.iiitl.app.activities.TimeTableActivity +import govind.iiitl.app.adapter.ListingAdapter +import govind.iiitl.app.models.Schedule +import govind.iiitl.app.utils.loadJsonFromAsset +import org.json.JSONException +import org.json.JSONObject +import java.util.* + +class Sat : Fragment() { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + val v = LayoutInflater.from(context).inflate(R.layout.fragment_fri, null) + val activity = (activity as TimeTableActivity?)!! + val s = activity.SendData() + try { + val obj = JSONObject(getActivity()?.let { loadJsonFromAsset(s, it) }) + val fri = obj.getJSONObject("Saturday") + val recyclerView: RecyclerView = v.findViewById(R.id.rec_timetable) + val list = ArrayList() + val keysToCopyIterator: Iterator<*> = fri.keys() + val keysList: MutableList = ArrayList() + while (keysToCopyIterator.hasNext()) { + val key = keysToCopyIterator.next() as String + keysList.add(key) + } + for (i in keysList.indices) { + val morning9 = fri.getString(keysList[i]) + // txt = txt + keysList.get(i)+ morning9 + "\n"; + list.add(Schedule(keysList[i], morning9)) + } + val adapter = context?.let { ListingAdapter(it, list) } + recyclerView.setHasFixedSize(true) + recyclerView.layoutManager = LinearLayoutManager(context) + recyclerView.adapter = adapter + } catch (e: JSONException) { + e.printStackTrace() + } + return v + } +} \ No newline at end of file diff --git a/app/src/main/java/govind/iiitl/app/fragments/timetable/Sun.kt b/app/src/main/java/govind/iiitl/app/fragments/timetable/Sun.kt new file mode 100644 index 0000000..bafceb3 --- /dev/null +++ b/app/src/main/java/govind/iiitl/app/fragments/timetable/Sun.kt @@ -0,0 +1,49 @@ +package govind.iiitl.app.fragments.timetable + +import android.os.Bundle +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 govind.iiitl.app.R +import govind.iiitl.app.activities.TimeTableActivity +import govind.iiitl.app.adapter.ListingAdapter +import govind.iiitl.app.models.Schedule +import govind.iiitl.app.utils.loadJsonFromAsset +import org.json.JSONException +import org.json.JSONObject +import java.util.* + +class Sun : Fragment() { + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + val v = LayoutInflater.from(context).inflate(R.layout.fragment_fri, null) + val activity = (activity as TimeTableActivity?)!! + val s = activity.SendData() + try { + val obj = JSONObject(getActivity()?.let { loadJsonFromAsset(s, it) }) + val fri = obj.getJSONObject("Sunday") + val recyclerView: RecyclerView = v.findViewById(R.id.rec_timetable) + val list = ArrayList() + val keysToCopyIterator: Iterator<*> = fri.keys() + val keysList: MutableList = ArrayList() + while (keysToCopyIterator.hasNext()) { + val key = keysToCopyIterator.next() as String + keysList.add(key) + } + for (i in keysList.indices) { + val morning9 = fri.getString(keysList[i]) + // txt = txt + keysList.get(i)+ morning9 + "\n"; + list.add(Schedule(keysList[i], morning9)) + } + val adapter = context?.let { ListingAdapter(it, list) } + recyclerView.setHasFixedSize(true) + recyclerView.layoutManager = LinearLayoutManager(context) + recyclerView.adapter = adapter + } catch (e: JSONException) { + e.printStackTrace() + } + return v + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sat.xml b/app/src/main/res/layout/fragment_sat.xml new file mode 100644 index 0000000..fd15047 --- /dev/null +++ b/app/src/main/res/layout/fragment_sat.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sun.xml b/app/src/main/res/layout/fragment_sun.xml new file mode 100644 index 0000000..fd15047 --- /dev/null +++ b/app/src/main/res/layout/fragment_sun.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/tab_bar.xml b/app/src/main/res/layout/tab_bar.xml index eb937e2..5be313b 100644 --- a/app/src/main/res/layout/tab_bar.xml +++ b/app/src/main/res/layout/tab_bar.xml @@ -12,7 +12,7 @@ android:gravity="center" android:text="Mon" android:textColor="@color/colorAccent" - android:textSize="32dp" + android:textSize="25dp" android:textStyle="bold" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9790680..0093be1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,6 +53,7 @@ + CSAI (B.Tech) CSE (B.Tech) IT (B.Tech) CSE (M.Tech)