diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml
index f2f0f22..3c58df5 100644
--- a/.idea/assetWizardSettings.xml
+++ b/.idea/assetWizardSettings.xml
@@ -23,7 +23,7 @@
@@ -33,9 +33,8 @@
diff --git a/app/build.gradle b/app/build.gradle
index ca2266a..1856eea 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -94,6 +94,10 @@ dependencies {
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'org.jsoup:jsoup:1.14.3'
+
+// Load Images from URL
+ implementation 'com.github.bumptech.glide:glide:4.15.1'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 024ca25..072c7f8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -31,6 +31,11 @@
android:icon="@drawable/lvc_logo"
android:label="@string/app_name"
android:theme="@style/AppTheme">
+
+
+
+
nearbyPlaces = getIntent().getParcelableArrayListExtra("nearbyPlacesList");
+ Log.d("Nearby", nearbyPlaces.get(0).getTitle());
+
+ if (nearbyPlaces != null && !nearbyPlaces.isEmpty()) {
+ ListView listView = findViewById(R.id.placesListView);
+ NearbyPlacesAdapter adapter = new NearbyPlacesAdapter(this, nearbyPlaces);
+ listView.setAdapter(adapter);
+ } else {
+ Toast.makeText(this, "Click on a POI to view Nearby Places", Toast.LENGTH_SHORT).show();
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SearchFragment.java b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SearchFragment.java
index 53ea459..afd145b 100644
--- a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SearchFragment.java
+++ b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SearchFragment.java
@@ -11,6 +11,7 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
+import android.os.Parcelable;
import android.preference.PreferenceManager;
import android.speech.RecognizerIntent;
import android.util.DisplayMetrics;
@@ -359,6 +360,11 @@ public void onResponse(Call call, Response) nearbyPlaces);
+ startActivity(intent);
+
}
}
diff --git a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SettingsActivity.java b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SettingsActivity.java
index 91ed19a..74c8a2b 100644
--- a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SettingsActivity.java
+++ b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/SettingsActivity.java
@@ -44,6 +44,8 @@ public void onCreate(Bundle savedInstanceState) {
bindPreferenceSummaryToValue(findPreference("pref_kiosk_mode"));
bindPreferenceSummaryToValue(findPreference("ServerIp"));
bindPreferenceSummaryToValue(findPreference("ServerPort"));
+ bindPreferenceSummaryToValue(findPreference("AIServerIP"));
+ bindPreferenceSummaryToValue(findPreference("AIServerPort"));
}
/**
diff --git a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/beans/PlaceInfo.java b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/beans/PlaceInfo.java
index 779db47..ea43126 100644
--- a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/beans/PlaceInfo.java
+++ b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/beans/PlaceInfo.java
@@ -1,6 +1,9 @@
package com.gsoc.vedantsingh.locatedvoicecms.beans;
-public class PlaceInfo {
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class PlaceInfo implements Parcelable {
private String title;
private String description;
private String imageLink;
@@ -12,6 +15,24 @@ public PlaceInfo(String title, String description, String imageLink) {
this.imageLink = imageLink;
}
+ protected PlaceInfo(Parcel in) {
+ title = in.readString();
+ description = in.readString();
+ imageLink = in.readString();
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public PlaceInfo createFromParcel(Parcel in) {
+ return new PlaceInfo(in);
+ }
+
+ @Override
+ public PlaceInfo[] newArray(int size) {
+ return new PlaceInfo[size];
+ }
+ };
+
public String getTitle() {
return title;
}
@@ -35,4 +56,16 @@ public String getImageLink() {
public void setImageLink(String imageLink) {
this.imageLink = imageLink;
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(title);
+ dest.writeString(description);
+ dest.writeString(imageLink);
+ }
}
diff --git a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/NearbyPlacesAdapter.java b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/NearbyPlacesAdapter.java
new file mode 100644
index 0000000..3cdfd30
--- /dev/null
+++ b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/NearbyPlacesAdapter.java
@@ -0,0 +1,169 @@
+package com.gsoc.vedantsingh.locatedvoicecms.utils;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.gsoc.vedantsingh.locatedvoicecms.R;
+import com.gsoc.vedantsingh.locatedvoicecms.beans.PlaceInfo;
+import com.jcraft.jsch.Session;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public class NearbyPlacesAdapter extends BaseAdapter {
+ List nearbyPlaces;
+ Context context;
+ Session session = null;
+
+ public NearbyPlacesAdapter(Context context, List nearbyPlaces) {
+ this.nearbyPlaces = nearbyPlaces;
+ this.context = context;
+ }
+
+ @Override
+ public int getCount() {
+ return this.nearbyPlaces.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return this.nearbyPlaces.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ final PlaceInfo currentPlace = this.nearbyPlaces.get(position);
+ ViewHolder viewHolder;
+
+ if (convertView == null) {
+ convertView = LayoutInflater.from(context).inflate(R.layout.nearby_places_item, parent, false);
+ viewHolder = new ViewHolder(convertView, context);
+ convertView.setTag(viewHolder);
+ } else {
+ viewHolder = (ViewHolder) convertView.getTag();
+ }
+
+ if (currentPlace == null) {
+ Log.e("Nearby Places", "currentPlace is null at position: " + position);
+ return convertView; // Return the view as is, as there's no data to display
+ }
+
+ Log.d("Nearby Places", "Title: " + currentPlace.getTitle());
+ Log.d("Nearby Places", "Description: " + currentPlace.getDescription());
+ Log.d("Nearby Places", "ImageLink: " + currentPlace.getImageLink());
+
+ if (!TextUtils.isEmpty(currentPlace.getImageLink())) {
+ Glide.with(context)
+ .load(currentPlace.getImageLink())
+ .error(R.drawable.baseline_image_24)
+ .into(viewHolder.placeImage);
+ } else {
+ // Handle the case when the imageLink is null or empty.
+ // For example, you can set a placeholder image like this:
+ viewHolder.placeImage.setImageResource(R.drawable.baseline_image_24);
+ }
+
+ viewHolder.placeName.setText(currentPlace.getTitle());
+ viewHolder.placeDescription.setText(currentPlace.getDescription().toString());
+
+ return convertView;
+ }
+
+ public class ViewHolder{
+ TextView placeName, placeDescription;
+ ImageView placeImage;
+ ViewHolder(View rootView, Context context){
+ placeImage = rootView.findViewById(R.id.placeImage);
+ placeName = rootView.findViewById(R.id.placeName);
+ placeDescription = rootView.findViewById(R.id.placeDescription);
+
+ rootView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String place = placeName.getText().toString();
+ GetSessionTask getSessionTask = new GetSessionTask(context);
+ getSessionTask.execute();
+
+ String command = "echo 'search=" + place + "' > /tmp/query.txt";
+
+ ExecutorService executorService = Executors.newSingleThreadExecutor();
+ SearchNearbyPlaceTask searchTask = new SearchNearbyPlaceTask(session, context, command);
+ Future future = executorService.submit(searchTask);
+ try {
+ future.get();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ executorService.shutdown();
+ }
+ });
+ }
+ }
+
+ public class SearchNearbyPlaceTask implements Callable {
+ private String command;
+ private Session session;
+ private Context context;
+
+ public SearchNearbyPlaceTask(Session session, Context context, String command) {
+ this.command = command;
+ this.session = session;
+ this.context = context;
+ }
+
+ @Override
+ public Void call() throws Exception {
+ try {
+ LGUtils.setConnectionWithLiquidGalaxy(session, command, context);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+
+ private class GetSessionTask extends AsyncTask {
+
+ private final Context context;
+
+ public GetSessionTask(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ if (context != null) {
+ session = LGUtils.getSession(context);
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void success) {
+ super.onPostExecute(success);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/PoisGridViewAdapter.java b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/PoisGridViewAdapter.java
index 3deac8e..b77dec2 100644
--- a/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/PoisGridViewAdapter.java
+++ b/app/src/main/java/com/gsoc/vedantsingh/locatedvoicecms/utils/PoisGridViewAdapter.java
@@ -4,6 +4,7 @@
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.media.AudioAttributes;
import android.media.AudioManager;
@@ -15,6 +16,7 @@
import androidx.core.content.res.ResourcesCompat;
import android.os.Build;
+import android.preference.PreferenceManager;
import android.text.Html;
import android.util.DisplayMetrics;
import android.util.Log;
@@ -423,8 +425,12 @@ public static void playBarkAudioFromText(final Context context, final String tex
Log.d("BARK", "playBarkAudioFromText");
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ String aiServerIp = prefs.getString("AIServerIP", "172.28.26.84");
+ String aiServerPort = prefs.getString("AIServerPort", "5000");
+
// Send the API request to the server and get the audio file
- String command = "curl -X POST -H \"Content-Type: application/json\" -d '{\"text\":\"" + text + "\"}' " + "http://172.28.26.84:5000/synthesize";
+ String command = "curl -X POST -H \"Content-Type: application/json\" -d '{\"text\":\"" + text + "\"}' " + "http://" + aiServerIp + ":" + aiServerPort + "/synthesize";
byte[] response = LGUtils.executeAudioCommandWithResponse(session, command, context);
File audioFile = saveAudioFile(context, response);
// if (audioFile != null) {
diff --git a/app/src/main/res/drawable/baseline_image_24.xml b/app/src/main/res/drawable/baseline_image_24.xml
new file mode 100644
index 0000000..d35859d
--- /dev/null
+++ b/app/src/main/res/drawable/baseline_image_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_nearby_places.xml b/app/src/main/res/layout/activity_nearby_places.xml
new file mode 100644
index 0000000..2d221d6
--- /dev/null
+++ b/app/src/main/res/layout/activity_nearby_places.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/nearby_places_item.xml b/app/src/main/res/layout/nearby_places_item.xml
new file mode 100644
index 0000000..908ee66
--- /dev/null
+++ b/app/src/main/res/layout/nearby_places_item.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml
index 0d0f92b..9d92c03 100644
--- a/app/src/main/res/xml/pref_general.xml
+++ b/app/src/main/res/xml/pref_general.xml
@@ -65,4 +65,20 @@
android:singleLine="true"
android:title="@string/server_port" />
+
+
+
+