diff options
4 files changed, 33 insertions, 45 deletions
diff --git a/Client/BrzoDoLokacije/app/build.gradle b/Client/BrzoDoLokacije/app/build.gradle index 523fa3b..b27d299 100644 --- a/Client/BrzoDoLokacije/app/build.gradle +++ b/Client/BrzoDoLokacije/app/build.gradle @@ -62,4 +62,7 @@ dependencies { //Glide implementation 'com.github.bumptech.glide:glide:4.12.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' + + //OSMDROID + implementation 'org.osmdroid:osmdroid-android:6.1.14' }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml index ef57e6c..e33932c 100644 --- a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml +++ b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml @@ -14,7 +14,10 @@ <uses-permission android:name="android.permission.CAMERA" android:required="true" - android:requiredFeature="true" /> <!-- SVOJSTVA --> + android:requiredFeature="true" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + + <!-- SVOJSTVA --> <uses-feature android:name="android.hardware.camera" android:required="true" /> diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt index 1bd98a0..9194c07 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt @@ -1,60 +1,42 @@ package com.example.brzodolokacije.Fragments +import android.content.Context import android.os.Bundle -import androidx.fragment.app.Fragment +import android.preference.PreferenceManager import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import com.example.brzodolokacije.R +import org.osmdroid.views.MapView +import org.osmdroid.config.Configuration; -// TODO: Rename parameter arguments, choose names that match -// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER -private const val ARG_PARAM1 = "param1" -private const val ARG_PARAM2 = "param2" - -/** - * A simple [Fragment] subclass. - * Use the [FragmentBrowse.newInstance] factory method to - * create an instance of this fragment. - */ class FragmentBrowse : Fragment(R.layout.fragment_browse) { - // TODO: Rename and change types of parameters - private var param1: String? = null - private var param2: String? = null + + var map: MapView? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - arguments?.let { - param1 = it.getString(ARG_PARAM1) - param2 = it.getString(ARG_PARAM2) - } + + } override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_browse, container, false) - } + var v:View=inflater.inflate(R.layout.fragment_browse, container, false) + val ctx: Context = requireContext() + Configuration.getInstance().load(ctx,PreferenceManager.getDefaultSharedPreferences(ctx)); - companion object { - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment FragmentBrowse. - */ - // TODO: Rename and change types and number of parameters - @JvmStatic - fun newInstance(param1: String, param2: String) = - FragmentBrowse().apply { - arguments = Bundle().apply { - putString(ARG_PARAM1, param1) - putString(ARG_PARAM2, param2) - } - } + + map=v.findViewById(R.id.FragmentBrowseMapView) as MapView + + + + + + return v } + }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml index 3287683..a811522 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml @@ -4,11 +4,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Fragments.FragmentBrowse"> + <org.osmdroid.views.MapView + android:id="@+id/FragmentBrowseMapView" + android:layout_width="fill_parent" + android:layout_height="fill_parent"/> + - <!-- TODO: Update blank fragment layout --> - <TextView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:text="Browse" /> </FrameLayout>
\ No newline at end of file |