Merge branch 'develop' into RecyclerView
This commit is contained in:
@@ -22,6 +22,9 @@ public interface CouponDao {
|
||||
@Query("SELECT * FROM coupon")
|
||||
LiveData<List<Coupon>> selectAll();
|
||||
|
||||
@Update
|
||||
public void update(Coupon coupon);
|
||||
|
||||
/*
|
||||
to add an observer to the livedata, you can use the example from https://medium.com/mindorks/using-room-database-with-livedata-android-jetpack-cbf89b677b47
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,14 @@ public class CouponRepository {
|
||||
mAllCoupons = mCouponDao.selectAll();
|
||||
}
|
||||
|
||||
public void insert(Coupon... coupons) {
|
||||
mCouponDao.insertAll(coupons);
|
||||
}
|
||||
|
||||
public void update(Coupon coupon) {
|
||||
mCouponDao.update(coupon);
|
||||
}
|
||||
|
||||
public LiveData<List<Coupon>> getAllCoupons() {
|
||||
return mAllCoupons;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.a1.nextlocation.fragments;
|
||||
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -13,11 +19,6 @@ import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.a1.nextlocation.R;
|
||||
|
||||
import org.osmdroid.api.IMapController;
|
||||
@@ -69,7 +70,7 @@ public class HomeFragment extends Fragment {
|
||||
Configuration.getInstance().setUserAgentValue(userAgent);
|
||||
|
||||
// create the map view
|
||||
mapView = (MapView) view.findViewById(R.id.mapView);
|
||||
mapView = view.findViewById(R.id.mapView);
|
||||
mapView.setDestroyMode(false);
|
||||
mapView.setTag("mapView");
|
||||
mapView.setMultiTouchControls(true);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.a1.nextlocation.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
@@ -23,15 +25,20 @@ public class SettingsFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
View view = getView();
|
||||
Spinner dropdown = view.findViewById(R.id.dropdown_menu_Settings);
|
||||
|
||||
String[] items = new String[]{"Nederlands", "Engels", "Chinees"};
|
||||
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, items);
|
||||
|
||||
dropdown.setAdapter(arrayAdapter);
|
||||
|
||||
return inflater.inflate(R.layout.fragment_settings, container, false);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
tools:context=".fragments.HomeFragment">
|
||||
|
||||
|
||||
<com.google.android.gms.maps.MapView
|
||||
<org.osmdroid.views.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
Reference in New Issue
Block a user