forked from github/szkolny
[Dialog/BellSync] Add showing info when there are no lessons.
This commit is contained in:
parent
b399a3f5ad
commit
b66bd6fec9
@ -59,6 +59,10 @@ class BellSyncDialog(
|
|||||||
.setTitle(R.string.bell_sync_title)
|
.setTitle(R.string.bell_sync_title)
|
||||||
.setView(b.root)
|
.setView(b.root)
|
||||||
.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
.setNeutralButton(R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
||||||
|
.setOnDismissListener {
|
||||||
|
counterJob?.cancel()
|
||||||
|
onDismissListener?.invoke(TAG)
|
||||||
|
}
|
||||||
.show()
|
.show()
|
||||||
initView()
|
initView()
|
||||||
}}
|
}}
|
||||||
|
@ -12,7 +12,6 @@ import pl.szczodrzynski.edziennik.App
|
|||||||
import pl.szczodrzynski.edziennik.MainActivity
|
import pl.szczodrzynski.edziennik.MainActivity
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
import pl.szczodrzynski.edziennik.databinding.DialogBellSyncTimeChooseBinding
|
import pl.szczodrzynski.edziennik.databinding.DialogBellSyncTimeChooseBinding
|
||||||
import pl.szczodrzynski.edziennik.onClick
|
|
||||||
import pl.szczodrzynski.edziennik.utils.TextInputDropDown
|
import pl.szczodrzynski.edziennik.utils.TextInputDropDown
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
import pl.szczodrzynski.edziennik.utils.models.Time
|
||||||
@ -26,6 +25,8 @@ class BellSyncTimeChooseDialog(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "BellSyncTimeChooseDialog"
|
const val TAG = "BellSyncTimeChooseDialog"
|
||||||
|
|
||||||
|
private const val MAX_DIFF_MINUTES = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var job: Job
|
private lateinit var job: Job
|
||||||
@ -39,7 +40,7 @@ class BellSyncTimeChooseDialog(
|
|||||||
|
|
||||||
private val today = Date.getToday()
|
private val today = Date.getToday()
|
||||||
private val selectedTime: Time?
|
private val selectedTime: Time?
|
||||||
get() = b.timeDropdown.selected?.id?.let { Time.fromValue(it.toInt()) }
|
get() = b.timeDropdown.selected?.tag as Time?
|
||||||
|
|
||||||
init { apply {
|
init { apply {
|
||||||
if (activity.isFinishing)
|
if (activity.isFinishing)
|
||||||
@ -57,15 +58,15 @@ class BellSyncTimeChooseDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
.setNegativeButton(R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
||||||
.setNeutralButton(R.string.reset, null)
|
|
||||||
.setOnDismissListener {
|
.setOnDismissListener {
|
||||||
onDismissListener?.invoke(TAG)
|
onDismissListener?.invoke(TAG)
|
||||||
}
|
}
|
||||||
.show()
|
.create()
|
||||||
|
.apply {
|
||||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).onClick {
|
setButton(AlertDialog.BUTTON_NEUTRAL, app.getString(R.string.reset)) { _, _ ->
|
||||||
showResetDialog()
|
showResetDialog()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initView()
|
initView()
|
||||||
}}
|
}}
|
||||||
@ -85,6 +86,17 @@ class BellSyncTimeChooseDialog(
|
|||||||
loadTimeList()
|
loadTimeList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkForLessons(timeList: List<Time>): Boolean {
|
||||||
|
return if (timeList.isNotEmpty()) {
|
||||||
|
val now = Time.getNow()
|
||||||
|
val first = timeList.first()
|
||||||
|
val last = timeList.last()
|
||||||
|
|
||||||
|
now.stepForward(0, MAX_DIFF_MINUTES, 0) >= first &&
|
||||||
|
now.stepForward(0, -1 * MAX_DIFF_MINUTES, 0) <= last
|
||||||
|
} else false
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadTimeList() { launch {
|
private fun loadTimeList() { launch {
|
||||||
val timeItems = withContext(Dispatchers.Default) {
|
val timeItems = withContext(Dispatchers.Default) {
|
||||||
val lessons = app.db.timetableDao().getForDateNow(App.profileId, today)
|
val lessons = app.db.timetableDao().getForDateNow(App.profileId, today)
|
||||||
@ -94,23 +106,31 @@ class BellSyncTimeChooseDialog(
|
|||||||
items += TextInputDropDown.Item(
|
items += TextInputDropDown.Item(
|
||||||
it.startTime?.value?.toLong() ?: return@forEach,
|
it.startTime?.value?.toLong() ?: return@forEach,
|
||||||
app.getString(R.string.bell_sync_lesson_item, it.displaySubjectName, it.startTime?.stringHM),
|
app.getString(R.string.bell_sync_lesson_item, it.displaySubjectName, it.startTime?.stringHM),
|
||||||
tag = it
|
tag = it.startTime
|
||||||
)
|
)
|
||||||
|
|
||||||
items += TextInputDropDown.Item(
|
items += TextInputDropDown.Item(
|
||||||
it.endTime?.value?.toLong() ?: return@forEach,
|
it.endTime?.value?.toLong() ?: return@forEach,
|
||||||
app.getString(R.string.bell_sync_break_item, it.endTime?.stringHM),
|
app.getString(R.string.bell_sync_break_item, it.endTime?.stringHM),
|
||||||
tag = it
|
tag = it.endTime
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!checkForLessons(timeItems.map { it.tag as Time })) {
|
||||||
|
/* Synchronization not possible */
|
||||||
|
MaterialAlertDialogBuilder(activity)
|
||||||
|
.setTitle(R.string.bell_sync_title)
|
||||||
|
.setMessage(R.string.bell_sync_cannot_now)
|
||||||
|
.setPositiveButton(R.string.ok) { dialog, _ -> dialog.dismiss() }
|
||||||
|
.show()
|
||||||
|
} else {
|
||||||
b.timeDropdown.clear()
|
b.timeDropdown.clear()
|
||||||
b.timeDropdown.append(timeItems)
|
b.timeDropdown.append(timeItems)
|
||||||
timeItems.forEachIndexed { index, item ->
|
timeItems.forEachIndexed { index, item ->
|
||||||
val time = Time.fromValue(item.id.toInt())
|
val time = item.tag as Time
|
||||||
if (time < Time.getNow()) {
|
if (time < Time.getNow()) {
|
||||||
b.timeDropdown.select(if (timeItems.size > index + 1) timeItems[index + 1] else item)
|
b.timeDropdown.select(if (timeItems.size > index + 1) timeItems[index + 1] else item)
|
||||||
}
|
}
|
||||||
@ -118,6 +138,9 @@ class BellSyncTimeChooseDialog(
|
|||||||
|
|
||||||
b.timeDropdown.isEnabled = true
|
b.timeDropdown.isEnabled = true
|
||||||
// TODO Fix popup cutting off
|
// TODO Fix popup cutting off
|
||||||
|
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
private fun showResetDialog() {
|
private fun showResetDialog() {
|
||||||
|
@ -20,7 +20,7 @@ import pl.szczodrzynski.edziennik.databinding.ActivityCounterBinding;
|
|||||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time;
|
import pl.szczodrzynski.edziennik.utils.models.Time;
|
||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment.updateInterval;
|
import static pl.szczodrzynski.edziennik.ui.modules.home.HomeFragmentOld.updateInterval;
|
||||||
|
|
||||||
public class CounterActivity extends AppCompatActivity {
|
public class CounterActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public class CounterActivity extends AppCompatActivity {
|
|||||||
private short counterType = TIME_LEFT;
|
private short counterType = TIME_LEFT;
|
||||||
private long updateCounter(Time syncedNow) {
|
private long updateCounter(Time syncedNow) {
|
||||||
Time diff = Time.diff(counterTarget, syncedNow);
|
Time diff = Time.diff(counterTarget, syncedNow);
|
||||||
b.timeLeft.setText(counterType == TIME_TILL ? HomeFragment.timeTill(app, diff, app.config.getTimetable().getCountInSeconds(), "\n") : HomeFragment.timeLeft(app, diff, app.config.getTimetable().getCountInSeconds(), "\n"));
|
b.timeLeft.setText(counterType == TIME_TILL ? HomeFragmentOld.timeTill(app, diff, app.config.getTimetable().getCountInSeconds(), "\n") : HomeFragmentOld.timeLeft(app, diff, app.config.getTimetable().getCountInSeconds(), "\n"));
|
||||||
return updateInterval(app, diff);
|
return updateInterval(app, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import kotlinx.coroutines.Job
|
|||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.MainActivity
|
import pl.szczodrzynski.edziennik.MainActivity
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentHomeV2Binding
|
import pl.szczodrzynski.edziennik.databinding.FragmentHomeBinding
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.home.StudentNumberDialog
|
import pl.szczodrzynski.edziennik.ui.dialogs.home.StudentNumberDialog
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.cards.HomeGradesCard
|
import pl.szczodrzynski.edziennik.ui.modules.home.cards.HomeGradesCard
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.cards.HomeLuckyNumberCard
|
import pl.szczodrzynski.edziennik.ui.modules.home.cards.HomeLuckyNumberCard
|
||||||
@ -38,7 +38,7 @@ import kotlin.coroutines.CoroutineContext
|
|||||||
|
|
||||||
class HomeFragmentV2 : Fragment(), CoroutineScope {
|
class HomeFragmentV2 : Fragment(), CoroutineScope {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "HomeFragment"
|
private const val TAG = "HomeFragmentOld"
|
||||||
|
|
||||||
fun swapCards(fromPosition: Int, toPosition: Int, cardAdapter: HomeCardAdapter) {
|
fun swapCards(fromPosition: Int, toPosition: Int, cardAdapter: HomeCardAdapter) {
|
||||||
val homeCards = App.getConfig().ui.homeCards.toMutableList()
|
val homeCards = App.getConfig().ui.homeCards.toMutableList()
|
||||||
@ -56,7 +56,7 @@ class HomeFragmentV2 : Fragment(), CoroutineScope {
|
|||||||
|
|
||||||
private lateinit var app: App
|
private lateinit var app: App
|
||||||
private lateinit var activity: MainActivity
|
private lateinit var activity: MainActivity
|
||||||
private lateinit var b: FragmentHomeV2Binding
|
private lateinit var b: FragmentHomeBinding
|
||||||
|
|
||||||
private lateinit var job: Job
|
private lateinit var job: Job
|
||||||
override val coroutineContext: CoroutineContext
|
override val coroutineContext: CoroutineContext
|
||||||
@ -67,7 +67,7 @@ class HomeFragmentV2 : Fragment(), CoroutineScope {
|
|||||||
context ?: return null
|
context ?: return null
|
||||||
app = activity.application as App
|
app = activity.application as App
|
||||||
context!!.theme.applyStyle(Themes.appTheme, true)
|
context!!.theme.applyStyle(Themes.appTheme, true)
|
||||||
b = FragmentHomeV2Binding.inflate(inflater)
|
b = FragmentHomeBinding.inflate(inflater)
|
||||||
b.refreshLayout.setParent(activity.swipeRefreshLayout)
|
b.refreshLayout.setParent(activity.swipeRefreshLayout)
|
||||||
job = Job()
|
job = Job()
|
||||||
return b.root
|
return b.root
|
@ -53,7 +53,7 @@ import pl.szczodrzynski.edziennik.data.db.modules.profiles.Profile;
|
|||||||
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
import pl.szczodrzynski.edziennik.data.db.modules.subjects.Subject;
|
||||||
import pl.szczodrzynski.edziennik.databinding.CardLuckyNumberBinding;
|
import pl.szczodrzynski.edziennik.databinding.CardLuckyNumberBinding;
|
||||||
import pl.szczodrzynski.edziennik.databinding.CardUpdateBinding;
|
import pl.szczodrzynski.edziennik.databinding.CardUpdateBinding;
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentHomeBinding;
|
import pl.szczodrzynski.edziennik.databinding.FragmentHomeOldBinding;
|
||||||
import pl.szczodrzynski.edziennik.receivers.BootReceiver;
|
import pl.szczodrzynski.edziennik.receivers.BootReceiver;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.login.LoginLibrusCaptchaActivity;
|
import pl.szczodrzynski.edziennik.ui.modules.login.LoginLibrusCaptchaActivity;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeActivity;
|
import pl.szczodrzynski.edziennik.ui.modules.messages.MessagesComposeActivity;
|
||||||
@ -67,7 +67,6 @@ import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetPrimaryItem;
|
|||||||
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem;
|
import pl.szczodrzynski.navlib.bottomsheet.items.BottomSheetSeparatorItem;
|
||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.App.UPDATES_ON_PLAY_STORE;
|
import static pl.szczodrzynski.edziennik.App.UPDATES_ON_PLAY_STORE;
|
||||||
import static pl.szczodrzynski.edziennik.MainActivity.DRAWER_ITEM_GRADES;
|
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_FINAL;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER1_PROPOSED;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_SEMESTER2_FINAL;
|
||||||
@ -76,11 +75,11 @@ import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_
|
|||||||
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.grades.Grade.TYPE_YEAR_PROPOSED;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
import static pl.szczodrzynski.edziennik.data.db.modules.login.LoginStore.LOGIN_TYPE_MOBIDZIENNIK;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragmentOld extends Fragment {
|
||||||
private static final String TAG = "HomeFragment";
|
private static final String TAG = "HomeFragmentOld";
|
||||||
private App app = null;
|
private App app = null;
|
||||||
private MainActivity activity = null;
|
private MainActivity activity = null;
|
||||||
private FragmentHomeBinding b = null;
|
private FragmentHomeOldBinding b = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
@ -92,7 +91,7 @@ public class HomeFragment extends Fragment {
|
|||||||
if (app.profile == null)
|
if (app.profile == null)
|
||||||
return inflater.inflate(R.layout.fragment_loading, container, false);
|
return inflater.inflate(R.layout.fragment_loading, container, false);
|
||||||
// activity, context and profile is valid
|
// activity, context and profile is valid
|
||||||
b = DataBindingUtil.inflate(inflater, R.layout.fragment_home, container, false);
|
b = DataBindingUtil.inflate(inflater, R.layout.fragment_home_old, container, false);
|
||||||
b.refreshLayout.setParent(activity.getSwipeRefreshLayout());
|
b.refreshLayout.setParent(activity.getSwipeRefreshLayout());
|
||||||
return b.getRoot();
|
return b.getRoot();
|
||||||
}
|
}
|
||||||
@ -261,7 +260,7 @@ public class HomeFragment extends Fragment {
|
|||||||
b.cardLuckyNumber.setOnClickListener(v1 -> setNumberDialog());
|
b.cardLuckyNumber.setOnClickListener(v1 -> setNumberDialog());
|
||||||
}
|
}
|
||||||
|
|
||||||
timetableCard = new HomeTimetableCard(app, activity, this, layoutInflater, insertPoint);
|
timetableCard = new HomeTimetableCardOld(app, activity, this, layoutInflater, insertPoint);
|
||||||
timetableCard.run();
|
timetableCard.run();
|
||||||
|
|
||||||
configCardGrades(activity, layoutInflater, activity, insertPoint);
|
configCardGrades(activity, layoutInflater, activity, insertPoint);
|
||||||
@ -571,7 +570,7 @@ public class HomeFragment extends Fragment {
|
|||||||
Button cardGradesButton = root.findViewById(R.id.cardGradesButton);
|
Button cardGradesButton = root.findViewById(R.id.cardGradesButton);
|
||||||
buttonAddDrawable(c, cardGradesButton, CommunityMaterial.Icon.cmd_arrow_right);
|
buttonAddDrawable(c, cardGradesButton, CommunityMaterial.Icon.cmd_arrow_right);
|
||||||
cardGradesButton.setOnClickListener((v1 -> new Handler().postDelayed(() -> a.runOnUiThread(() -> {
|
cardGradesButton.setOnClickListener((v1 -> new Handler().postDelayed(() -> a.runOnUiThread(() -> {
|
||||||
activity.loadTarget(DRAWER_ITEM_GRADES, null);
|
activity.loadTarget(MainActivity.DRAWER_ITEM_GRADES, null);
|
||||||
}), 100)));
|
}), 100)));
|
||||||
|
|
||||||
//new Handler().postDelayed(() -> a.runOnUiThread(() -> updateCardGrades(c, a, root)), newRefreshInterval);
|
//new Handler().postDelayed(() -> a.runOnUiThread(() -> updateCardGrades(c, a, root)), newRefreshInterval);
|
||||||
@ -591,5 +590,5 @@ public class HomeFragment extends Fragment {
|
|||||||
insertPoint.addView(root, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
insertPoint.addView(root, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HomeTimetableCard timetableCard;
|
private HomeTimetableCardOld timetableCard;
|
||||||
}
|
}
|
@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Kacper Ziubryniewicz 2019-11-22
|
|
||||||
*/
|
|
||||||
|
|
||||||
package pl.szczodrzynski.edziennik.ui.modules.home
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.AsyncTask
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
|
|
||||||
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
import androidx.databinding.DataBindingUtil
|
|
||||||
import com.afollestad.materialdialogs.DialogAction
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
|
||||||
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
|
|
||||||
import pl.szczodrzynski.edziennik.App
|
|
||||||
import pl.szczodrzynski.edziennik.MainActivity
|
|
||||||
import pl.szczodrzynski.edziennik.R
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.events.Event
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.timetable.Lesson
|
|
||||||
import pl.szczodrzynski.edziennik.databinding.CardTimetableBinding
|
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment.updateInterval
|
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Time
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class HomeTimetableCard(
|
|
||||||
private val app: App,
|
|
||||||
private val activity: MainActivity,
|
|
||||||
private val homeFragment: HomeFragment,
|
|
||||||
private val layoutInflater: LayoutInflater,
|
|
||||||
private val insertPoint: ViewGroup
|
|
||||||
) {
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "HomeTimetableCard"
|
|
||||||
const val TIME_TILL = 0
|
|
||||||
const val TIME_LEFT = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var timetableTimer: Timer
|
|
||||||
private lateinit var b: CardTimetableBinding
|
|
||||||
|
|
||||||
private var bellSyncTime: Time? = null
|
|
||||||
|
|
||||||
private var counterType = TIME_TILL
|
|
||||||
private val counterTarget = Time(0, 0, 0)
|
|
||||||
|
|
||||||
private val lessons = mutableListOf<Lesson>()
|
|
||||||
private val events = mutableListOf<Event>()
|
|
||||||
|
|
||||||
fun run() {
|
|
||||||
timetableTimer = Timer()
|
|
||||||
b = DataBindingUtil.inflate(layoutInflater, R.layout.card_timetable, null, false)
|
|
||||||
|
|
||||||
update()
|
|
||||||
|
|
||||||
insertPoint.addView(b.root, ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT))
|
|
||||||
|
|
||||||
b.cardTimetableFullscreenCounter.setOnClickListener {
|
|
||||||
activity.startActivity(Intent(activity, CounterActivity::class.java))
|
|
||||||
}
|
|
||||||
|
|
||||||
b.cardTimetableBellSync.setOnClickListener {
|
|
||||||
if (bellSyncTime == null) {
|
|
||||||
MaterialDialog.Builder(activity)
|
|
||||||
.title(R.string.bell_sync_title)
|
|
||||||
.content(R.string.bell_sync_cannot_now)
|
|
||||||
.positiveText(R.string.ok)
|
|
||||||
.show()
|
|
||||||
} else {
|
|
||||||
MaterialDialog.Builder(activity)
|
|
||||||
.title(R.string.bell_sync_title)
|
|
||||||
.content(app.getString(R.string.bell_sync_howto, bellSyncTime!!.stringHM).toString() +
|
|
||||||
when {
|
|
||||||
app.config.timetable.bellSyncDiff != null -> app.getString(R.string.bell_sync_current_dialog,
|
|
||||||
(if (app.config.timetable.bellSyncMultiplier == -1) "-" else "+") + app.config.timetable.bellSyncDiff?.stringHMS)
|
|
||||||
else -> ""
|
|
||||||
})
|
|
||||||
.positiveText(R.string.ok)
|
|
||||||
.negativeText(R.string.cancel)
|
|
||||||
.neutralText(R.string.reset)
|
|
||||||
.onPositive { _, _: DialogAction? ->
|
|
||||||
val bellDiff = Time.diff(Time.getNow(), bellSyncTime)
|
|
||||||
app.config.timetable.bellSyncDiff = bellDiff
|
|
||||||
app.config.timetable.bellSyncMultiplier = if (bellSyncTime!!.value > Time.getNow().value) -1 else 1
|
|
||||||
|
|
||||||
MaterialDialog.Builder(activity)
|
|
||||||
.title(R.string.bell_sync_title)
|
|
||||||
.content(app.getString(R.string.bell_sync_results, if (bellSyncTime!!.value > Time.getNow().value) "-" else "+", bellDiff.stringHMS))
|
|
||||||
.positiveText(R.string.ok)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
.onNeutral { _, _ ->
|
|
||||||
MaterialDialog.Builder(activity)
|
|
||||||
.title(R.string.bell_sync_title)
|
|
||||||
.content(R.string.bell_sync_reset_confirm)
|
|
||||||
.positiveText(R.string.yes)
|
|
||||||
.negativeText(R.string.no)
|
|
||||||
.onPositive { _, _ ->
|
|
||||||
app.config.timetable.bellSyncDiff = null
|
|
||||||
app.config.timetable.bellSyncMultiplier = 0
|
|
||||||
app.saveConfig("bellSyncDiff", "bellSyncMultiplier")
|
|
||||||
}
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HomeFragment.buttonAddDrawable(activity, b.cardTimetableButton, CommunityMaterial.Icon.cmd_arrow_right)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun destroy() {
|
|
||||||
try {
|
|
||||||
timetableTimer.apply {
|
|
||||||
cancel()
|
|
||||||
purge()
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun update() {
|
|
||||||
if (!homeFragment.isAdded) return
|
|
||||||
|
|
||||||
val now = Time.getNow()
|
|
||||||
|
|
||||||
val syncedNow: Time = when (app.config.timetable.bellSyncDiff != null) {
|
|
||||||
true -> when {
|
|
||||||
app.config.timetable.bellSyncMultiplier < 0 -> Time.sum(now, app.config.timetable.bellSyncDiff)
|
|
||||||
app.config.timetable.bellSyncMultiplier > 0 -> Time.diff(now, app.config.timetable.bellSyncDiff)
|
|
||||||
else -> now
|
|
||||||
}
|
|
||||||
else -> now
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lessons.size == 0 || syncedNow.value > counterTarget.value) {
|
|
||||||
findLessons(syncedNow)
|
|
||||||
} else {
|
|
||||||
scheduleUpdate(updateCounter(syncedNow))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateCounter(syncedNow: Time): Long {
|
|
||||||
val diff = Time.diff(counterTarget, syncedNow)
|
|
||||||
b.cardTimetableTimeLeft.text = when (counterType) {
|
|
||||||
TIME_TILL -> HomeFragment.timeTill(app, diff, app.config.timetable.countInSeconds)
|
|
||||||
else -> HomeFragment.timeLeft(app, diff, app.config.timetable.countInSeconds)
|
|
||||||
}
|
|
||||||
bellSyncTime = counterTarget.clone()
|
|
||||||
b.cardTimetableFullscreenCounter.visibility = View.VISIBLE
|
|
||||||
return updateInterval(app, diff)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun scheduleUpdate(newRefreshInterval: Long) {
|
|
||||||
timetableTimer.schedule(object : TimerTask() {
|
|
||||||
override fun run() {
|
|
||||||
activity.runOnUiThread { update() }
|
|
||||||
}
|
|
||||||
}, newRefreshInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun findLessons(syncedNow: Time) {
|
|
||||||
AsyncTask.execute {
|
|
||||||
val today = Date.getToday()
|
|
||||||
val searchEnd = Date.getToday().stepForward(0, 0, -today.weekDay)
|
|
||||||
|
|
||||||
lessons.apply {
|
|
||||||
clear()
|
|
||||||
addAll(app.db.timetableDao().getBetweenDatesNow(today, searchEnd))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -32,21 +32,21 @@ import pl.szczodrzynski.edziennik.utils.models.Week;
|
|||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CANCELLED;
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
import static pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonChange.TYPE_CHANGE;
|
||||||
import static pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment.updateInterval;
|
import static pl.szczodrzynski.edziennik.ui.modules.home.HomeFragmentOld.updateInterval;
|
||||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||||
|
|
||||||
public class HomeTimetableCardOld {
|
public class HomeTimetableCardOld {
|
||||||
private static final String TAG = "HomeTimetableCardOld";
|
private static final String TAG = "HomeTimetableCardOld";
|
||||||
private App app;
|
private App app;
|
||||||
private MainActivity a;
|
private MainActivity a;
|
||||||
private HomeFragment f;
|
private HomeFragmentOld f;
|
||||||
private LayoutInflater layoutInflater;
|
private LayoutInflater layoutInflater;
|
||||||
private ViewGroup insertPoint;
|
private ViewGroup insertPoint;
|
||||||
private CardTimetableBinding b;
|
private CardTimetableBinding b;
|
||||||
private Timer timetableTimer;
|
private Timer timetableTimer;
|
||||||
private Time bellSyncTime = null;
|
private Time bellSyncTime = null;
|
||||||
|
|
||||||
public HomeTimetableCardOld(App app, MainActivity a, HomeFragment f, LayoutInflater layoutInflater, ViewGroup insertPoint) {
|
public HomeTimetableCardOld(App app, MainActivity a, HomeFragmentOld f, LayoutInflater layoutInflater, ViewGroup insertPoint) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.a = a;
|
this.a = a;
|
||||||
this.f = f;
|
this.f = f;
|
||||||
@ -109,7 +109,7 @@ public class HomeTimetableCardOld {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
HomeFragment.buttonAddDrawable(a, b.cardTimetableButton, CommunityMaterial.Icon.cmd_arrow_right);
|
HomeFragmentOld.buttonAddDrawable(a, b.cardTimetableButton, CommunityMaterial.Icon.cmd_arrow_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LessonFull> lessons = new ArrayList<>();
|
private List<LessonFull> lessons = new ArrayList<>();
|
||||||
@ -228,7 +228,7 @@ public class HomeTimetableCardOld {
|
|||||||
private short counterType = TIME_TILL;
|
private short counterType = TIME_TILL;
|
||||||
private long updateCounter(Time syncedNow) {
|
private long updateCounter(Time syncedNow) {
|
||||||
Time diff = Time.diff(counterTarget, syncedNow);
|
Time diff = Time.diff(counterTarget, syncedNow);
|
||||||
b.cardTimetableTimeLeft.setText(counterType == TIME_TILL ? HomeFragment.timeTill(app, diff, app.config.getTimetable().getCountInSeconds()) : HomeFragment.timeLeft(app, diff, app.config.getTimetable().getCountInSeconds()));
|
b.cardTimetableTimeLeft.setText(counterType == TIME_TILL ? HomeFragmentOld.timeTill(app, diff, app.config.getTimetable().getCountInSeconds()) : HomeFragmentOld.timeLeft(app, diff, app.config.getTimetable().getCountInSeconds()));
|
||||||
bellSyncTime = counterTarget;
|
bellSyncTime = counterTarget;
|
||||||
b.cardTimetableFullscreenCounter.setVisibility(View.VISIBLE);
|
b.cardTimetableFullscreenCounter.setVisibility(View.VISIBLE);
|
||||||
return updateInterval(app, diff);
|
return updateInterval(app, diff);
|
||||||
|
@ -21,7 +21,7 @@ import pl.szczodrzynski.edziennik.MainActivity;
|
|||||||
import pl.szczodrzynski.edziennik.R;
|
import pl.szczodrzynski.edziennik.R;
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
import pl.szczodrzynski.edziennik.data.db.modules.events.EventFull;
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
import pl.szczodrzynski.edziennik.ui.dialogs.event.EventManualDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragmentOld;
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
import static pl.szczodrzynski.edziennik.utils.Utils.bs;
|
||||||
@ -53,7 +53,7 @@ public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.ViewHo
|
|||||||
else if (dayDiff == 2) {
|
else if (dayDiff == 2) {
|
||||||
return context.getString(R.string.the_day_after);
|
return context.getString(R.string.the_day_after);
|
||||||
}
|
}
|
||||||
return HomeFragment.plural(context, R.plurals.time_till_days, Math.abs(dayDiff));
|
return HomeFragmentOld.plural(context, R.plurals.time_till_days, Math.abs(dayDiff));
|
||||||
}
|
}
|
||||||
else if (dayDiff < 0) {
|
else if (dayDiff < 0) {
|
||||||
if (dayDiff == -1) {
|
if (dayDiff == -1) {
|
||||||
@ -62,7 +62,7 @@ public class HomeworkAdapter extends RecyclerView.Adapter<HomeworkAdapter.ViewHo
|
|||||||
else if (dayDiff == -2) {
|
else if (dayDiff == -2) {
|
||||||
return context.getString(R.string.the_day_before);
|
return context.getString(R.string.the_day_before);
|
||||||
}
|
}
|
||||||
return context.getString(R.string.ago_format, HomeFragment.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
|
return context.getString(R.string.ago_format, HomeFragmentOld.plural(context, R.plurals.time_till_days, Math.abs(dayDiff)));
|
||||||
}
|
}
|
||||||
return context.getString(R.string.today);
|
return context.getString(R.string.today);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ import pl.szczodrzynski.edziennik.receivers.BootReceiver;
|
|||||||
import pl.szczodrzynski.edziennik.sync.SyncWorker;
|
import pl.szczodrzynski.edziennik.sync.SyncWorker;
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog;
|
import pl.szczodrzynski.edziennik.ui.dialogs.changelog.ChangelogDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileRemoveDialog;
|
import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileRemoveDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragmentOld;
|
||||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date;
|
import pl.szczodrzynski.edziennik.utils.models.Date;
|
||||||
@ -513,14 +513,14 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
|||||||
if (app.config.getSync().getInterval() < 60 * 60)
|
if (app.config.getSync().getInterval() < 60 * 60)
|
||||||
return getString(
|
return getString(
|
||||||
R.string.settings_sync_sync_interval_subtext_format,
|
R.string.settings_sync_sync_interval_subtext_format,
|
||||||
HomeFragment.plural(activity, R.plurals.time_till_minutes, app.config.getSync().getInterval() / 60)
|
HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, app.config.getSync().getInterval() / 60)
|
||||||
);
|
);
|
||||||
return getString(
|
return getString(
|
||||||
R.string.settings_sync_sync_interval_subtext_format,
|
R.string.settings_sync_sync_interval_subtext_format,
|
||||||
HomeFragment.plural(activity, R.plurals.time_till_hours, app.config.getSync().getInterval() / 60 / 60) +
|
HomeFragmentOld.plural(activity, R.plurals.time_till_hours, app.config.getSync().getInterval() / 60 / 60) +
|
||||||
(app.config.getSync().getInterval() / 60 % 60 == 0 ?
|
(app.config.getSync().getInterval() / 60 % 60 == 0 ?
|
||||||
"" :
|
"" :
|
||||||
" " + HomeFragment.plural(activity, R.plurals.time_till_minutes, app.config.getSync().getInterval() / 60 % 60)
|
" " + HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, app.config.getSync().getInterval() / 60 % 60)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -566,16 +566,16 @@ public class SettingsNewFragment extends MaterialAboutFragment {
|
|||||||
syncCardIntervalItem.setOnClickAction(() -> {
|
syncCardIntervalItem.setOnClickAction(() -> {
|
||||||
List<CharSequence> intervalNames = new ArrayList<>();
|
List<CharSequence> intervalNames = new ArrayList<>();
|
||||||
if (App.devMode && false) {
|
if (App.devMode && false) {
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_seconds, 30));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_seconds, 30));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_minutes, 2));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, 2));
|
||||||
}
|
}
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_minutes, 30));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, 30));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_minutes, 45));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, 45));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_hours, 1));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_hours, 1));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_hours, 1)+" "+HomeFragment.plural(activity, R.plurals.time_till_minutes, 30));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_hours, 1)+" "+ HomeFragmentOld.plural(activity, R.plurals.time_till_minutes, 30));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_hours, 2));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_hours, 2));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_hours, 3));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_hours, 3));
|
||||||
intervalNames.add(HomeFragment.plural(activity, R.plurals.time_till_hours, 4));
|
intervalNames.add(HomeFragmentOld.plural(activity, R.plurals.time_till_hours, 4));
|
||||||
List<Integer> intervals = new ArrayList<>();
|
List<Integer> intervals = new ArrayList<>();
|
||||||
if (App.devMode && false) {
|
if (App.devMode && false) {
|
||||||
intervals.add(30);
|
intervals.add(30);
|
||||||
|
@ -52,7 +52,7 @@ import pl.szczodrzynski.edziennik.R;
|
|||||||
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
import pl.szczodrzynski.edziennik.data.db.modules.lessons.LessonFull;
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentTimetableBinding;
|
import pl.szczodrzynski.edziennik.databinding.FragmentTimetableBinding;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.error.ErrorDialog;
|
import pl.szczodrzynski.edziennik.ui.modules.error.ErrorDialog;
|
||||||
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragment;
|
import pl.szczodrzynski.edziennik.ui.modules.home.HomeFragmentOld;
|
||||||
import pl.szczodrzynski.edziennik.utils.SpannableHtmlTagHandler;
|
import pl.szczodrzynski.edziennik.utils.SpannableHtmlTagHandler;
|
||||||
import pl.szczodrzynski.edziennik.utils.Themes;
|
import pl.szczodrzynski.edziennik.utils.Themes;
|
||||||
import pl.szczodrzynski.edziennik.utils.Utils;
|
import pl.szczodrzynski.edziennik.utils.Utils;
|
||||||
@ -184,7 +184,7 @@ public class TimetableFragment extends Fragment {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
List<LessonFull> lessons = app.db.lessonDao().getAllWeekNow(App.profileId, today.getWeekStart(), today);
|
List<LessonFull> lessons = app.db.lessonDao().getAllWeekNow(App.profileId, today.getWeekStart(), today);
|
||||||
displayingDate = HomeFragment.findDateWithLessons(App.profileId, lessons);
|
displayingDate = HomeFragmentOld.findDateWithLessons(App.profileId, lessons);
|
||||||
pageSelection = 2 + Date.diffDays(displayingDate, today); // DEFAULT HERE
|
pageSelection = 2 + Date.diffDays(displayingDate, today); // DEFAULT HERE
|
||||||
|
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
|
@ -167,7 +167,7 @@ public class Time implements Comparable<Time> {
|
|||||||
long t2millis = t2.getInMillis();
|
long t2millis = t2.getInMillis();
|
||||||
int multiplier = (t1millis > t2millis ? 1 : -1);
|
int multiplier = (t1millis > t2millis ? 1 : -1);
|
||||||
Time diff = Time.fromMillis((t1millis - t2millis)*multiplier);
|
Time diff = Time.fromMillis((t1millis - t2millis)*multiplier);
|
||||||
diff.hour -= 1;
|
// diff.hour -= 1;
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ public class Time implements Comparable<Time> {
|
|||||||
long t1millis = t1.getInMillis();
|
long t1millis = t1.getInMillis();
|
||||||
long t2millis = t2.getInMillis();
|
long t2millis = t2.getInMillis();
|
||||||
Time sum = Time.fromMillis((t1millis + t2millis));
|
Time sum = Time.fromMillis((t1millis + t2millis));
|
||||||
sum.hour += 1;
|
// sum.hour += 1;
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,101 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<!--
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
~ Copyright (c) Kuba Szczodrzyński 2019-11-23.
|
||||||
tools:context=".HomeFragment">
|
-->
|
||||||
|
|
||||||
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
|
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
|
||||||
android:id="@+id/refreshLayout"
|
android:id="@+id/refreshLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ScrollView
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
tools:listitem="@layout/card_home" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context=".ui.modules.home.HomeFragment">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/cardInsertPoint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nextSync"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
tools:text="TextView" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/devMode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:visibility="visible"
|
|
||||||
tools:ignore="HardcodedText">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/getLogs"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:text="Save Debug Logs" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/librusCaptchaButton"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:text="Librus Captcha" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/runChucker"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:text="Launch Chucker" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/mobidziennikMessagesSwitch"
|
|
||||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Zmień moduł wiadomości" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/composeButton"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Compose" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/pruneWorkButton"
|
|
||||||
style="@style/Widget.MaterialComponents.Button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:text="Prune finished work" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
|
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
|
||||||
</layout>
|
</layout>
|
101
app/src/main/res/layout/fragment_home_old.xml
Normal file
101
app/src/main/res/layout/fragment_home_old.xml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".HomeFragment">
|
||||||
|
|
||||||
|
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
|
||||||
|
android:id="@+id/refreshLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".ui.modules.home.HomeFragmentOld">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/cardInsertPoint"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/nextSync"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
tools:text="TextView" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/devMode"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:visibility="visible"
|
||||||
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/getLogs"
|
||||||
|
style="@style/Widget.MaterialComponents.Button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:text="Save Debug Logs" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/librusCaptchaButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:text="Librus Captcha" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/runChucker"
|
||||||
|
style="@style/Widget.MaterialComponents.Button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:text="Launch Chucker" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/mobidziennikMessagesSwitch"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Zmień moduł wiadomości" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/composeButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Compose" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/pruneWorkButton"
|
||||||
|
style="@style/Widget.MaterialComponents.Button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
android:text="Prune finished work" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
|
||||||
|
</layout>
|
@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (c) Kuba Szczodrzyński 2019-11-23.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator
|
|
||||||
android:id="@+id/refreshLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/list"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:listitem="@layout/card_home" />
|
|
||||||
|
|
||||||
</pl.szczodrzynski.edziennik.utils.SwipeRefreshLayoutNoIndicator>
|
|
||||||
</layout>
|
|
Loading…
x
Reference in New Issue
Block a user