Archived
Switched to DayNight for styling -> great code reduction, further Kotlin conversion
This commit is contained in:
@@ -1,220 +0,0 @@
|
||||
package com.denizd.substitutionplan;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class CardAdapter extends RecyclerView.Adapter<CardAdapter.CardViewHolder> {
|
||||
private List<Subst> mSubst;
|
||||
private static int colour;
|
||||
private static String colorCheck;
|
||||
|
||||
public static class CardViewHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView mImageView;
|
||||
public TextView mGroup, mDate, mTime, mCourse, mRoom, mAdditional;
|
||||
|
||||
public CardViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mImageView = itemView.findViewById(R.id.iconView);
|
||||
mGroup = itemView.findViewById(R.id.group);
|
||||
mDate = itemView.findViewById(R.id.date);
|
||||
mTime = itemView.findViewById(R.id.time);
|
||||
mCourse = itemView.findViewById(R.id.course);
|
||||
mRoom = itemView.findViewById(R.id.room);
|
||||
mAdditional = itemView.findViewById(R.id.additional);
|
||||
}
|
||||
}
|
||||
|
||||
public CardAdapter(ArrayList<Subst> subst) {
|
||||
mSubst = subst;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CardViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.course_card, parent, false);
|
||||
CardViewHolder cvh = new CardViewHolder(v);
|
||||
return cvh;
|
||||
}
|
||||
|
||||
public Subst getSubstAt(int i) {
|
||||
return mSubst.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CardViewHolder holder, int position) {
|
||||
Subst currentItem = mSubst.get(position);
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(holder.mImageView.getContext());
|
||||
|
||||
|
||||
holder.mImageView.setImageResource(currentItem.getIcon());
|
||||
holder.mGroup.setText(currentItem.getGroup());
|
||||
holder.mDate.setText(currentItem.getDate());
|
||||
holder.mTime.setText(currentItem.getTime());
|
||||
holder.mCourse.setText(currentItem.getCourse());
|
||||
holder.mRoom.setText(currentItem.getRoom());
|
||||
holder.mAdditional.setText(currentItem.getAdditional());
|
||||
|
||||
colour = 0;
|
||||
try {
|
||||
colorCheck = holder.mCourse.getText().toString().toLowerCase().substring(0, 3);
|
||||
switch (colorCheck) {
|
||||
case "deu": case "dep": case "daz": case "fda": {
|
||||
colour = prefs.getInt("colGerman", 0);
|
||||
break;
|
||||
}
|
||||
case "mat": case "map": {
|
||||
colour = prefs.getInt("colMaths", 0);
|
||||
break;
|
||||
}
|
||||
case "eng": case "enp": case "ena": {
|
||||
colour = prefs.getInt("colEnglish", 0);
|
||||
break;
|
||||
}
|
||||
case "spo": case "spp": case "spth": {
|
||||
colour = prefs.getInt("colPhysEd", 0);
|
||||
break;
|
||||
}
|
||||
case "pol": case "pop": {
|
||||
colour = prefs.getInt("colPolitics", 0);
|
||||
break;
|
||||
}
|
||||
case "dar": case "dap": {
|
||||
colour = prefs.getInt("colTheatre", 0);
|
||||
break;
|
||||
}
|
||||
case "phy": case "php": {
|
||||
colour = prefs.getInt("colPhysics", 0);
|
||||
break;
|
||||
}
|
||||
case "bio": case "bip": {
|
||||
colour = prefs.getInt("colBiology", 0);
|
||||
break;
|
||||
}
|
||||
case "che": case "chp": {
|
||||
colour = prefs.getInt("colChemistry", 0);
|
||||
break;
|
||||
}
|
||||
case "phi": case "psp": {
|
||||
colour = prefs.getInt("colPhilosophy", 0);
|
||||
break;
|
||||
}
|
||||
case "laa": case "laf": case "lat": {
|
||||
colour = prefs.getInt("colLatin", 0);
|
||||
break;
|
||||
}
|
||||
case "spa": case "spf": {
|
||||
colour = prefs.getInt("colSpanish", 0);
|
||||
break;
|
||||
}
|
||||
case "fra": case "frf": case "frz": {
|
||||
colour = prefs.getInt("colFrench", 0);
|
||||
break;
|
||||
}
|
||||
case "inf": {
|
||||
colour = prefs.getInt("colCompsci", 0);
|
||||
break;
|
||||
}
|
||||
case "ges": {
|
||||
colour = prefs.getInt("colHistory", 0);
|
||||
break;
|
||||
}
|
||||
case "rel": {
|
||||
colour = prefs.getInt("colReligion", 0);
|
||||
break;
|
||||
}
|
||||
case "geg": case "wuk": {
|
||||
colour = prefs.getInt("colGeography", 0);
|
||||
break;
|
||||
}
|
||||
case "kun": {
|
||||
colour = prefs.getInt("colArts", 0);
|
||||
break;
|
||||
}
|
||||
case "mus": {
|
||||
colour = prefs.getInt("colMusic", 0);
|
||||
break;
|
||||
}
|
||||
case "tue": {
|
||||
colour = prefs.getInt("colTurkish", 0);
|
||||
break;
|
||||
}
|
||||
case "chi": {
|
||||
colour = prefs.getInt("colChinese", 0);
|
||||
break;
|
||||
}
|
||||
case "gll": {
|
||||
colour = prefs.getInt("colGLL", 0);
|
||||
break;
|
||||
}
|
||||
case "wat": {
|
||||
colour = prefs.getInt("colWAT", 0);
|
||||
break;
|
||||
}
|
||||
case "för": {
|
||||
colour = prefs.getInt("colForder", 0);
|
||||
break;
|
||||
}
|
||||
case "met": {
|
||||
colour = prefs.getInt("colWP", 0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
colour = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
try {
|
||||
String colorCheck2 = holder.mCourse.getText().toString().toLowerCase().substring(0, 2);
|
||||
switch (colorCheck2) {
|
||||
case "nw": {
|
||||
colour = prefs.getInt("colBiology", 0);
|
||||
break;
|
||||
}
|
||||
case "wp": {
|
||||
colour = prefs.getInt("colWP", 0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
colour = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException e1) {
|
||||
colour = 0;
|
||||
}
|
||||
} finally {
|
||||
if (colour == 0) {
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
colour = R.color.textLight;
|
||||
} else {
|
||||
colour = R.color.textDark;
|
||||
}
|
||||
}
|
||||
holder.mImageView.getDrawable().setTint(ContextCompat.getColor(holder.mImageView.getContext(), colour));
|
||||
holder.mCourse.setTextColor(ContextCompat.getColor(holder.mCourse.getContext(), colour));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mSubst.size();
|
||||
}
|
||||
|
||||
public void setSubst(List<Subst> subst) {
|
||||
mSubst = subst;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.denizd.substitutionplan
|
||||
|
||||
import android.preference.PreferenceManager
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class CardAdapter (var mSubst: List<Subst>) : RecyclerView.Adapter<CardAdapter.CardViewHolder>() {
|
||||
|
||||
var colour = 0
|
||||
var colorCheck = ""
|
||||
|
||||
class CardViewHolder (view: View) : RecyclerView.ViewHolder(view) {
|
||||
var mImageView: ImageView = itemView.findViewById(R.id.iconView)
|
||||
var mGroup: TextView = itemView.findViewById(R.id.group)
|
||||
var mDate: TextView = itemView.findViewById(R.id.date)
|
||||
var mTime: TextView = itemView.findViewById(R.id.time)
|
||||
var mCourse: TextView = itemView.findViewById(R.id.course)
|
||||
var mRoom: TextView = itemView.findViewById(R.id.room)
|
||||
var mAdditional: TextView = itemView.findViewById(R.id.additional)
|
||||
}
|
||||
|
||||
fun CardAdapter(subst: ArrayList<Subst>) {
|
||||
mSubst = subst
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.course_card, parent, false)
|
||||
return CardViewHolder(v)
|
||||
}
|
||||
|
||||
public fun getSubstAt(i: Int): Subst {
|
||||
return mSubst[i]
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: CardViewHolder, position: Int) {
|
||||
val currentItem = mSubst[position]
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(holder.mImageView.context)
|
||||
|
||||
holder.mImageView.setImageResource(currentItem.icon)
|
||||
holder.mGroup.text = currentItem.group
|
||||
holder.mDate.text = currentItem.date
|
||||
holder.mTime.text = currentItem.time
|
||||
holder.mCourse.text = currentItem.course
|
||||
holder.mRoom.text = currentItem.room
|
||||
holder.mAdditional.text = currentItem.additional
|
||||
|
||||
try {
|
||||
colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 3)
|
||||
colour = when (colorCheck) {
|
||||
"deu", "dep", "daz", "fda" -> prefs.getInt("colGerman", 0)
|
||||
"mat", "map" -> prefs.getInt("colMaths", 0)
|
||||
"eng", "enp", "ena" -> prefs.getInt("colEnglish", 0)
|
||||
"spo", "spp", "spth" -> prefs.getInt("colPhysEd", 0)
|
||||
"pol", "pop" -> prefs.getInt("colPolitics", 0)
|
||||
"dar", "dap" -> prefs.getInt("colTheatre", 0)
|
||||
"phy", "php" -> prefs.getInt("colPhysics", 0)
|
||||
"bio", "bip" -> prefs.getInt("colBiology", 0)
|
||||
"che", "chp" -> prefs.getInt("colChemistry", 0)
|
||||
"phi", "psp" -> prefs.getInt("colPhilosophy", 0)
|
||||
"laa", "laf", "lat" -> prefs.getInt("colLatin", 0)
|
||||
"spa", "spf" -> prefs.getInt("colSpanish", 0)
|
||||
"fra", "frf", "frz" -> prefs.getInt("colFrench", 0)
|
||||
"inf" -> prefs.getInt("colCompsci", 0)
|
||||
"ges" -> prefs.getInt("colHistory", 0)
|
||||
"rel" -> prefs.getInt("colReligion", 0)
|
||||
"geg" -> prefs.getInt("colGeography", 0)
|
||||
"kun" -> prefs.getInt("colArts", 0)
|
||||
"mus" -> prefs.getInt("colMusic", 0)
|
||||
"tue" -> prefs.getInt("colTurkish", 0)
|
||||
"chi" -> prefs.getInt("colChinese", 0)
|
||||
"gll" -> prefs.getInt("colGLL", 0)
|
||||
"wat" -> prefs.getInt("colWAT", 0)
|
||||
"för" -> prefs.getInt("colForder", 0)
|
||||
"met" -> prefs.getInt("colWP", 0)
|
||||
else -> 0
|
||||
}
|
||||
} catch (e: StringIndexOutOfBoundsException) {
|
||||
try {
|
||||
colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 2)
|
||||
colour = when (colorCheck) {
|
||||
"nw" -> prefs.getInt("colBiology", 0)
|
||||
"wp" -> prefs.getInt("colWP", 0)
|
||||
else -> 0
|
||||
}
|
||||
} catch (e2: StringIndexOutOfBoundsException) {
|
||||
colour = 0
|
||||
}
|
||||
} finally {
|
||||
if (colour == 0) {
|
||||
colour = R.color.textcolor
|
||||
}
|
||||
}
|
||||
|
||||
holder.mImageView.drawable.setTint(ContextCompat.getColor(holder.mImageView.context, colour))
|
||||
holder.mCourse.setTextColor(ContextCompat.getColor(holder.mCourse.context, colour))
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = mSubst.size
|
||||
|
||||
public fun setSubst(subst: List<Subst>) {
|
||||
mSubst = subst
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.denizd.substitutionplan;
|
||||
|
||||
public class DataGetter {
|
||||
|
||||
protected static int getIcon(String course) {
|
||||
if (course.toLowerCase().contains("deu") || course.toLowerCase().contains("dep") || course.toLowerCase().contains("daz")) {
|
||||
return R.drawable.ic_german;
|
||||
} else if (course.toLowerCase().contains("mat") || course.toLowerCase().contains("map")) {
|
||||
return R.drawable.ic_maths;
|
||||
} else if (course.toLowerCase().contains("eng") || course.toLowerCase().contains("enp") || course.toLowerCase().contains("ena")) {
|
||||
return R.drawable.ic_english;
|
||||
} else if (course.toLowerCase().contains("spo") || course.toLowerCase().contains("spp") || course.toLowerCase().contains("spth")) {
|
||||
return R.drawable.ic_pe;
|
||||
} else if (course.toLowerCase().contains("pol") || course.toLowerCase().contains("pop")) {
|
||||
return R.drawable.ic_politics;
|
||||
} else if (course.toLowerCase().contains("dar") || course.toLowerCase().contains("dap")) {
|
||||
return R.drawable.ic_drama;
|
||||
} else if (course.toLowerCase().contains("phy") || course.toLowerCase().contains("php")) {
|
||||
return R.drawable.ic_physics;
|
||||
} else if (course.toLowerCase().contains("bio") || course.toLowerCase().contains("bip") || course.toLowerCase().contains("nw")) {
|
||||
return R.drawable.ic_biology;
|
||||
} else if (course.toLowerCase().contains("che") || course.toLowerCase().contains("chp")) {
|
||||
return R.drawable.ic_chemistry;
|
||||
} else if (course.toLowerCase().contains("phi") || course.toLowerCase().contains("psp")) {
|
||||
return R.drawable.ic_philosophy;
|
||||
} else if (course.toLowerCase().contains("laa") || course.toLowerCase().contains("laf") || course.toLowerCase().contains("lat")) {
|
||||
return R.drawable.ic_latin;
|
||||
} else if (course.toLowerCase().contains("spa") || course.toLowerCase().contains("spf")) {
|
||||
return R.drawable.ic_spanish;
|
||||
} else if (course.toLowerCase().contains("fra") || course.toLowerCase().contains("frf") || course.toLowerCase().contains("frz")) {
|
||||
return R.drawable.ic_french;
|
||||
} else if (course.toLowerCase().contains("inf")) {
|
||||
return R.drawable.ic_compsci;
|
||||
} else if (course.toLowerCase().contains("ges")) {
|
||||
return R.drawable.ic_history;
|
||||
} else if (course.toLowerCase().contains("rel")) {
|
||||
return R.drawable.ic_religion;
|
||||
} else if (course.toLowerCase().contains("geg") || course.toLowerCase().contains("wuk")) {
|
||||
return R.drawable.ic_geography;
|
||||
} else if (course.toLowerCase().contains("kun")) {
|
||||
return R.drawable.ic_arts;
|
||||
} else if (course.toLowerCase().contains("mus")) {
|
||||
return R.drawable.ic_music;
|
||||
} else if (course.toLowerCase().contains("tue")) {
|
||||
return R.drawable.ic_turkish;
|
||||
} else if (course.toLowerCase().contains("chi")) {
|
||||
return R.drawable.ic_chinese;
|
||||
} else if (course.toLowerCase().contains("gll")) {
|
||||
return R.drawable.ic_gll;
|
||||
} else if (course.toLowerCase().contains("wat")) {
|
||||
return R.drawable.ic_wat;
|
||||
} else if (course.toLowerCase().contains("för")) {
|
||||
return R.drawable.ic_help;
|
||||
} else if (course.toLowerCase().contains("wp") || course.toLowerCase().contains("met")) {
|
||||
return R.drawable.ic_pencil;
|
||||
} else {
|
||||
return R.drawable.ic_empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected static String[] boy = {"Cedric Grislawski", "Dawid Kniola", "Jonas Köstergarten", "Jakob Moerschner", "Siamak Nemati", "Hendrik Plönnings",
|
||||
"Jan Rohmann", "Anton Rosenberger", "Christoph Senft", "Jan Mika Sieckendieck", "Alexander Sinaj",
|
||||
"Nico Tischer", "Nhat Vinh Tran", "Leon Becker", "Youssef Beltagi", "Erich Kerkesner", "Alex Lick",
|
||||
"Oskar Piskorz", "Theo Recktor", "Eray Vatansever", "Dennis Wojciechowski", "Übeydullah Alkan",
|
||||
"Yahya Almarashli", "Sinan Aydin", "Rick Büteröwe", "Levin Dropp", "Silvester Jermolajew", "Tolgay Kekilli",
|
||||
"Dennis Lange", "Aras Mahmoud", "Batuhan Özcan", "Michael Rek", "Khabat Sharif", "Anbinh Tran",
|
||||
"Bastian Westerboer", "Abdulwahab Alshebli", "Kelechi Gaius", "Armin Großmann", "Anes Halep",
|
||||
"Marco Jankowski", "Emirhan Kaplan", "Alexander Kofmann", "Tobi Derek Köhler", "Vasilije Nedeljkovic",
|
||||
"Batu Öcal", "Paul Rehbohm"};
|
||||
protected static String[] girl = {"Mayra Dronia", "Shalin Ramadan", "Nigina Amin", "Mariya Kheder", "Niegen Khosrawi", "Dayana Osipova",
|
||||
"Julia Petri", "Laura Pister", "Dana Alyoussef", "Ilkem Kahramanoglu", "Rozita Amiri", "Mirja Arneke",
|
||||
"Nastasja Banik", "Anni Kienke", "Benedite Mateta", "Leonie Pohl", "Cecillia Sawires", "Patrycja Smółka",
|
||||
"Elif Zencirkiran", "Nusyba Al Semadi", "Vivien Bruns", "Yasemin Dal", "Svenja Demuth", "Nina Groß",
|
||||
"Kim Lahmeyer", "Luca Minschke", "Kim Reschke", "Amélie Schnellecke", "Delal Secer", "Xenia Segijanski",
|
||||
"Melisa Tas", "Kim Völker", "Banu Yari", "Zeinab Ali", "Mariam Bannout", "Stefanie Fahl", "Yamaty Gaye",
|
||||
"Anna-Sophia Haeberle", "Finja Hastedt", "Viktoria Hammermeister", "Isabel Horn", "Laura Kern",
|
||||
"Melanie Kleinermann", "Målin Kollhoff", "Darja Maier", "Lisa Maier", "Naura Nadzifah", "Janina Roelfs",
|
||||
"Vanessa Scheifler", "Mara Thies", "Lieli Umar", "Leonie Welk", "Betraben Yacoub"};
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.denizd.substitutionplan
|
||||
|
||||
class DataGetter {
|
||||
|
||||
var boy = arrayOf("Cedric Grislawski", "Dawid Kniola", "Jonas Köstergarten", "Jakob Moerschner", "Siamak Nemati", "Hendrik Plönnings", "Jan Rohmann", "Anton Rosenberger", "Christoph Senft", "Jan Mika Sieckendieck", "Alexander Sinaj", "Nico Tischer", "Nhat Vinh Tran", "Leon Becker", "Youssef Beltagi", "Erich Kerkesner", "Alex Lick", "Oskar Piskorz", "Theo Recktor", "Eray Vatansever", "Dennis Wojciechowski", "Übeydullah Alkan", "Yahya Almarashli", "Sinan Aydin", "Rick Büteröwe", "Levin Dropp", "Silvester Jermolajew", "Tolgay Kekilli", "Dennis Lange", "Aras Mahmoud", "Batuhan Özcan", "Michael Rek", "Khabat Sharif", "Anbinh Tran", "Bastian Westerboer", "Abdulwahab Alshebli", "Kelechi Gaius", "Armin Großmann", "Anes Halep", "Marco Jankowski", "Emirhan Kaplan", "Alexander Kofmann", "Tobi Derek Köhler", "Vasilije Nedeljkovic", "Batu Öcal", "Paul Rehbohm")
|
||||
var girl = arrayOf("Mayra Dronia", "Shalin Ramadan", "Nigina Amin", "Mariya Kheder", "Niegen Khosrawi", "Dayana Osipova", "Julia Petri", "Laura Pister", "Dana Alyoussef", "Ilkem Kahramanoglu", "Rozita Amiri", "Mirja Arneke", "Nastasja Banik", "Anni Kienke", "Benedite Mateta", "Leonie Pohl", "Cecillia Sawires", "Patrycja Smółka", "Elif Zencirkiran", "Nusyba Al Semadi", "Vivien Bruns", "Yasemin Dal", "Svenja Demuth", "Nina Groß", "Kim Lahmeyer", "Luca Minschke", "Kim Reschke", "Amélie Schnellecke", "Delal Secer", "Xenia Segijanski", "Melisa Tas", "Kim Völker", "Banu Yari", "Zeinab Ali", "Mariam Bannout", "Stefanie Fahl", "Yamaty Gaye", "Anna-Sophia Haeberle", "Finja Hastedt", "Viktoria Hammermeister", "Isabel Horn", "Laura Kern", "Melanie Kleinermann", "Målin Kollhoff", "Darja Maier", "Lisa Maier", "Naura Nadzifah", "Janina Roelfs", "Vanessa Scheifler", "Mara Thies", "Lieli Umar", "Leonie Welk", "Betraben Yacoub")
|
||||
|
||||
fun getIcon(course: String): Int {
|
||||
return if (course.toLowerCase().contains("deu") || course.toLowerCase().contains("dep") || course.toLowerCase().contains("daz")) {
|
||||
R.drawable.ic_german
|
||||
} else if (course.toLowerCase().contains("mat") || course.toLowerCase().contains("map")) {
|
||||
R.drawable.ic_maths
|
||||
} else if (course.toLowerCase().contains("eng") || course.toLowerCase().contains("enp") || course.toLowerCase().contains("ena")) {
|
||||
R.drawable.ic_english
|
||||
} else if (course.toLowerCase().contains("spo") || course.toLowerCase().contains("spp") || course.toLowerCase().contains("spth")) {
|
||||
R.drawable.ic_pe
|
||||
} else if (course.toLowerCase().contains("pol") || course.toLowerCase().contains("pop")) {
|
||||
R.drawable.ic_politics
|
||||
} else if (course.toLowerCase().contains("dar") || course.toLowerCase().contains("dap")) {
|
||||
R.drawable.ic_drama
|
||||
} else if (course.toLowerCase().contains("phy") || course.toLowerCase().contains("php")) {
|
||||
R.drawable.ic_physics
|
||||
} else if (course.toLowerCase().contains("bio") || course.toLowerCase().contains("bip") || course.toLowerCase().contains("nw")) {
|
||||
R.drawable.ic_biology
|
||||
} else if (course.toLowerCase().contains("che") || course.toLowerCase().contains("chp")) {
|
||||
R.drawable.ic_chemistry
|
||||
} else if (course.toLowerCase().contains("phi") || course.toLowerCase().contains("psp")) {
|
||||
R.drawable.ic_philosophy
|
||||
} else if (course.toLowerCase().contains("laa") || course.toLowerCase().contains("laf") || course.toLowerCase().contains("lat")) {
|
||||
R.drawable.ic_latin
|
||||
} else if (course.toLowerCase().contains("spa") || course.toLowerCase().contains("spf")) {
|
||||
R.drawable.ic_spanish
|
||||
} else if (course.toLowerCase().contains("fra") || course.toLowerCase().contains("frf") || course.toLowerCase().contains("frz")) {
|
||||
R.drawable.ic_french
|
||||
} else if (course.toLowerCase().contains("inf")) {
|
||||
R.drawable.ic_compsci
|
||||
} else if (course.toLowerCase().contains("ges")) {
|
||||
R.drawable.ic_history
|
||||
} else if (course.toLowerCase().contains("rel")) {
|
||||
R.drawable.ic_religion
|
||||
} else if (course.toLowerCase().contains("geg") || course.toLowerCase().contains("wuk")) {
|
||||
R.drawable.ic_geography
|
||||
} else if (course.toLowerCase().contains("kun")) {
|
||||
R.drawable.ic_arts
|
||||
} else if (course.toLowerCase().contains("mus")) {
|
||||
R.drawable.ic_music
|
||||
} else if (course.toLowerCase().contains("tue")) {
|
||||
R.drawable.ic_turkish
|
||||
} else if (course.toLowerCase().contains("chi")) {
|
||||
R.drawable.ic_chinese
|
||||
} else if (course.toLowerCase().contains("gll")) {
|
||||
R.drawable.ic_gll
|
||||
} else if (course.toLowerCase().contains("wat")) {
|
||||
R.drawable.ic_wat
|
||||
} else if (course.toLowerCase().contains("för")) {
|
||||
R.drawable.ic_help
|
||||
} else if (course.toLowerCase().contains("wp") || course.toLowerCase().contains("met")) {
|
||||
R.drawable.ic_pencil
|
||||
} else {
|
||||
R.drawable.ic_empty
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,15 +50,15 @@ public class FirstTime extends AppCompatActivity {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.white));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.white));
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
} else {
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
}
|
||||
window.setBackgroundDrawable(getDrawable(R.drawable.white));
|
||||
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.white));
|
||||
ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.background));
|
||||
setTaskDescription(taskDesc);
|
||||
|
||||
final Context context = this;
|
||||
|
||||
@@ -263,7 +263,8 @@ public class FragmentPersonal extends Fragment {
|
||||
additionalS[i] = cols.get(5).text();
|
||||
progressBar.incrementProgressBy(1);
|
||||
|
||||
int drawable = DataGetter.getIcon(courseS[i]);
|
||||
DataGetter dg = new DataGetter();
|
||||
int drawable = dg.getIcon(courseS[i]);
|
||||
Subst subst = new Subst(drawable, groupS[i], dateS[i], timeS[i], courseS[i], roomS[i], additionalS[i], priority);
|
||||
substViewModel.insert(subst);
|
||||
priority--;
|
||||
@@ -280,9 +281,7 @@ public class FragmentPersonal extends Fragment {
|
||||
|
||||
easyPrefs.putListString("informationalList", informationalList);
|
||||
|
||||
} catch (IOException e1) {
|
||||
npe = true;
|
||||
} catch (NullPointerException e1) {
|
||||
} catch (IOException | NullPointerException e1) {
|
||||
npe = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class FragmentPlan extends Fragment {
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
layoutManager = gridLayoutManager;
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setLayoutManager(layoutManager); // TODO grid layout but change an integer value instead
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,8 @@ public class FragmentPlan extends Fragment {
|
||||
additionalS[i] = cols.get(5).text();
|
||||
progressBar.incrementProgressBy(1);
|
||||
|
||||
int drawable = DataGetter.getIcon(courseS[i]);
|
||||
DataGetter dg = new DataGetter();
|
||||
int drawable = dg.getIcon(courseS[i]);
|
||||
Subst subst = new Subst(drawable, groupS[i], dateS[i], timeS[i], courseS[i], roomS[i], additionalS[i], priority);
|
||||
substViewModel.insert(subst);
|
||||
priority--;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class FragmentSettings extends Fragment implements View.OnClickListener {
|
||||
final SharedPreferences.Editor edit = prefs.edit();
|
||||
|
||||
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
|
||||
builder.setToolbarColor(getResources().getColor(R.color.white));
|
||||
builder.setToolbarColor(getResources().getColor(R.color.background));
|
||||
final CustomTabsIntent customTabsIntent = builder.build();
|
||||
|
||||
final TextInputEditText txtName = getView().findViewById(R.id.txtName);
|
||||
@@ -713,43 +713,45 @@ public class FragmentSettings extends Fragment implements View.OnClickListener {
|
||||
datingBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
double boyP = 0, girlP = 0, perc = 0;
|
||||
if (boyT.getText().toString().isEmpty() || boy.isChecked()) {
|
||||
boyT.setText(DataGetter.boy[gen.nextInt(DataGetter.boy.length)]);
|
||||
}
|
||||
if (girlT.getText().toString().isEmpty() || girl.isChecked()) {
|
||||
girlT.setText(DataGetter.girl[gen.nextInt(DataGetter.girl.length)]);
|
||||
}
|
||||
for (int i = 0; i < boyT.getText().length(); i++) {
|
||||
boyP++;
|
||||
}
|
||||
for (int i = 0; i < girlT.getText().length(); i++) {
|
||||
girlP++;
|
||||
}
|
||||
if (girlP < boyP) {
|
||||
perc = (girlP / boyP) * 100;
|
||||
}
|
||||
if (girlP > boyP) {
|
||||
perc = (boyP / girlP) * 100;
|
||||
}
|
||||
char multiplyTempBoy = boyT.getText().charAt(boyT.getText().length() - 1);
|
||||
char multiplyTempGirl = girlT.getText().charAt(girlT.getText().length() - 1);
|
||||
double multiply = Character.getNumericValue(multiplyTempBoy) + Character.getNumericValue(multiplyTempGirl);
|
||||
multiply = multiply / 1.2;
|
||||
if (perc == 0) {
|
||||
perc += 30;
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
if (perc * (multiply / 40) > 100) {
|
||||
percentage.setText("100.00%");
|
||||
} else {
|
||||
percentage.setText(df.format(perc * (multiply / 40)) + "%");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Toast.makeText(getActivity(), getString(R.string.error),
|
||||
// try {
|
||||
// double boyP = 0, girlP = 0, perc = 0;
|
||||
// if (boyT.getText().toString().isEmpty() || boy.isChecked()) {
|
||||
// boyT.setText(DataGetter.boy[gen.nextInt(DataGetter.boy.length)]);
|
||||
// }
|
||||
// if (girlT.getText().toString().isEmpty() || girl.isChecked()) {
|
||||
// girlT.setText(DataGetter.girl[gen.nextInt(DataGetter.girl.length)]);
|
||||
// }
|
||||
// for (int i = 0; i < boyT.getText().length(); i++) {
|
||||
// boyP++;
|
||||
// }
|
||||
// for (int i = 0; i < girlT.getText().length(); i++) {
|
||||
// girlP++;
|
||||
// }
|
||||
// if (girlP < boyP) {
|
||||
// perc = (girlP / boyP) * 100;
|
||||
// }
|
||||
// if (girlP > boyP) {
|
||||
// perc = (boyP / girlP) * 100;
|
||||
// }
|
||||
// char multiplyTempBoy = boyT.getText().charAt(boyT.getText().length() - 1);
|
||||
// char multiplyTempGirl = girlT.getText().charAt(girlT.getText().length() - 1);
|
||||
// double multiply = Character.getNumericValue(multiplyTempBoy) + Character.getNumericValue(multiplyTempGirl);
|
||||
// multiply = multiply / 1.2;
|
||||
// if (perc == 0) {
|
||||
// perc += 30;
|
||||
// }
|
||||
// DecimalFormat df = new DecimalFormat("#.##");
|
||||
// if (perc * (multiply / 40) > 100) {
|
||||
// percentage.setText("100.00%");
|
||||
// } else {
|
||||
// percentage.setText(df.format(perc * (multiply / 40)) + "%");
|
||||
// }
|
||||
// } catch (NullPointerException e) {
|
||||
// Toast.makeText(getActivity(), getString(R.string.error),
|
||||
// Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
Toast.makeText(getActivity(), "Deprecated",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialogDev.setView(dialogView);
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.widget.NestedScrollView
|
||||
@@ -65,91 +66,36 @@ class Main : AppCompatActivity(R.layout.activity_main) {
|
||||
val appbarlayout = findViewById<AppBarLayout>(R.id.appbarlayout)
|
||||
val toolbarTxt = findViewById<TextView>(R.id.toolbarTxt)
|
||||
val bottomSheetRoot = findViewById<LinearLayout>(R.id.bottom_sheet)
|
||||
val bottomSheet = findViewById<LinearLayout>(R.id.bottom_sheet_linear)
|
||||
val bottomSheetHeader = findViewById<TextView>(R.id.bottom_sheet_header)
|
||||
val bottomSheetText = findViewById<TextView>(R.id.bottom_sheet_text)
|
||||
val bottomNavDivider = findViewById<View>(R.id.bottom_nav_divider)
|
||||
bottomSheetBehaviour = BottomSheetBehavior.from(bottomSheetRoot)
|
||||
val bottomNav = findViewById<BottomNavigationView>(R.id.bottom_nav)
|
||||
val fragmentContainer = findViewById<CoordinatorLayout>(R.id.fragment_container)
|
||||
val bottomSheetCloser = findViewById<LinearLayout>(R.id.bottom_sheet_closer)
|
||||
val chip = findViewById<Chip>(R.id.chip)
|
||||
val contextView = findViewById<View>(R.id.coordination)
|
||||
val iconinfo = findViewById<ImageView>(R.id.info_icon)
|
||||
val window = this.window as Window
|
||||
|
||||
val darkwhite = ContextCompat.getColor(this, R.color.darkwhite)
|
||||
val black = ContextCompat.getColor(this, R.color.black)
|
||||
val accent = ContextCompat.getColor(this, R.color.accent)
|
||||
val tintlistLight = ContextCompat.getColorStateList(this, R.color.tintlist_light)
|
||||
val tintlistDark = ContextCompat.getColorStateList(this, R.color.tintlist_dark)
|
||||
val chipstatelistLight = resources.getColorStateList(R.color.chip_state_list)
|
||||
val chipstatelistDark = resources.getColorStateList(R.color.chip_state_list_dark)
|
||||
val textLight = ContextCompat.getColor(this, R.color.textLight)
|
||||
val textDark = ContextCompat.getColor(this, R.color.textDark)
|
||||
val lightgrey = ContextCompat.getColor(this, R.color.lightgrey)
|
||||
val lessdark = ContextCompat.getColor(context, R.color.lessdark)
|
||||
val background = ContextCompat.getColor(this, R.color.background)
|
||||
val accentPastel = ContextCompat.getColor(this, R.color.accentPastel)
|
||||
val dark = ContextCompat.getColor(this, R.color.dark)
|
||||
val darkdivider = ContextCompat.getColor(this, R.color.darkdivider)
|
||||
|
||||
setSupportActionBar(toolbar)
|
||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
|
||||
bottomSheetExpanded = bottomSheetBehaviour.state == BottomSheetBehavior.STATE_EXPANDED
|
||||
|
||||
if (prefs.getInt("themeInt", 0) == 0) {
|
||||
setTheme(R.style.AppTheme0)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.statusBarColor = darkwhite
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
toolbar.setBackgroundColor(darkwhite)
|
||||
window.navigationBarColor = darkwhite
|
||||
} else {
|
||||
window.statusBarColor = black
|
||||
window.navigationBarColor = black
|
||||
setTheme(R.style.AppTheme0)
|
||||
|
||||
when (prefs.getInt("themeInt", 0)) {
|
||||
0 -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.background)
|
||||
}
|
||||
toolbarTxt.setTextColor(accent)
|
||||
bottomNav.setBackgroundColor(darkwhite)
|
||||
bottomNav.itemIconTintList = tintlistLight
|
||||
bottomNav.itemTextColor = tintlistLight
|
||||
chip.chipBackgroundColor = chipstatelistLight
|
||||
chip.setTextColor(textDark)
|
||||
bottomSheet.setBackgroundColor(darkwhite)
|
||||
bottomSheetHeader.setTextColor(textDark)
|
||||
bottomSheetText.setTextColor(textDark)
|
||||
bottomNavDivider.setBackgroundColor(lightgrey)
|
||||
iconinfo.setColorFilter(lessdark, android.graphics.PorterDuff.Mode.SRC_IN)
|
||||
|
||||
val bm = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
|
||||
val taskDesc = ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.darkwhite))
|
||||
setTaskDescription(taskDesc)
|
||||
|
||||
} else if (prefs.getInt("themeInt", 0) == 1) {
|
||||
setTheme(R.style.AppTheme0Dark)
|
||||
window.statusBarColor = background
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
|
||||
toolbar.setBackgroundColor(dark)
|
||||
toolbarTxt.setTextColor(accentPastel)
|
||||
bottomNav.setBackgroundColor(dark)
|
||||
bottomNav.itemIconTintList = tintlistDark
|
||||
bottomNav.itemTextColor = tintlistDark
|
||||
window.navigationBarColor = background
|
||||
chip.chipBackgroundColor = chipstatelistDark
|
||||
chip.setTextColor(textLight)
|
||||
bottomSheet.setBackgroundColor(dark)
|
||||
bottomSheetHeader.setTextColor(textLight)
|
||||
bottomSheetText.setTextColor(textLight)
|
||||
bottomNavDivider.setBackgroundColor(darkdivider)
|
||||
iconinfo.setColorFilter(lightgrey, android.graphics.PorterDuff.Mode.SRC_IN)
|
||||
|
||||
val bm = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
|
||||
val taskDesc = ActivityManager.TaskDescription(getString(R.string.app_name), bm, resources.getColor(R.color.background))
|
||||
setTaskDescription(taskDesc)
|
||||
}
|
||||
|
||||
val bm = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)
|
||||
val taskDesc = ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.background))
|
||||
setTaskDescription(taskDesc)
|
||||
|
||||
if (!prefs.getBoolean("showinfotab", true)) {
|
||||
bottomNav.menu.removeItem(R.id.openinfopanel)
|
||||
}
|
||||
@@ -309,6 +255,7 @@ class Main : AppCompatActivity(R.layout.activity_main) {
|
||||
}
|
||||
|
||||
bottomNav.setOnNavigationItemSelectedListener { item: MenuItem ->
|
||||
var fragmentLoading = true
|
||||
lateinit var fragment: Fragment
|
||||
when (item.itemId) {
|
||||
R.id.plan -> {
|
||||
@@ -329,15 +276,20 @@ class Main : AppCompatActivity(R.layout.activity_main) {
|
||||
} else if (bottomSheetBehaviour.state == BottomSheetBehavior.STATE_EXPANDED) {
|
||||
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
}
|
||||
fragmentLoading = false
|
||||
}
|
||||
R.id.settings -> {
|
||||
fragment = SettingsFragment()
|
||||
toolbarTxt.text = getString(R.string.settings)
|
||||
}
|
||||
}
|
||||
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
appbarlayout.setExpanded(true)
|
||||
loadFragment(fragment)
|
||||
if (fragmentLoading) {
|
||||
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
|
||||
appbarlayout.setExpanded(true)
|
||||
loadFragment(fragment)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
bottomNav.setOnNavigationItemReselectedListener { item: MenuItem ->
|
||||
|
||||
@@ -205,57 +205,57 @@ public class MainActivity extends AppCompatActivity {
|
||||
ImageView iconinfo = findViewById(R.id.info_icon);
|
||||
|
||||
// theme change
|
||||
if (prefs.getInt("themeInt", 0) == 0) {
|
||||
setTheme(R.style.AppTheme0);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
} else {
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
}
|
||||
|
||||
toolbarTxt.setTextColor(ContextCompat.getColor(this, R.color.accent));
|
||||
bottomNav.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
bottomNav.setItemIconTintList(ContextCompat.getColorStateList(this, R.color.tintlist_light));
|
||||
bottomNav.setItemTextColor(ContextCompat.getColorStateList(this, R.color.tintlist_light));
|
||||
chip.setChipBackgroundColor(getResources().getColorStateList(R.color.chip_state_list));
|
||||
chip.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
bottomSheet.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
bottomSheetHeader.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
bottomSheetText.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
bottomNavDivider.setBackgroundColor(ContextCompat.getColor(this, R.color.lightgrey));
|
||||
iconinfo.setColorFilter(ContextCompat.getColor(context, R.color.lessdark), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.darkwhite));
|
||||
setTaskDescription(taskDesc);
|
||||
}
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
setTheme(R.style.AppTheme0Dark);
|
||||
window.setStatusBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
toolbarTxt.setTextColor(ContextCompat.getColor(this, R.color.accentPastel));
|
||||
bottomNav.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
bottomNav.setItemIconTintList(ContextCompat.getColorStateList(this, R.color.tintlist_dark));
|
||||
bottomNav.setItemTextColor(ContextCompat.getColorStateList(this, R.color.tintlist_dark));
|
||||
window.setNavigationBarColor(getResources().getColor(R.color.background));
|
||||
chip.setChipBackgroundColor(getResources().getColorStateList(R.color.chip_state_list_dark));
|
||||
chip.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
bottomSheet.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
bottomSheetHeader.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
bottomSheetText.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
bottomNavDivider.setBackgroundColor(ContextCompat.getColor(this, R.color.darkdivider));
|
||||
iconinfo.setColorFilter(ContextCompat.getColor(context, R.color.lightgrey), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
|
||||
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, getResources().getColor(R.color.background));
|
||||
setTaskDescription(taskDesc);
|
||||
}
|
||||
// if (prefs.getInt("themeInt", 0) == 0) {
|
||||
// setTheme(R.style.AppTheme0);
|
||||
//
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// window.setStatusBarColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
// toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// window.setNavigationBarColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// } else {
|
||||
// window.setStatusBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
// window.setNavigationBarColor(ContextCompat.getColor(this, R.color.black));
|
||||
// }
|
||||
//
|
||||
// toolbarTxt.setTextColor(ContextCompat.getColor(this, R.color.accent));
|
||||
// bottomNav.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// bottomNav.setItemIconTintList(ContextCompat.getColorStateList(this, R.color.tintlist_light));
|
||||
// bottomNav.setItemTextColor(ContextCompat.getColorStateList(this, R.color.tintlist_light));
|
||||
// chip.setChipBackgroundColor(getResources().getColorStateList(R.color.chip_state_list));
|
||||
// chip.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
// bottomSheet.setBackgroundColor(ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// bottomSheetHeader.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
// bottomSheetText.setTextColor(ContextCompat.getColor(this, R.color.textDark));
|
||||
// bottomNavDivider.setBackgroundColor(ContextCompat.getColor(this, R.color.lightgrey));
|
||||
// iconinfo.setColorFilter(ContextCompat.getColor(context, R.color.lessdark), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
//
|
||||
// Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
// ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, ContextCompat.getColor(this, R.color.darkwhite));
|
||||
// setTaskDescription(taskDesc);
|
||||
// }
|
||||
// if (prefs.getInt("themeInt", 0) == 1) {
|
||||
// setTheme(R.style.AppTheme0Dark);
|
||||
// window.setStatusBarColor(ContextCompat.getColor(this, R.color.background));
|
||||
// window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
// toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
// toolbarTxt.setTextColor(ContextCompat.getColor(this, R.color.accentPastel));
|
||||
// bottomNav.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
// bottomNav.setItemIconTintList(ContextCompat.getColorStateList(this, R.color.tintlist_dark));
|
||||
// bottomNav.setItemTextColor(ContextCompat.getColorStateList(this, R.color.tintlist_dark));
|
||||
// window.setNavigationBarColor(getResources().getColor(R.color.background));
|
||||
// chip.setChipBackgroundColor(getResources().getColorStateList(R.color.chip_state_list_dark));
|
||||
// chip.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
// bottomSheet.setBackgroundColor(ContextCompat.getColor(this, R.color.dark));
|
||||
// bottomSheetHeader.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
// bottomSheetText.setTextColor(ContextCompat.getColor(this, R.color.textLight));
|
||||
// bottomNavDivider.setBackgroundColor(ContextCompat.getColor(this, R.color.darkdivider));
|
||||
// iconinfo.setColorFilter(ContextCompat.getColor(context, R.color.lightgrey), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
//
|
||||
// Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
|
||||
// ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, getResources().getColor(R.color.background));
|
||||
// setTaskDescription(taskDesc);
|
||||
// }
|
||||
|
||||
if (prefs.getBoolean("greeting", false)) {
|
||||
if (!prefs.getString("username", "").isEmpty()) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.denizd.substitutionplan
|
||||
|
||||
class NotificationService {
|
||||
}
|
||||
@@ -217,7 +217,8 @@ public class ScheduledJobService extends JobService {
|
||||
roomS[i] = cols.get(4).text();
|
||||
additionalS[i] = cols.get(5).text();
|
||||
|
||||
int drawable = DataGetter.getIcon(courseS[i]);
|
||||
DataGetter dg = new DataGetter();
|
||||
int drawable = dg.getIcon(courseS[i]);
|
||||
Subst subst = new Subst(drawable, groupS[i], dateS[i], timeS[i], courseS[i], roomS[i], additionalS[i], priority);
|
||||
priority--;
|
||||
substViewModel.insert(subst);
|
||||
|
||||
@@ -12,11 +12,14 @@ import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.jaredrummler.android.device.DeviceName
|
||||
@@ -35,18 +38,21 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
|
||||
private val builder = CustomTabsIntent.Builder()
|
||||
private val customTabsIntent = builder.build() as CustomTabsIntent
|
||||
private var cs: Int = 7
|
||||
var window: Window? = null
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
mContext = context
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(mContext)
|
||||
edit = prefs.edit()
|
||||
|
||||
window = activity?.window
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
builder.setToolbarColor(resources.getColor(R.color.white))
|
||||
// builder.setToolbarColor(resources.getColor(R.color.white))
|
||||
|
||||
val txtName = view.findViewById<TextInputEditText>(R.id.txtName)
|
||||
val txtClasses = view.findViewById<TextInputEditText>(R.id.txtClasses)
|
||||
@@ -147,7 +153,26 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
|
||||
}
|
||||
R.id.switchDark -> {
|
||||
val switchDark = v.findViewById<Switch>(R.id.switchDark)
|
||||
if (switchDark.isChecked) edit.putInt("themeInt", 1) else edit.putInt("themeInt", 0)
|
||||
val bottomNav = v.rootView.findViewById<BottomNavigationView>(R.id.bottom_nav)
|
||||
if (switchDark.isChecked) {
|
||||
edit.putInt("themeInt", 1)
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
|
||||
window?.navigationBarColor = ContextCompat.getColor(mContext, R.color.background)
|
||||
|
||||
} else {
|
||||
edit.putInt("themeInt", 0)
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
window?.navigationBarColor = ContextCompat.getColor(mContext, R.color.background)
|
||||
}
|
||||
}
|
||||
if (prefs.getBoolean("defaultPersonalised", false)) {
|
||||
bottomNav.selectedItemId = R.id.personal
|
||||
} else {
|
||||
bottomNav.selectedItemId = R.id.plan
|
||||
}
|
||||
}
|
||||
R.id.switchHideInfo -> {
|
||||
val switchHideInfo = v.findViewById<Switch>(R.id.switchHideInfo)
|
||||
@@ -410,11 +435,12 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
|
||||
|
||||
datingBtn.setOnClickListener {
|
||||
try {
|
||||
val dg = DataGetter()
|
||||
if (boyTxt.text.toString().isEmpty() || boyCb.isChecked) {
|
||||
boyTxt.setText(DataGetter.boy[gen.nextInt(DataGetter.boy.size)])
|
||||
boyTxt.setText(dg.boy[gen.nextInt(dg.boy.size)])
|
||||
}
|
||||
if (girlTxt.text.toString().isEmpty() || girlCb.isChecked) {
|
||||
girlTxt.setText(DataGetter.girl[gen.nextInt(DataGetter.girl.size)])
|
||||
girlTxt.setText(dg.girl[gen.nextInt(dg.girl.size)])
|
||||
}
|
||||
|
||||
val boyP = boyTxt.text!!.length.toDouble()
|
||||
|
||||
Reference in New Issue
Block a user