diff --git a/MiMall/.gitignore b/MiMall/.gitignore new file mode 100644 index 0000000..2b38f4a --- /dev/null +++ b/MiMall/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +../.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git a/MiMall/.idea/.name b/MiMall/.idea/.name new file mode 100644 index 0000000..94007eb --- /dev/null +++ b/MiMall/.idea/.name @@ -0,0 +1 @@ +Mi Mall \ No newline at end of file diff --git a/MiMall/.idea/codeStyles/Project.xml b/MiMall/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/MiMall/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/MiMall/.idea/gradle.xml b/MiMall/.idea/gradle.xml new file mode 100644 index 0000000..4406e2a --- /dev/null +++ b/MiMall/.idea/gradle.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/MiMall/.idea/jarRepositories.xml b/MiMall/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/MiMall/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/MiMall/.idea/misc.xml b/MiMall/.idea/misc.xml new file mode 100644 index 0000000..37a7509 --- /dev/null +++ b/MiMall/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/MiMall/.idea/runConfigurations.xml b/MiMall/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/MiMall/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/MiMall/.idea/vcs.xml b/MiMall/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/MiMall/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MiMall/app/.gitignore b/MiMall/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/MiMall/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/MiMall/app/build.gradle b/MiMall/app/build.gradle new file mode 100644 index 0000000..f070f6a --- /dev/null +++ b/MiMall/app/build.gradle @@ -0,0 +1,49 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.1" + + defaultConfig { + applicationId "ca.mappedin.mimall" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.2.1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.2' + implementation 'androidx.vectordrawable:vectordrawable:1.1.0' + implementation 'androidx.navigation:navigation-fragment:2.3.1' + implementation 'androidx.navigation:navigation-ui:2.3.1' + implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + + implementation 'com.github.bumptech.glide:glide:4.11.0' + // Skip this if you don't want to use integration libraries or configure Glide. + annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' + + implementation "androidx.cardview:cardview:1.0.0" + + implementation 'com.mappedin.sdk:mappedin:2.0.0' + + //tests related dependencies + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + +} \ No newline at end of file diff --git a/MiMall/app/proguard-rules.pro b/MiMall/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/MiMall/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/MiMall/app/src/androidTest/java/ca/mappedin/mimall/ExampleInstrumentedTest.java b/MiMall/app/src/androidTest/java/ca/mappedin/mimall/ExampleInstrumentedTest.java new file mode 100644 index 0000000..f3879ef --- /dev/null +++ b/MiMall/app/src/androidTest/java/ca/mappedin/mimall/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package ca.mappedin.mimall; + +import android.content.Context; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.platform.app.InstrumentationRegistry; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("ca.mappedin.mimall", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/AndroidManifest.xml b/MiMall/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c6cb81b --- /dev/null +++ b/MiMall/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/MainActivity.java b/MiMall/app/src/main/java/ca/mappedin/mimall/MainActivity.java new file mode 100644 index 0000000..bdd99fa --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/MainActivity.java @@ -0,0 +1,36 @@ +package ca.mappedin.mimall; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.navigation.NavController; +import androidx.navigation.Navigation; +import androidx.navigation.ui.AppBarConfiguration; +import androidx.navigation.ui.NavigationUI; + +import com.google.android.material.bottomnavigation.BottomNavigationView; +import com.mappedin.Mappedin; + +//TODO Add license, author, copyright +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + //Initialize the Mappedin singleton with the application and credentials + Mappedin.init(getApplication()); //Mapbox token is optional + + setContentView(R.layout.activity_main); + BottomNavigationView navView = findViewById(R.id.nav_view); + // Passing each menu ID as a set of Ids because each + // menu should be considered as top level destinations. + AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( + R.id.navigation_home, R.id.navigation_map, R.id.navigation_browse) + .build(); + NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); + NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); + NavigationUI.setupWithNavController(navView, navController); + } + +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/shared/Repository.java b/MiMall/app/src/main/java/ca/mappedin/mimall/shared/Repository.java new file mode 100644 index 0000000..fe4f6b1 --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/shared/Repository.java @@ -0,0 +1,61 @@ +package ca.mappedin.mimall.shared; + +import android.util.Log; + +import com.mappedin.models.MiLocation; +import com.mappedin.models.MiSpace; + +import java.util.ArrayList; +import java.util.List; + +public class Repository { + + private List locations = new ArrayList(); + + private static Repository instance = null; + + private Repository() { + } + + + public static Repository getInstance() { + if (instance == null) { + instance = new Repository(); + } + + return instance; + } + + public List getLocations() { + return locations; + } + + public MiSpace searchLocations(String keyword) { + for (MiLocation location : + locations) { + if (location.getName().equals(keyword)) { + return location.getSpaces().get(0); + } + } + return null; + } + + public String[] getLocationsArray() { + ArrayList locations = new ArrayList(); + for (MiLocation location : + this.locations) { + locations.add(location.getName()); + + for (MiSpace space : + location.getSpaces()) { + Log.d("LOG", "" + space.getExternalId()); + } + } + String[] searchResults = new String[locations.size()]; + return locations.toArray(searchResults); + } + + public void setLocations(List locations) { + this.locations = locations; + } +} diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseFragment.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseFragment.java new file mode 100644 index 0000000..d05ff45 --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseFragment.java @@ -0,0 +1,45 @@ +package ca.mappedin.mimall.ui.browse; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import ca.mappedin.mimall.R; +import ca.mappedin.mimall.shared.Repository; + +public class BrowseFragment extends Fragment { + + private RecyclerView recyclerView; + private RecyclerView.Adapter mAdapter; + private RecyclerView.LayoutManager layoutManager; + + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, Bundle savedInstanceState) { + + View root = inflater.inflate(R.layout.fragment_browse, container, false); + + recyclerView = root.findViewById(R.id.locationList); + + // use this setting to improve performance if you know that changes + // in content do not change the layout size of the RecyclerView + recyclerView.setHasFixedSize(true); + + // use a linear layout manager + layoutManager = new LinearLayoutManager(this.getContext()); + recyclerView.setLayoutManager(layoutManager); + + // specify an adapter (see also next example) + mAdapter = new LocationListAdapter(Repository.getInstance().getLocations(), this.getContext()); +// mAdapter = new LocationListAdapter(Repository.getInstance().getLocations(), this.getContext()); + recyclerView.setAdapter(mAdapter); + + return root; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseViewModel.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseViewModel.java new file mode 100644 index 0000000..13cc1d9 --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/BrowseViewModel.java @@ -0,0 +1,22 @@ +package ca.mappedin.mimall.ui.browse; + +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +public class BrowseViewModel extends ViewModel { + + private MutableLiveData mText = new MutableLiveData<>(); + + public BrowseViewModel() { +// mText.setValue("This is Browse fragment"); + } + + public void setText(String text) { + mText.setValue(text); + } + + public LiveData getText() { + return mText; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/LocationListAdapter.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/LocationListAdapter.java new file mode 100644 index 0000000..9bf997a --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/browse/LocationListAdapter.java @@ -0,0 +1,76 @@ +package ca.mappedin.mimall.ui.browse; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; +import com.mappedin.models.MiLocation; + +import java.util.List; + +import ca.mappedin.mimall.R; + +public class LocationListAdapter extends RecyclerView.Adapter { + private List dataset; + private Context context; + + // Provide a reference to the views for each data item + // Complex data items may need more than one view per item, and + // you provide access to all the views for a data item in a view holder + public static class LocationViewHolder extends RecyclerView.ViewHolder { + // each data item is just a string in this case + public TextView locationName; + public ImageView locationLogo; + + public LocationViewHolder(View v) { + super(v); + locationName = v.findViewById(R.id.locationName); + locationLogo = v.findViewById(R.id.locationLogo); + } + } + + // Provide a suitable constructor (depends on the kind of dataset) + public LocationListAdapter(List dataset, Context context) { + this.dataset = dataset; + this.context = context; + } + + // Create new views (invoked by the layout manager) + @Override + public LocationListAdapter.LocationViewHolder onCreateViewHolder(ViewGroup parent, + int viewType) { + // create a new view + View v = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.layout_browse_list_item, parent, false); + LocationViewHolder vh = new LocationViewHolder(v); + return vh; + } + + // Replace the contents of a view (invoked by the layout manager) + @Override + public void onBindViewHolder(LocationViewHolder holder, int position) { + // - get element from your dataset at this position + // - replace the contents of the view with that element + holder.locationName.setText(this.dataset.get(position).getName()); + if (this.dataset.get(position).getLogo() != null) { + Glide.with(context) + .load(this.dataset.get(position).getLogo().getSmall()) + .placeholder(R.drawable.placeholder) + .error(R.drawable.img_load_fail) + .into(holder.locationLogo); + } + } + + // Return the size of your dataset (invoked by the layout manager) + @Override + public int getItemCount() { + return this.dataset.size(); + } + +} diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeFragment.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeFragment.java new file mode 100644 index 0000000..5fe7e5e --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeFragment.java @@ -0,0 +1,44 @@ +package ca.mappedin.mimall.ui.home; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import ca.mappedin.mimall.R; + +public class HomeFragment extends Fragment { + + private RecyclerView recyclerView; + private RecyclerView.Adapter mAdapter; + private RecyclerView.LayoutManager layoutManager; + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, Bundle savedInstanceState) { + View root = inflater.inflate(R.layout.fragment_home, container, false); + + recyclerView = root.findViewById(R.id.homeList); + + // use this setting to improve performance if you know that changes + // in content do not change the layout size of the RecyclerView + recyclerView.setHasFixedSize(true); + + // use a linear layout manager + layoutManager = new LinearLayoutManager(this.getContext()); + recyclerView.setLayoutManager(layoutManager); + + mAdapter = new HomeListAdapter(getResources().getStringArray(R.array.titles), + getResources().getStringArray(R.array.subtitles), + getResources().getStringArray(R.array.imgurls), + this.getContext()); + + recyclerView.setAdapter(mAdapter); + + return root; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeListAdapter.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeListAdapter.java new file mode 100644 index 0000000..c307b1e --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeListAdapter.java @@ -0,0 +1,78 @@ +package ca.mappedin.mimall.ui.home; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.recyclerview.widget.RecyclerView; + +import com.bumptech.glide.Glide; + +import ca.mappedin.mimall.R; + +public class HomeListAdapter extends RecyclerView.Adapter { + // private List dataset; + private String[] title, subtitle, imgurls; + Context context; + + // Provide a reference to the views for each data item + // Complex data items may need more than one view per item, and + // you provide access to all the views for a data item in a view holder + public static class LocationViewHolder extends RecyclerView.ViewHolder { + // each data item is just a string in this case + public TextView titleView; + public TextView subtitleView; + public ImageView imageView; + + public LocationViewHolder(View v) { + super(v); + titleView = v.findViewById(R.id.titleView); + subtitleView = v.findViewById(R.id.subtitleView); + imageView = v.findViewById(R.id.imageView); + } + } + + // Provide a suitable constructor (depends on the kind of dataset) + public HomeListAdapter(String[] title, String[] subtitle, String[] imgurls, Context context) { +// this.dataset = dataset; + this.title = title; + this.subtitle = subtitle; + this.imgurls = imgurls; + this.context = context; + } + + // Create new views (invoked by the layout manager) + @Override + public HomeListAdapter.LocationViewHolder onCreateViewHolder(ViewGroup parent, + int viewType) { + // create a new view + View v = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.layout_home_list_item, parent, false); + LocationViewHolder vh = new LocationViewHolder(v); + return vh; + } + + // Replace the contents of a view (invoked by the layout manager) + @Override + public void onBindViewHolder(LocationViewHolder holder, int position) { + // - get element from your dataset at this position + // - replace the contents of the view with that element + holder.titleView.setText(this.title[position]); + holder.subtitleView.setText(this.subtitle[position]); + Glide.with(context) + .load(imgurls[position]) + .placeholder(R.drawable.placeholder) + .error(R.drawable.img_load_fail) + .into(holder.imageView); + } + + // Return the size of your dataset (invoked by the layout manager) + @Override + public int getItemCount() { + return this.title.length; + } + +} diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeViewModel.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeViewModel.java new file mode 100644 index 0000000..0f709eb --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/home/HomeViewModel.java @@ -0,0 +1,19 @@ +package ca.mappedin.mimall.ui.home; + +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +public class HomeViewModel extends ViewModel { + + private MutableLiveData mText; + + public HomeViewModel() { + mText = new MutableLiveData<>(); + mText.setValue("This is home fragment"); + } + + public LiveData getText() { + return mText; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapFragment.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapFragment.java new file mode 100644 index 0000000..8f7c0e3 --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapFragment.java @@ -0,0 +1,134 @@ +package ca.mappedin.mimall.ui.map; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; + +import com.mapbox.mapboxsdk.geometry.LatLng; +import com.mappedin.Mappedin; +import com.mappedin.MiGestureType; +import com.mappedin.MiMapView; +import com.mappedin.MiMapViewListener; +import com.mappedin.enums.MiMapStatus; +import com.mappedin.interfaces.MiMapViewCallback; +import com.mappedin.interfaces.VenueCallback; +import com.mappedin.models.MiLevel; +import com.mappedin.models.MiOverlay; +import com.mappedin.models.MiSpace; +import com.mappedin.models.MiVenue; + +import org.jetbrains.annotations.NotNull; + +import ca.mappedin.mimall.R; +import ca.mappedin.mimall.shared.Repository; + +public class MapFragment extends Fragment { + + private ImageView locationLogo; + private TextView locationName; + private TextView locationLevel; + + public View onCreateView(@NonNull LayoutInflater inflater, + ViewGroup container, Bundle savedInstanceState) { + + View root = inflater.inflate(R.layout.fragment_map, container, false); + + locationLogo = root.findViewById(R.id.locationLogo); + locationName = root.findViewById(R.id.locationName); + locationLevel = root.findViewById(R.id.locationLevel); + + final ProgressBar progressBar = root.findViewById(R.id.loadingProgressBar); + progressBar.setVisibility(View.VISIBLE); + + final MiMapView mapView = root.findViewById(R.id.mapView); + final AutoCompleteTextView searchBar = root.findViewById(R.id.searchBar); + + ImageView searchButton = root.findViewById(R.id.searchButton); + searchButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String searchKeyword = searchBar.getText().toString().trim(); + if (searchKeyword.length() > 0) { + mapView.focusOn(Repository.getInstance().searchLocations(searchKeyword), 300); +// locationName.setText(); + } + } + }); + + Mappedin.getVenue("mappedin-demo-mall", new VenueCallback() { + @Override + public void onVenueLoaded(final MiVenue miVenue) { + mapView.loadMap(miVenue, new MiMapViewCallback() { + @Override + public void onMapLoaded(MiMapStatus miMapStatus) { + if (miMapStatus == MiMapStatus.LOADED) { + progressBar.setVisibility(View.GONE); + + Log.i("MiMapView", "Map has loaded. Levels: " + miVenue.getLevels().size()); + + mapView.displayLocationLabels(); +// mapView.setLabelProperties(PropertyFactory.textColor(Color.RED)); + Repository.getInstance().setLocations(miVenue.getLocations()); + + ArrayAdapter searchAdapter = new ArrayAdapter(MapFragment.this.getContext(), + android.R.layout.simple_dropdown_item_1line, Repository.getInstance().getLocationsArray()); + searchBar.setAdapter(searchAdapter); + + } else { + Log.e("MiMapView", "Map failed to load"); + } + } + }); + } + }); + + //Set an MiMapViewListener to run custom code on certain map events + mapView.setListener(new MiMapViewListener() { + @Override + public void onTapNothing() { + //Called when a point on the map is tapped that isn't a MiSpace or MiOverlay + } + + @Override + public boolean didTapSpace(MiSpace miSpace) { + //Called when an MiSpace is tapped, return false to be called again if multiple MiSpaces were tapped + Log.d("LOG", miSpace.getLocations().get(0).getName()); + return false; + } + + @Override + public void onTapCoordinates(@NotNull LatLng latLng) { + //Called when any point is tapped on the map with the LatLng coordinates + } + + @Override + public boolean didTapOverlay(@NotNull MiOverlay miOverlay) { + //Called when an MiOverlay is tapped, return false to be called again if multiple MiOverlays were tapped + return false; + } + + @Override + public void onLevelChange(@NotNull MiLevel miLevel) { + //Called when the level changes + } + + @Override + public void onManipulateCamera(@NotNull MiGestureType miGestureType) { + //Called when the user pinches or pans the map + } + }); + + + return root; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapViewModel.java b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapViewModel.java new file mode 100644 index 0000000..121b557 --- /dev/null +++ b/MiMall/app/src/main/java/ca/mappedin/mimall/ui/map/MapViewModel.java @@ -0,0 +1,19 @@ +package ca.mappedin.mimall.ui.map; + +import androidx.lifecycle.LiveData; +import androidx.lifecycle.MutableLiveData; +import androidx.lifecycle.ViewModel; + +public class MapViewModel extends ViewModel { + + private MutableLiveData mText; + + public MapViewModel() { + mText = new MutableLiveData<>(); + mText.setValue("This is Map fragment"); + } + + public LiveData getText() { + return mText; + } +} \ No newline at end of file diff --git a/MiMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/MiMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/MiMall/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MiMall/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/MiMall/app/src/main/res/drawable/ic_dashboard_black_24dp.xml new file mode 100644 index 0000000..46fc8de --- /dev/null +++ b/MiMall/app/src/main/res/drawable/ic_dashboard_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/MiMall/app/src/main/res/drawable/ic_home_black_24dp.xml b/MiMall/app/src/main/res/drawable/ic_home_black_24dp.xml new file mode 100644 index 0000000..f8bb0b5 --- /dev/null +++ b/MiMall/app/src/main/res/drawable/ic_home_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/MiMall/app/src/main/res/drawable/ic_launcher_background.xml b/MiMall/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/MiMall/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MiMall/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/MiMall/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 0000000..78b75c3 --- /dev/null +++ b/MiMall/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/MiMall/app/src/main/res/drawable/img_load_fail.png b/MiMall/app/src/main/res/drawable/img_load_fail.png new file mode 100644 index 0000000..2aba7fd Binary files /dev/null and b/MiMall/app/src/main/res/drawable/img_load_fail.png differ diff --git a/MiMall/app/src/main/res/drawable/placeholder.png b/MiMall/app/src/main/res/drawable/placeholder.png new file mode 100644 index 0000000..839a138 Binary files /dev/null and b/MiMall/app/src/main/res/drawable/placeholder.png differ diff --git a/MiMall/app/src/main/res/layout/activity_main.xml b/MiMall/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..455a6d8 --- /dev/null +++ b/MiMall/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,33 @@ + + + + + + + + + \ No newline at end of file diff --git a/MiMall/app/src/main/res/layout/fragment_browse.xml b/MiMall/app/src/main/res/layout/fragment_browse.xml new file mode 100644 index 0000000..d6cd1fb --- /dev/null +++ b/MiMall/app/src/main/res/layout/fragment_browse.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/MiMall/app/src/main/res/layout/fragment_home.xml b/MiMall/app/src/main/res/layout/fragment_home.xml new file mode 100644 index 0000000..a779b0d --- /dev/null +++ b/MiMall/app/src/main/res/layout/fragment_home.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/MiMall/app/src/main/res/layout/fragment_map.xml b/MiMall/app/src/main/res/layout/fragment_map.xml new file mode 100644 index 0000000..512183d --- /dev/null +++ b/MiMall/app/src/main/res/layout/fragment_map.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + +