Font now changes according to last change when starting application, added scrollView to location detail, location detail now takes location name and description and added 2 discriptions to location.json

This commit is contained in:
sebas
2021-01-06 11:54:39 +01:00
parent 0e63bff0f1
commit deb599db25
4 changed files with 37 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.a1.nextlocation.R;
import com.a1.nextlocation.data.Location;
@@ -20,6 +21,8 @@ public class LocationDetailFragment extends Fragment {
private ImageButton imageButton;
private ImageView locationImage;
private Location location;
private TextView titelText;
private TextView detailText;
public LocationDetailFragment(){}
@@ -30,8 +33,14 @@ public class LocationDetailFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_location_detail, container, false);
this.titelText = view.findViewById(R.id.detail_location_name);
this.titelText.setText(location.getName());
this.detailText = view.findViewById(R.id.detail_location_text);
this.detailText.setText(location.getDescription());
this.imageButton = view.findViewById(R.id.detail_location_back_button);
this.imageButton.setOnClickListener(v -> {
LocationFragment locationFragment = new LocationFragment();

View File

@@ -22,6 +22,7 @@ import com.a1.nextlocation.R;
public class SettingsFragment extends Fragment {
private ImageView imageButton;
SwitchCompat fontChanger;
@Override
@@ -53,8 +54,14 @@ public class SettingsFragment extends Fragment {
fontChanger = view.findViewById(R.id.BigFont);
SharedPreferences sharedPreferences = requireActivity().getSharedPreferences("com.a1.nextlocation",0);
final SharedPreferences.Editor editor = sharedPreferences.edit();
fontChanger.setChecked(sharedPreferences.getBoolean("switch",false));
SharedPreferences.Editor editor = sharedPreferences.edit();
fontChanger.setChecked(sharedPreferences.getBoolean("switch", false));
if (fontChanger.isChecked()){
requireActivity().setTheme(R.style.Theme_NextLocationBig);
}else if (!fontChanger.isChecked()){
requireActivity().setTheme(R.style.Theme_NextLocation);
}
fontChanger.setOnClickListener(view1 -> {
if(fontChanger.isChecked())