diff --git a/app/src/main/java/it/reyboz/bustorino/ActivityExperiments.java b/app/src/main/java/it/reyboz/bustorino/ActivityExperiments.java
index b2a91d0..8b40c43 100644
--- a/app/src/main/java/it/reyboz/bustorino/ActivityExperiments.java
+++ b/app/src/main/java/it/reyboz/bustorino/ActivityExperiments.java
@@ -1,93 +1,93 @@
/*
BusTO - Data components
Copyright (C) 2021 Fabio Mazza
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
package it.reyboz.bustorino;
import android.os.Bundle;
import android.util.Log;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.FragmentTransaction;
import it.reyboz.bustorino.backend.Stop;
import it.reyboz.bustorino.fragments.*;
import it.reyboz.bustorino.middleware.GeneralActivity;
public class ActivityExperiments extends GeneralActivity implements CommonFragmentListener {
final static String DEBUG_TAG = "ExperimentsActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_container_fragment);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setIcon(R.drawable.ic_launcher);
}
if (savedInstanceState==null) {
getSupportFragmentManager().beginTransaction()
.setReorderingAllowed(true)
/* .add(R.id.fragment_container_view, LinesDetailFragment.class,
LinesDetailFragment.Companion.makeArgs("gtt:4U"))
*/
//.add(R.id.fragment_container_view, LinesGridShowingFragment.class, null)
//.add(R.id.fragment_container_view, IntroFragment.class, IntroFragment.makeArguments(0))
//.commit();
//.add(R.id.fragment_container_view, LinesDetailFragment.class,
// LinesDetailFragment.Companion.makeArgs("gtt:4U"))
- .add(R.id.fragment_container_view, BackupImportFragment.class, null)
+ .add(R.id.fragment_container_view, CrashFragment.class, null)
.commit();
}
}
@Override
public void showFloatingActionButton(boolean yes) {
Log.d(DEBUG_TAG, "Asked to show the action button");
}
@Override
public void readyGUIfor(FragmentKind fragmentType) {
Log.d(DEBUG_TAG, "Asked to prepare the GUI for fragmentType "+fragmentType);
}
@Override
public void requestArrivalsForStopID(String ID) {
}
@Override
public void showMapCenteredOnStop(Stop stop) {
}
@Override
public void showLineOnMap(String routeGtfsId){
readyGUIfor(FragmentKind.LINES);
FragmentTransaction tr = getSupportFragmentManager().beginTransaction();
tr.replace(R.id.fragment_container_view, LinesDetailFragment.class,
LinesDetailFragment.Companion.makeArgs(routeGtfsId));
tr.addToBackStack("LineonMap-"+routeGtfsId);
tr.commit();
}
}
\ No newline at end of file
diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/CrashFragment.kt b/app/src/main/java/it/reyboz/bustorino/fragments/CrashFragment.kt
new file mode 100644
index 0000000..02d7e06
--- /dev/null
+++ b/app/src/main/java/it/reyboz/bustorino/fragments/CrashFragment.kt
@@ -0,0 +1,57 @@
+package it.reyboz.bustorino.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Button
+import android.widget.Toast
+import it.reyboz.bustorino.R
+
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [CrashFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class CrashFragment : Fragment() {
+ private lateinit var crashButton: Button
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ val root= inflater.inflate(R.layout.fragment_crash, container, false)
+
+ crashButton = root.findViewById(R.id.buttonCrash)
+ crashButton.setOnClickListener {
+
+ Toast.makeText(requireContext(), "App goes bye bye", Toast.LENGTH_SHORT).show()
+ throw IllegalArgumentException("Nobody expects the Spanish Inquisition!")
+ }
+ return root
+ }
+
+ companion object {
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+
+ * @return A new instance of fragment CrashFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ @JvmStatic
+ fun newInstance() =
+ CrashFragment().apply {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_crash.xml b/app/src/main/res/layout/fragment_crash.xml
new file mode 100644
index 0000000..703418a
--- /dev/null
+++ b/app/src/main/res/layout/fragment_crash.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file