add Chatbot files and edit main activity files

parent 0a1efc2c
package com.sliit.smartserviceassistant;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class ChatRVAdapter extends RecyclerView.Adapter {
// variable for our array list and context.
private ArrayList<ChatsModal> chatsModalArrayList;
private Context context;
public ChatRVAdapter(ArrayList<ChatsModal> chatsModalArrayList, Context context) {
this.chatsModalArrayList = chatsModalArrayList;
this.context = context;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view;
// below code is to switch our
// layout type along with view holder.
switch (viewType) {
case 0:
// below line we are inflating user message layout.
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.user_msg_rv_item, parent, false);
return new UserViewHolder(view);
case 1:
// below line we are inflating bot message layout.
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.bot_msg_rv_item, parent, false);
return new BotViewHolder(view);
}
return null;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
ChatsModal chatsModal = chatsModalArrayList.get(position);
switch (chatsModal.getSender()) {
case "user":
// below line is to set the text to our text view of user layout
((UserViewHolder) holder).userTV.setText(chatsModal.getMessage());
break;
case "bot":
// below line is to set the text to our text view of bot layout
((BotViewHolder) holder).botTV.setText(chatsModal.getMessage());
break;
}
}
@Override
public int getItemViewType(int position) {
switch (chatsModalArrayList.get(position).getSender()){
case "user":
return 0;
case "bot":
return 1;
default:
return -1;
}
}
@Override
public int getItemCount() {
return chatsModalArrayList.size();
}
public static class UserViewHolder extends RecyclerView.ViewHolder {
// creating a variable
// for our text view.
TextView userTV;
public UserViewHolder(@NonNull View itemView) {
super(itemView);
// initializing with id.
userTV = itemView.findViewById(R.id.idUser);
}
}
public static class BotViewHolder extends RecyclerView.ViewHolder {
// creating a variable
// for our text view.
TextView botTV;
public BotViewHolder(@NonNull View itemView) {
super(itemView);
// initializing with id.
botTV = itemView.findViewById(R.id.idBot);
}
}
}
package com.sliit.smartserviceassistant;
public class ChatsModal {
private String message;
private String sender;
public String getMessage() {
return message;
}
public String getSender() {
return sender;
}
public void setMessage(String message) {
this.message = message;
}
public void setSender(String sender) {
this.sender = sender;
}
public ChatsModal(String message, String sender) {
this.message = message;
this.sender = sender;
}
}
package com.sliit.smartserviceassistant;
public class DataModal3 {
String data;
String response;
public String getResponse() {
return response;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public DataModal3(String data){
this.data=data;
}
}
package com.sliit.smartserviceassistant;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class DataModal4 {
float lon;
float lat;
float radius;
ArrayList response;
public ArrayList getResponse() {
return response;
}
// String response;
//
// public String getResponse() {
// return response;
// }
public float getLon() {
return lon;
}
public float getLat() {
return lat;
}
public float getRadius() {
return radius;
}
public void setLon(float lon) {
this.lon = lon;
}
public void setLat(float lat) {
this.lat = lat;
}
public void setRadius(float radius) {
this.radius = radius;
}
public DataModal4(float lon, float lat, float radius) {
this.lon = lon;
this.lat = lat;
this.radius = radius;
}
}
package com.sliit.smartserviceassistant;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class Fragment1 extends Fragment{
private TextView textView;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.frag1, container,false);
textView=(TextView)view.findViewById(R.id.bl);
textView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent k = new Intent(getActivity(), chat_bot.class);
startActivity(k);
}
});
return view;
}
}
package com.sliit.smartserviceassistant;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import java.io.IOException;
import java.sql.Connection;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
public class Loging extends AppCompatActivity {
//
// EditText textInputEditTextUsername,textInputEditTextPassword;
Button buttonLogin;
TextView textViewLoging;
ProgressBar progressBar;
Intent i;
Connection conexion=null;
TextView textUsername,textPassword;
String Confirmusername;
String Confirmpassword;
private OkHttpClient mclient;
private String strURL;
//="http://192.168.8.103:8000/api/login?username=hasith&user_pass=1234";//GET
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//for changing status bar icon colors
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.M){
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
setContentView(R.layout.activity_loging);
textUsername = (TextView) findViewById(R.id.editTextusername);
textPassword = (TextView) findViewById(R.id.editTextPassword);
Button sendButton = (Button) findViewById(R.id.cirLoginButton);
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Confirmusername=textUsername.getText().toString();
Confirmpassword=textPassword.getText().toString();
strURL ="http://192.168.1.5:8000/api/login?username="+Confirmusername+"&user_pass="+Confirmpassword;
mclient=new OkHttpClient();
Request request= new Request.Builder().url(strURL).build();
mclient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
}
@Override
public void onResponse(Response response) throws IOException {
if(response.isSuccessful())
{
String strJson=response.body().string();
System.out.println(strJson);
if(strJson.equals("ok")==true){
//Toast.makeText(Loging.this, "You form is sucessfull", Toast.LENGTH_SHORT).show();
Intent k = new Intent(Loging.this, MainActivity.class);
startActivity(k);
finish();
}
}else{
System.out.println("fail");
}
}
});
}
});
}
//
public void onLoginClick(View View){
startActivity(new Intent(this,SignUp.class));
overridePendingTransition(R.anim.slide_in_right,R.anim.stay);
}
}
package com.sliit.smartserviceassistant;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatDelegate;
import android.view.View;
import com.google.android.material.navigation.NavigationView;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private BottomNavigationView bottomNavigationView;
TextView textViewMaintaince;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Fragment fragment;
switch (item.getItemId()) {
case R.id.navigationMyProfile:
return true;
case R.id.navigationMyCourses:
Intent i1 = new Intent(MainActivity.this,Prediction.class);
startActivity(i1);
return true;
case R.id.navigationHome:
return true;
case R.id.navigationSearch:
Intent i = new Intent(MainActivity.this, MapsActivity.class);
startActivity(i);
return true;
case R.id.navigationMenu:
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.openDrawer(GravityCompat.START);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(new DarkModePrefManager(this).isNightMode()){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
bottomNavigationView = findViewById(R.id.navigation);
bottomNavigationView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
//
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) bottomNavigationView.getLayoutParams();
layoutParams.setBehavior(new BottomNavigationBehavior());
bottomNavigationView.setSelectedItemId(R.id.navigationHome);
textViewMaintaince=findViewById(R.id.maintaince_click);
textViewMaintaince.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent k = new Intent(MainActivity.this, Maintainces.class);
startActivity(k);
finish();
}
});
LinearLayout relativeclic4 =(LinearLayout) findViewById(R.id.t1);
relativeclic4.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
startActivityForResult(new Intent(MainActivity.this,testingchat1.class), 0);
}
});
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_dark_mode) {
//code for setting dark mode
//true for dark mode, false for day mode, currently toggling on each click
DarkModePrefManager darkModePrefManager = new DarkModePrefManager(this);
darkModePrefManager.setDarkMode(!darkModePrefManager.isNightMode());
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
recreate();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
package com.sliit.smartserviceassistant;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentActivity;
import android.Manifest;
import android.graphics.Color;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.Circle;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import java.util.ArrayList;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback{
private GoogleMap mMap;
FusedLocationProviderClient client;
SupportMapFragment supportMapFragment;
Button btFind;
double currentLat =0, currentLong = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
btFind=findViewById(R.id.btnRestaurant);
btFind.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
System.out.println(currentLat);
System.out.println(currentLong);
float radius=10;
float lon= (float) currentLong;
float lat= (float) currentLat;
Retrofit retrofit4 = new Retrofit.Builder()
.baseUrl("http://192.168.1.5:8000/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitAPI4 retrofitAPI4 = retrofit4.create(RetrofitAPI4.class);
DataModal4 modal4 = new DataModal4(lon,lat,radius);
Call<DataModal4> call4 = retrofitAPI4.createPost4(modal4);
call4.enqueue(new Callback<DataModal4>() {
@Override
public void onResponse(Call<DataModal4> call4, Response<DataModal4> response4) {
ArrayList reponding=response4.body().response;
for (int i = 0; i <reponding.size() ; i++) {
ArrayList reponding1= (ArrayList) reponding.get(i);
double lati= (double) reponding1.get(0);
double longi=(double) reponding1.get(1);
String place=(String) reponding1.get(2);
supportMapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
LatLng latLng=new LatLng(longi
,lati);
MarkerOptions options=new MarkerOptions().position(latLng)
.title(place);
//googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,100));
googleMap.addMarker(options);
}
});
System.out.println("latitude"+lati);
System.out.println("longtiude"+longi);
}
System.out.println( reponding.size());
Toast.makeText(MapsActivity.this, "Data can added", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Call<DataModal4> call4, Throwable t) {
Toast.makeText(MapsActivity.this, "Data can't added", Toast.LENGTH_SHORT).show();
System.out.println(t.getMessage());
}
});
}
});
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
supportMapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
client = LocationServices.getFusedLocationProviderClient(this);
if (ActivityCompat.checkSelfPermission(MapsActivity.this,
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
getCurrentLocation();
}else{
ActivityCompat.requestPermissions(MapsActivity.this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},44) ;
}
//mapFragment.getMapAsync(this);
}
public void getCurrentLocation() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
return;
}
Task<Location> task = client.getLastLocation();
task.addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
if(location !=null){
currentLat =location.getLatitude();
currentLong=location.getLongitude();
System.out.println(currentLat);
System.out.println(currentLong);
supportMapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
LatLng latLng=new LatLng(location.getLatitude()
,location.getLongitude());
MarkerOptions options=new MarkerOptions().position(latLng)
.title("My Current Location")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_CYAN));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,11));
Circle circle = googleMap.addCircle(new CircleOptions()
.center(new LatLng(currentLat, currentLong))
.radius(6900)
.strokeColor(Color.BLUE)
.fillColor(Color.TRANSPARENT));
googleMap.addMarker(options);
}
});
}
}
});
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 44) {
if(grantResults.length>0&&grantResults[0]==PackageManager.PERMISSION_GRANTED){
getCurrentLocation();
}
}
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
\ No newline at end of file
package com.sliit.smartserviceassistant;
public class MsgModal {
// public MsgModal(String cnt) {
// this.cnt = cnt;
// }
//
// private String cnt;
//
// public String getCnt() {
// return cnt;
// }
//
// public void setCnt(String cnt) {
// this.cnt = cnt;
// }
public MsgModal(String data) {
this.data = data;
}
private String response;
public String getResponse() {
return response;
}
private String data;
public String getCnt() {
return data;
}
public void setCnt(String data) {
this.data = data;
}
}
package com.sliit.smartserviceassistant;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface RetrofitAPI3 {
// @GET
// Call<MsgModal> getMessage(@Url String url);
@POST("chatbot")
//on below line we are creating a method to post our data.
Call<DataModal3> createPost3(@Body DataModal3 dataModal3);
}
package com.sliit.smartserviceassistant;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface RetrofitAPI4 {
@POST("setlocations")
//on below line we are creating a method to post our data.
Call<DataModal4> createPost4(@Body DataModal4 dataModal4);
}
package com.sliit.smartserviceassistant;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.icu.util.Calendar;
import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.Toast;
import java.io.FileOutputStream;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class SignUp extends AppCompatActivity {
TextView textName20;
TextView textName21;
TextView textName22;
TextView textName23;
TextView textName24;
TextView textName25;
TextView textName26;
TextView text27;
private DatePickerDialog.OnDateSetListener mDateSetListener;
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
changeStatusBarColor();
textName20 = (TextView) findViewById(R.id.editTextNameSignUp);
textName21 = (TextView) findViewById(R.id.editTextEmailSignUp);
textName22 = (TextView) findViewById(R.id.editTextFirstnameSignUp);
textName23 = (TextView) findViewById(R.id.editTextLastnameSignUp);
textName24 = (TextView) findViewById(R.id.editTextpaswordSignup);
textName25 = (TextView) findViewById(R.id.editTextConfirmpaswordSignUp);
textName26 = (TextView) findViewById(R.id.editTextDateOfBirthdaySignUp);
textName26.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus) {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dialog=new DatePickerDialog(SignUp.this, android.R.style.Theme_Holo_Light_Dialog_MinWidth,mDateSetListener,year,month,day);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.show();
} else {
// Hide your calender here
}
}
});
// textName26.setOnClickListener(new View.OnClickListener() {
// @RequiresApi(api = Build.VERSION_CODES.N)
// @Override
// public void onClick(View view) {
//
//
// }
// });
mDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
month = month + 1;
Log.d(TAG, "onDateSet: mm/dd/yyy: " + month + "/" + day + "/" + year);
String date = year+"-"+month+"-"+ day;
textName26.setText(date);
}
};
final Button button = findViewById(R.id.cirRegisterButton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (textName20 .getText().toString().isEmpty() || textName21.getText().toString().isEmpty() || textName22.getText().toString().isEmpty()||
textName23.getText().toString().isEmpty() ||
textName24.getText().toString().isEmpty() ||
textName25.getText().toString().isEmpty()){
// textName26.getText().toString().isEmpty()) {
System.out.println("HY1");
Toast.makeText(SignUp.this, "Please enter All the values", Toast.LENGTH_SHORT).show();
return;
}else{
System.out.println("HY2");
postData1(textName20.getText().toString(), textName21.getText().toString(),textName22.getText().toString(),textName23.getText().toString(),textName24.getText().toString(),textName25.getText().toString(),textName26.getText().toString());
String FullName = textName22.getText().toString()+" "+textName23.getText().toString();
FileOutputStream outputStream;
try{
outputStream = openFileOutput("myfile",MODE_PRIVATE);
outputStream.write(FullName.getBytes());
outputStream.close();
}catch (Exception e){
e.printStackTrace();
}
Toast.makeText(SignUp.this, "Your Registration is sucessfull", Toast.LENGTH_SHORT).show();
}
}
});
}
private void postData1(String username,
String email, String first_name,String last_name,String password,String password2,String date_of_birth
){
// builder and passing our base url
Retrofit retrofit1 = new Retrofit.Builder()
.baseUrl("http://192.168.1.5:8000/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitAPI1 retrofitAPI1 = retrofit1.create(RetrofitAPI1.class);
////
DataModal1 modal1 = new DataModal1(username,email,first_name,last_name,password,password2,date_of_birth);
////
Call<DataModal1> call1 = retrofitAPI1.createPost1(modal1);
////
////
////
call1.enqueue(new Callback<DataModal1>() {
@Override
public void onResponse(Call<DataModal1> call1, Response<DataModal1> response) {
// this method is called when we get response from our api.
Toast.makeText(SignUp.this, "Data added", Toast.LENGTH_SHORT).show();
DataModal1 responseFromAPI1 = response.body();
}
//
@Override
public void onFailure(Call<DataModal1> call1, Throwable t) {
// setting text to our text view when
// we get error response from API.
Toast.makeText(SignUp.this, "Data can't added to API", Toast.LENGTH_SHORT).show();
}
});
}
private void changeStatusBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// window.setStatusBarColor(Color.TRANSPARENT);
window.setStatusBarColor(getResources().getColor(R.color.register_bk_color));
}
}
public void onLoginClick(View view){
startActivity(new Intent(this,Loging.class));
overridePendingTransition(R.anim.slide_in_left,android.R.anim.slide_out_right);
}
}
\ No newline at end of file
package com.sliit.smartserviceassistant;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Locale;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class chat_bot extends AppCompatActivity {
private RecyclerView chatsRV;
private ImageButton sendMsgFAB;
private EditText userMsgEdt;
private final String USER_KEY = "user";
private final String BOT_KEY = "bot";
private TextToSpeech mTTS;
// creating a variable for array list and adapter class.
private ArrayList<ChatsModal>chatsModalArrayList;
private ChatRVAdapter chatRVAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat_bot);
mTTS = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = mTTS.setLanguage(Locale.GERMAN);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "Language not supported");
} else {
mTTS.setPitch(1.0f);
mTTS.setSpeechRate(1.0f);
mTTS.speak("what is your name", TextToSpeech.QUEUE_FLUSH, null);
}
} else {
Log.e("TTS", "Initialization failed");
}
}
});///texttospeechpart
chatsRV=findViewById(R.id.idRVChats);
sendMsgFAB = findViewById(R.id.idFABSend);
userMsgEdt = findViewById(R.id.idEdtMessage);
chatsModalArrayList= new ArrayList<>();
chatRVAdapter =new ChatRVAdapter(chatsModalArrayList,this);
LinearLayoutManager manager = new LinearLayoutManager(this);
chatsRV.setLayoutManager(manager);
chatsRV.setAdapter(chatRVAdapter);
sendMsgFAB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(userMsgEdt.getText().toString().isEmpty()){
Toast.makeText(chat_bot.this,"please enter your message",Toast.LENGTH_SHORT).show();
return;
}
postData13(userMsgEdt.getText().toString());
userMsgEdt.setText("");
}
});
}
// private void getResponse(String message){
// chatsModalArrayList.add(new ChatsModal(message,USER_KEY));
//
// chatRVAdapter.notifyDataSetChanged();
// String url="http://api.brainshop.ai/get?bid=157392&key=eJjQmMRimytCUA7E&uid=[uid]&msg="+message;
// String BASE_URL ="http://api.brainshop.ai/";
// Retrofit retrofit3 = new Retrofit.Builder()
// .baseUrl(BASE_URL)
// .addConverterFactory(GsonConverterFactory.create())
// .build();
// RetrofitAPI3 retrofitAPI3=retrofit3.create(RetrofitAPI3.class);
// Call<MsgModal> call3 =retrofitAPI3.getMessage(url);
//
// call3.enqueue(new Callback<MsgModal>() {
// @Override
// public void onResponse(Call<MsgModal> call3, Response<MsgModal> response) {
// if(response.isSuccessful()){
// System.out.println("done");
// MsgModal modal =response.body();
// System.out.println(modal.getCnt());
// chatsModalArrayList.add(new ChatsModal(modal.getCnt(),BOT_KEY));
// chatRVAdapter.notifyDataSetChanged();
//
//
// }
// }
//
// @Override
// public void onFailure(Call<MsgModal> call, Throwable t) {
//
// }
// });
//
//
// }
private void postData13(String data){
chatsModalArrayList.add(new ChatsModal(data,USER_KEY));
chatRVAdapter.notifyDataSetChanged();
Retrofit retrofit3 = new Retrofit.Builder()
.baseUrl("http://192.168.1.5:8000/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitAPI3 retrofitAPI3 = retrofit3.create(RetrofitAPI3.class);
DataModal3 modal3 = new DataModal3(data);
Call<DataModal3> call3 = retrofitAPI3.createPost3(modal3);
call3.enqueue(new Callback<DataModal3>() {
@Override
public void onResponse(Call<DataModal3> call3, Response<DataModal3> response3) {
// Toast.makeText(chat_bot.this, "Data added to API", Toast.LENGTH_SHORT).show();
System.out.println(response3.body().getResponse());
mTTS = new TextToSpeech(getBaseContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = mTTS.setLanguage(Locale.GERMAN);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("TTS", "Language not supported");
} else {
mTTS.setPitch(1.0f);
mTTS.setSpeechRate(1.0f);
mTTS.speak(response3.body().getResponse(), TextToSpeech.QUEUE_FLUSH, null);
}
} else {
Log.e("TTS", "Initialization failed");
}
}
});///texttospeechpart
chatsModalArrayList.add(new ChatsModal(response3.body().getResponse(),BOT_KEY));
chatRVAdapter.notifyDataSetChanged();
}
@Override
public void onFailure(Call<DataModal3> call3, Throwable t) {
Toast.makeText(chat_bot.this, "Data can't added to API", Toast.LENGTH_SHORT).show();
System.out.println(t.getMessage());
}
});
}
}
\ No newline at end of file
package com.sliit.smartserviceassistant;
import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
public class chatsDisplay extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chatdisplay);
TextView textview1=findViewById(R.id.bl);
textview1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
package com.sliit.smartserviceassistant.main;
import androidx.arch.core.util.Function;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
import androidx.lifecycle.ViewModel;
public class PageViewModel extends ViewModel {
private MutableLiveData<Integer> mIndex = new MutableLiveData<>();
private LiveData<String> mText = Transformations.map(mIndex, new Function<Integer, String>() {
@Override
public String apply(Integer input) {
return "Hello world from section: " + input;
}
});
public void setIndex(int index) {
mIndex.setValue(index);
}
public LiveData<String> getText() {
return mText;
}
}
\ No newline at end of file
package com.sliit.smartserviceassistant.main;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.appsnipp.education.R;
/**
* A placeholder fragment containing a simple view.
*/
public class PlaceholderFragment extends Fragment {
private static final String ARG_SECTION_NUMBER = "section_number";
private PageViewModel pageViewModel;
TextView textView;
public static PlaceholderFragment newInstance(int index) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, index);
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
pageViewModel = new ViewModelProvider(this,
new ViewModelProvider.NewInstanceFactory()).get(PageViewModel.class);
int index = 1;
if (getArguments() != null) {
index = getArguments().getInt(ARG_SECTION_NUMBER);
}
pageViewModel.setIndex(index);
}
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_testingchat1, container, false);
return root;
}
}
\ No newline at end of file
package com.sliit.smartserviceassistant.main;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.appsnipp.education.Fragment1;
import com.appsnipp.education.R;
public class SectionsPagerAdapter extends FragmentPagerAdapter {
@StringRes
private static final int[] TAB_TITLES = new int[]{R.string.tab_text_1, R.string.tab_text_2};
private final Context mContext;
public SectionsPagerAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
Fragment fragment =null;
switch (position){
case 0:
fragment =new Fragment1();
break;
case 1:
fragment =new Fragment1();
break;
}
return fragment;
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return mContext.getResources().getString(TAB_TITLES[position]);
}
@Override
public int getCount() {
// Show 2 total pages.
return 2;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="2dip" android:color="@color/purple_700" />
</shape>
\ No newline at end of file
<vector android:height="24dp" android:viewportHeight="512"
android:viewportWidth="512" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#a096a3" android:pathData="m199.427,322.229h113.147v134.574h-113.147z"/>
<path android:fillColor="#c9e0fd" android:pathData="m332.121,361.009h-152.242c-38.621,0 -69.93,-31.309 -69.93,-69.93v-140.125c0,-38.899 31.534,-70.433 70.433,-70.433h151.234c38.899,0 70.433,31.534 70.433,70.433v140.125c0.001,38.621 -31.307,69.93 -69.928,69.93z"/>
<path android:fillColor="#bcd6f9" android:pathData="m331.617,80.52h-65.333c38.899,0 70.433,31.534 70.433,70.433v140.125c0,38.621 -31.309,69.93 -69.93,69.93h65.333c38.621,0 69.93,-31.309 69.93,-69.93v-140.124c0,-38.899 -31.534,-70.434 -70.433,-70.434z"/>
<path android:fillColor="#9bc4f9" android:pathData="m109.95,266.072h-36.874c-8.55,0 -15.481,-6.931 -15.481,-15.481v-56.766c0,-8.55 6.931,-15.481 15.481,-15.481h36.874z"/>
<path android:fillColor="#9bc4f9" android:pathData="m402.05,266.072h36.874c8.55,0 15.481,-6.931 15.481,-15.481v-56.766c0,-8.55 -6.931,-15.481 -15.481,-15.481h-36.874z"/>
<path android:fillColor="#e07f84" android:pathData="m397.294,337.137h-35.212c-9.633,0 -17.441,-7.809 -17.441,-17.441 0,-9.633 7.809,-17.441 17.441,-17.441h35.212c9.633,0 17.441,7.809 17.441,17.441 0,9.632 -7.809,17.441 -17.441,17.441z"/>
<path android:fillColor="#eaf2ff" android:pathData="m350.183,272.897h-188.366c-12.578,0 -22.774,-10.196 -22.774,-22.774v-77.493c0,-12.578 10.196,-22.774 22.774,-22.774h188.365c12.578,0 22.774,10.196 22.774,22.774v77.493c0.001,12.578 -10.196,22.774 -22.773,22.774z"/>
<path android:fillColor="#dbe8f9" android:pathData="m336.717,150.954v121.944h13.466c12.578,0 22.774,-10.197 22.774,-22.774v-77.494c0,-12.578 -10.196,-22.774 -22.774,-22.774h-13.493c0.005,0.367 0.027,0.73 0.027,1.098z"/>
<path android:fillColor="#9bc4f9" android:pathData="M198.417,211.377m-21.906,0a21.906,21.906 0,1 1,43.812 0a21.906,21.906 0,1 1,-43.812 0"/>
<path android:fillColor="#9bc4f9" android:pathData="M313.583,211.377m-21.906,0a21.906,21.906 0,1 1,43.812 0a21.906,21.906 0,1 1,-43.812 0"/>
<path android:fillColor="#a096a3" android:pathData="m331.617,80.521h-151.234c-2.838,0 -5.631,0.187 -8.381,0.513 1.13,19.983 17.688,35.84 37.953,35.84h92.089c20.266,0 36.823,-15.857 37.953,-35.84 -2.749,-0.326 -5.542,-0.513 -8.38,-0.513z"/>
<path android:fillColor="#89808c" android:pathData="m331.617,80.521h-65.329c23.672,0.002 44.6,11.693 57.369,29.604 9.348,-6.475 15.658,-17.028 16.34,-29.091 -2.749,-0.326 -5.542,-0.513 -8.38,-0.513z"/>
<path android:fillColor="#b3e59f" android:pathData="M78.568,27.003m-19.503,0a19.503,19.503 0,1 1,39.006 0a19.503,19.503 0,1 1,-39.006 0"/>
<path android:fillColor="#c9e0fd" android:pathData="m409.26,404.257h-306.52c-16.851,0 -30.511,13.66 -30.511,30.511v69.732h367.54v-69.733c0.001,-16.85 -13.659,-30.51 -30.509,-30.51z"/>
<path android:fillColor="#bcd6f9" android:pathData="m409.26,404.257h-65.195c16.851,0 30.511,13.66 30.511,30.511v69.732h65.195v-69.733c-0.001,-16.85 -13.661,-30.51 -30.511,-30.51z"/>
<path android:fillColor="#9bc4f9" android:pathData="m480.39,504.5h-40.62v-74.188c26.505,0 47.992,21.487 47.992,47.992v18.824c0,4.072 -3.301,7.372 -7.372,7.372z"/>
<path android:fillColor="#9bc4f9" android:pathData="m31.61,504.5h40.62v-74.188c-26.505,0 -47.992,21.487 -47.992,47.992v18.824c0,4.072 3.301,7.372 7.372,7.372z"/>
<path android:fillColor="#eaf2ff" android:pathData="m374.575,504.5v-31.766c0,-6.292 -5.1,-11.392 -11.392,-11.392h-214.366c-6.292,0 -11.392,5.1 -11.392,11.392v31.766z"/>
<path android:fillColor="#FF000000" android:pathData="m292.787,299.67c-4.143,0 -7.5,3.357 -7.5,7.5 0,6.316 -5.14,11.456 -11.456,11.456h-35.663c-6.316,0 -11.456,-5.14 -11.456,-11.456 0,-4.143 -3.358,-7.5 -7.5,-7.5s-7.5,3.357 -7.5,7.5c0,14.588 11.868,26.456 26.456,26.456h35.663c14.588,0 26.456,-11.868 26.456,-26.456 0,-4.143 -3.357,-7.5 -7.5,-7.5z"/>
<path android:fillColor="#FF000000" android:pathData="m380.457,250.123v-77.492c0,-16.693 -13.581,-30.274 -30.274,-30.274h-188.366c-16.693,0 -30.274,13.581 -30.274,30.274v77.492c0,16.693 13.581,30.274 30.274,30.274h188.365c16.694,0 30.275,-13.581 30.275,-30.274zM146.543,250.123v-77.492c0,-8.422 6.852,-15.274 15.274,-15.274h188.365c8.422,0 15.274,6.853 15.274,15.274v77.492c0,8.422 -6.853,15.274 -15.274,15.274h-188.365c-8.422,0 -15.274,-6.852 -15.274,-15.274z"/>
<path android:fillColor="#FF000000" android:pathData="m198.417,181.971c-16.215,0 -29.406,13.191 -29.406,29.406s13.191,29.406 29.406,29.406 29.406,-13.191 29.406,-29.406 -13.191,-29.406 -29.406,-29.406zM198.417,225.783c-7.944,0 -14.406,-6.463 -14.406,-14.406s6.462,-14.406 14.406,-14.406 14.406,6.463 14.406,14.406 -6.462,14.406 -14.406,14.406z"/>
<path android:fillColor="#FF000000" android:pathData="m313.583,181.971c-16.215,0 -29.406,13.191 -29.406,29.406s13.191,29.406 29.406,29.406 29.406,-13.191 29.406,-29.406 -13.191,-29.406 -29.406,-29.406zM313.583,225.783c-7.943,0 -14.406,-6.463 -14.406,-14.406s6.463,-14.406 14.406,-14.406 14.406,6.463 14.406,14.406 -6.463,14.406 -14.406,14.406z"/>
<path android:fillColor="#FF000000" android:pathData="m445.431,423.099c-4.937,-15.267 -19.282,-26.342 -36.171,-26.342h-89.187v-28.248h12.048c21.127,0 41.289,-8.666 55.87,-23.871h9.302c11.14,0 20.596,-7.342 23.787,-17.441h13.164c15.252,0 27.66,-12.408 27.66,-27.66v-105.713c0,-11.995 -9.239,-21.867 -20.974,-22.887v-19.983c0,-60.276 -49.038,-109.314 -109.314,-109.314h-151.233c-40.151,0 -75.309,21.762 -94.314,54.107v-42.809c11.251,-3.259 19.503,-13.648 19.503,-25.935 -0.001,-14.89 -12.114,-27.003 -27.004,-27.003 -14.889,0 -27.002,12.113 -27.002,27.003 0,12.287 8.252,22.676 19.502,25.935v98.016,19.983c-11.735,1.021 -20.974,10.892 -20.974,22.887v56.767c0,12.672 10.31,22.981 22.981,22.981h29.374v17.507c0,42.695 34.735,77.43 77.43,77.43h12.047v28.248h-89.186c-16.889,0 -31.234,11.075 -36.17,26.342 -27.95,2.844 -49.831,26.518 -49.831,55.205v18.824c0,8.2 6.671,14.872 14.872,14.872h448.78c8.2,0 14.872,-6.672 14.872,-14.872v-18.824c-0.001,-28.687 -21.883,-52.36 -49.832,-55.205zM64.73,497h-32.992v-18.696c0,-19.764 14.237,-36.255 32.992,-39.784zM397.294,329.638h-35.212c-5.481,0 -9.941,-4.46 -9.941,-9.941s4.46,-9.941 9.941,-9.941h35.212c5.481,0 9.941,4.46 9.941,9.941s-4.46,9.941 -9.941,9.941zM434.245,312.196h-13.177c-1.953,-6.173 -6.235,-11.321 -11.824,-14.385 0.501,-5.675 0.226,-7.688 0.306,-24.239h29.374c2.805,0 5.493,-0.507 7.98,-1.431v27.395c0.001,6.981 -5.678,12.66 -12.659,12.66zM446.905,193.824v56.767c0,4.401 -3.58,7.981 -7.98,7.981h-29.374v-72.729h29.374c4.4,0.001 7.98,3.581 7.98,7.981zM66.566,27.003c0,-6.618 5.384,-12.003 12.002,-12.003 6.619,0 12.003,5.385 12.003,12.003s-5.384,12.003 -12.003,12.003c-6.618,0 -12.002,-5.385 -12.002,-12.003zM102.45,258.572h-29.374c-4.401,0 -7.981,-3.58 -7.981,-7.981v-56.767c0,-4.4 3.581,-7.98 7.981,-7.98h29.374zM179.879,353.509c-34.424,0 -62.43,-28.006 -62.43,-62.43v-140.125c0,-29.668 20.641,-54.59 48.313,-61.201 4.902,19.962 22.926,34.621 44.193,34.621h92.09c21.276,0 39.307,-14.672 44.199,-34.648 8.658,2.05 16.78,5.926 23.969,11.517 3.271,2.54 7.982,1.953 10.525,-1.316 2.542,-3.271 1.953,-7.982 -1.316,-10.525 -13.78,-10.716 -30.311,-16.38 -47.805,-16.38 -158.101,0.221 -151.493,-0.531 -160.753,0.602 -0.02,0.003 -0.041,0.005 -0.061,0.008 -38.467,4.74 -68.354,37.596 -68.354,77.324v19.89h-16.381v-19.89c0,-52.005 42.309,-94.314 94.314,-94.314h151.234c52.005,0 94.314,42.31 94.314,94.314v19.89h-16.381v-19.89c0,-10.605 -2.096,-20.893 -6.229,-30.574 -1.624,-3.809 -6.03,-5.58 -9.842,-3.953 -3.81,1.626 -5.58,6.032 -3.953,9.842 3.333,7.81 5.023,16.115 5.023,24.686 -0.053,148.672 0.116,139.816 -0.125,143.801h-32.343c-13.753,0 -24.941,11.188 -24.941,24.941s11.188,24.941 24.941,24.941h2.063c-9.587,5.739 -20.631,8.871 -32.024,8.871h-152.24zM180.841,88.021h150.317c-3.902,12.425 -15.521,21.354 -29.114,21.354h-92.09c-13.591,-0.001 -25.211,-8.929 -29.113,-21.354zM305.073,368.509v28.248h-98.146v-28.248zM432.271,497h-50.195v-24.266c0,-10.417 -8.475,-18.893 -18.892,-18.893h-146.21c-4.142,0 -7.5,3.357 -7.5,7.5s3.358,7.5 7.5,7.5h146.21c2.146,0 3.892,1.746 3.892,3.893v24.266h-222.15v-24.266c0,-2.146 1.746,-3.893 3.892,-3.893h33.094c4.142,0 7.5,-3.357 7.5,-7.5s-3.358,-7.5 -7.5,-7.5h-33.094c-10.417,0 -18.892,8.476 -18.892,18.893v24.266h-50.196v-62.232c0,-12.688 10.322,-23.011 23.01,-23.011h306.52c12.688,0 23.011,10.322 23.011,23.011zM480.262,497h-32.991v-58.48c18.754,3.528 32.991,20.02 32.991,39.784z"/>
</vector>
<vector android:height="24dp" android:viewportHeight="55.0"
android:viewportWidth="55.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M55,27.5C55,12.34 42.66,0 27.5,0S0,12.34 0,27.5c0,8.01 3.44,15.23 8.93,20.26l-0.03,0.02l0.89,0.75c0.06,0.05 0.12,0.09 0.18,0.14c0.47,0.39 0.96,0.77 1.47,1.13c0.16,0.12 0.32,0.23 0.49,0.35c0.53,0.37 1.08,0.72 1.64,1.05c0.12,0.07 0.25,0.14 0.37,0.21c0.61,0.35 1.24,0.68 1.88,0.98c0.05,0.02 0.09,0.04 0.14,0.06c2.09,0.97 4.32,1.68 6.65,2.11c0.06,0.01 0.12,0.02 0.18,0.03c0.72,0.13 1.46,0.22 2.2,0.29c0.09,0.01 0.18,0.01 0.27,0.02C26,54.96 26.74,55 27.5,55c0.75,0 1.49,-0.04 2.22,-0.1c0.09,-0.01 0.19,-0.01 0.28,-0.02c0.74,-0.07 1.46,-0.16 2.18,-0.29c0.06,-0.01 0.13,-0.02 0.19,-0.03c2.3,-0.41 4.49,-1.11 6.56,-2.06c0.08,-0.04 0.15,-0.07 0.23,-0.1c0.62,-0.29 1.22,-0.6 1.81,-0.94c0.15,-0.08 0.29,-0.17 0.44,-0.25c0.54,-0.32 1.07,-0.65 1.58,-1c0.19,-0.13 0.37,-0.26 0.55,-0.39c0.44,-0.32 0.87,-0.64 1.29,-0.98c0.09,-0.08 0.19,-0.14 0.28,-0.22l0.92,-0.76l-0.03,-0.02C51.52,42.8 55,35.55 55,27.5zM2,27.5C2,13.44 13.44,2 27.5,2S53,13.44 53,27.5c0,7.58 -3.33,14.39 -8.59,19.06c-0.29,-0.2 -0.59,-0.38 -0.89,-0.54l-8.47,-4.23c-0.76,-0.38 -1.23,-1.14 -1.23,-1.99v-2.96c0.2,-0.24 0.4,-0.52 0.62,-0.82c1.1,-1.55 1.98,-3.27 2.62,-5.12c1.27,-0.6 2.09,-1.86 2.09,-3.29v-3.55c0,-0.87 -0.32,-1.71 -0.89,-2.37v-4.67c0.05,-0.52 0.24,-3.45 -1.88,-5.86C34.52,9.06 31.54,8 27.5,8s-7.02,1.07 -8.87,3.17c-2.12,2.42 -1.93,5.34 -1.88,5.86v4.67c-0.57,0.66 -0.89,1.5 -0.89,2.37v3.55c0,1.1 0.49,2.13 1.34,2.82c0.81,3.17 2.48,5.57 3.09,6.39v2.89c0,0.82 -0.44,1.57 -1.16,1.96l-7.91,4.31c-0.25,0.14 -0.5,0.3 -0.75,0.48C5.28,41.79 2,35.02 2,27.5zM42.46,48.13c-0.35,0.25 -0.71,0.5 -1.07,0.74c-0.17,0.11 -0.33,0.22 -0.5,0.32c-0.47,0.29 -0.95,0.57 -1.44,0.83c-0.11,0.06 -0.22,0.11 -0.33,0.17c-1.13,0.58 -2.29,1.07 -3.49,1.48c-0.04,0.01 -0.08,0.03 -0.13,0.04c-0.63,0.21 -1.26,0.39 -1.9,0.55c-0,0 -0,0 -0.01,0c-0.65,0.16 -1.3,0.29 -1.96,0.4c-0.02,0 -0.04,0.01 -0.05,0.01c-0.62,0.1 -1.25,0.17 -1.88,0.23c-0.11,0.01 -0.22,0.02 -0.33,0.03C28.75,52.97 28.13,53 27.5,53c-0.63,0 -1.27,-0.03 -1.89,-0.08c-0.11,-0.01 -0.22,-0.01 -0.33,-0.03c-0.63,-0.06 -1.26,-0.13 -1.89,-0.23c-0.03,-0 -0.06,-0.01 -0.08,-0.01c-1.32,-0.22 -2.62,-0.55 -3.89,-0.97c-0.04,-0.01 -0.08,-0.03 -0.12,-0.04c-0.63,-0.21 -1.25,-0.45 -1.86,-0.71c-0,-0 -0.01,-0 -0.01,-0.01c-0.58,-0.25 -1.14,-0.52 -1.71,-0.82c-0.07,-0.04 -0.15,-0.07 -0.22,-0.11c-0.51,-0.27 -1.01,-0.57 -1.5,-0.88c-0.15,-0.09 -0.29,-0.19 -0.44,-0.28c-0.45,-0.3 -0.9,-0.61 -1.34,-0.93c-0.05,-0.03 -0.09,-0.07 -0.13,-0.1c0.03,-0.02 0.06,-0.04 0.1,-0.05l7.91,-4.31c1.36,-0.74 2.2,-2.16 2.2,-3.71l-0,-3.6l-0.23,-0.28c-0.02,-0.03 -2.18,-2.65 -3,-6.22l-0.09,-0.4l-0.34,-0.22c-0.48,-0.31 -0.77,-0.83 -0.77,-1.39v-3.55c0,-0.47 0.2,-0.9 0.56,-1.22l0.33,-0.3v-5.57l-0.01,-0.13c-0,-0.02 -0.3,-2.43 1.4,-4.36C21.58,10.84 24.06,10 27.5,10c3.43,0 5.9,0.83 7.35,2.47c1.69,1.91 1.41,4.36 1.41,4.38l-0.01,5.7l0.33,0.3c0.36,0.32 0.56,0.76 0.56,1.22v3.55c0,0.71 -0.49,1.36 -1.18,1.58l-0.5,0.15l-0.16,0.5c-0.59,1.83 -1.43,3.53 -2.5,5.03c-0.26,0.37 -0.52,0.7 -0.74,0.95l-0.25,0.28V39.8c0,1.61 0.9,3.06 2.34,3.78l8.47,4.23c0.05,0.03 0.11,0.05 0.16,0.08C42.68,47.98 42.57,48.05 42.46,48.13z"/>
</vector>
<vector android:height="24dp" android:viewportHeight="464.056"
android:viewportWidth="464.056" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffdfba" android:pathData="m386.028,416.796v39.26c0,4.42 -3.58,8 -8,8h-292c-4.42,0 -8,-3.58 -8,-8v-39.26c0,-41.19 33.39,-74.56 74.59,-74.57 14.56,-0.01 27.38,-7.5 34.76,-18.86 7.414,-11.394 6.65,-21.302 6.65,-29.31l0.15,-0.37c-35.9,-14.86 -61.15,-50.23 -61.15,-91.5v-3.13c-14.255,0 -25,-11.265 -25,-24.54v-41.56c-0.32,-14.47 0.34,-65.5 37.2,-101.03 42.86,-41.31 110.78,-37.93 159.98,-15.83 1.6,0.72 1.55,3.01 -0.07,3.68l-12.83,5.28c-1.92,0.79 -1.51,3.62 0.55,3.84l6.23,0.67c29.83,3.19 57.54,19.39 74.72,46.35 0.46,0.73 0.33,1.84 -0.26,2.47 -10.6,11.21 -16.52,26.09 -16.52,41.56v54.57c0,13.55 -10.99,24.54 -24.54,24.54h-1.46v3.13c0,41.27 -25.25,76.64 -61.15,91.5l0.15,0.37c0,7.777 -0.827,17.82 6.65,29.31 7.38,11.36 20.2,18.85 34.76,18.86 41.2,0.01 74.59,33.38 74.59,74.57z"/>
<path android:fillColor="#fe4f60" android:pathData="m386.028,416.796v39.26c0,4.418 -3.582,8 -8,8h-292c-4.418,0 -8,-3.582 -8,-8v-39.26c0,-41.19 33.395,-74.555 74.585,-74.57 14.564,-0.005 27.387,-7.504 34.765,-18.86 25.754,22.002 63.531,22.015 89.3,0 7.377,11.356 20.201,18.855 34.765,18.86 41.19,0.015 74.585,33.38 74.585,74.57z"/>
<path android:fillColor="#42434d" android:pathData="m373.804,75.921c0.464,0.729 0.334,1.833 -0.259,2.461 -10.597,11.218 -16.517,26.093 -16.517,41.564v54.57c0,12.388 -9.333,24.54 -26,24.54v-61.77c0,-26.51 -21.49,-48 -48,-48h-102c-26.51,0 -48,21.49 -48,48v61.77c-14.255,0 -25,-11.265 -25,-24.54v-41.56c-0.32,-14.47 0.34,-65.5 37.2,-101.03 42.857,-41.311 110.784,-37.929 159.976,-15.827 1.6,0.719 1.558,3.01 -0.065,3.678l-12.831,5.282c-1.918,0.79 -1.514,3.617 0.548,3.838l6.232,0.669c29.835,3.187 57.538,19.387 74.716,46.355z"/>
<path android:fillColor="#ffebd2" android:pathData="m331.028,202.186c0,54.696 -44.348,99 -99,99 -51.492,0 -99,-40.031 -99,-102.13v-61.77c0,-26.51 21.49,-48 48,-48h102c26.51,0 48,21.49 48,48z"/>
<path android:fillColor="#fff" android:pathData="m313.028,447.056h-24c-4.418,0 -8,-3.582 -8,-8s3.582,-8 8,-8h24c4.418,0 8,3.582 8,8s-3.581,8 -8,8z"/>
<path android:fillColor="#fff3e4" android:pathData="m209.612,266.114c16.277,10.183 3.442,35.156 -14.376,28.004 -36.634,-14.704 -62.208,-50.404 -62.208,-91.932v-64.9c0,-10.084 3.11,-19.442 8.422,-27.168 6.514,-9.473 21.578,-5.288 21.578,7.168v64.9c0,36.51 19.192,66.79 46.584,83.928z"/>
<path android:fillColor="#ffd6a6" android:pathData="m271.158,310.476c-24.637,10.313 -51.712,11.113 -78.26,0 1.356,-5.626 1.13,-9.27 1.13,-16.42l0.15,-0.37c24.082,9.996 51.571,10.016 75.7,0l0.15,0.37c0,7.153 -0.226,10.796 1.13,16.42z"/>
<path android:fillColor="#ff6d7a" android:pathData="m192.91,366.383c-3.698,1.163 -7.664,1.804 -11.916,1.841 -41.296,0.364 -74.966,33.017 -74.966,74.315v7.517c0,7.732 -6.268,14 -14,14h-6c-4.418,0 -8,-3.582 -8,-8v-39.26c0,-41.191 33.395,-74.555 74.585,-74.57 14.564,-0.005 27.387,-7.504 34.765,-18.86 2.974,2.54 6.158,4.823 9.512,6.822 14.753,8.791 12.402,31.044 -3.98,36.195z"/>
<path android:fillColor="#e84857" android:pathData="m271.146,366.383c3.698,1.163 7.664,1.804 11.916,1.841 41.296,0.364 74.966,33.017 74.966,74.315v7.517c0,7.732 6.268,14 14,14h6c4.418,0 8,-3.582 8,-8v-39.26c0,-41.191 -33.395,-74.555 -74.585,-74.57 -14.564,-0.005 -27.387,-7.504 -34.765,-18.86 -2.974,2.54 -6.158,4.823 -9.512,6.822 -14.752,8.791 -12.402,31.044 3.98,36.195z"/>
<path android:fillColor="#4d4e59" android:pathData="m305.138,19.776c-11.758,4.839 -13.434,5.906 -17.508,5.274 -65.674,-10.18 -123.294,16.993 -142.862,80.786v0.01c-7.32,8.42 -11.74,19.42 -11.74,31.44v37.523c0,16.188 -25,17.315 -25,-0.293v-41.56c-0.32,-14.47 0.34,-65.5 37.2,-101.03 42.86,-41.31 110.78,-37.93 159.98,-15.83 1.6,0.72 1.55,3.01 -0.07,3.68z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="#585858"
android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".chat_bot">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/idRVChats"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/idRLMessage"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="0dp" /> <!--recycler view to display our chats-->
<LinearLayout
android:id="@+id/idRLMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="5">
<!--edit text to enter message-->
<EditText
android:id="@+id/idEdtMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:hint="Enter Message" />
<!--button to send message-->
<ImageButton
android:id="@+id/idFABSend"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="@color/purple_200"
android:src="@android:drawable/ic_menu_send"
android:tint="@color/white" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btnRestaurant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nearby Car Repair" />
</LinearLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".testingchat1">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_700"
android:theme="@style/AppTheme.AppBarOverlay">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:minHeight="?actionBarSize"
android:padding="@dimen/appbar_padding"
android:text="We welcome,your questions"
android:textColor="@color/white"
android:textSize="25dp"
style="@style/AppTheme12"/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/purple_700" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="5dp"
android:elevation="8dp"
android:layout_gravity="end"
app:cardCornerRadius="8dp">
<LinearLayout
android:background="@color/bot_back_color"
android:layout_gravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:src="@drawable/ic_chatbot" />
<TextView
android:id="@+id/idBot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:padding="3dp"
android:text="User Message"
android:textColor="@color/white" />
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/boarder"
android:layout_marginTop="20dp">
<androidx.cardview.widget.CardView
android:layout_width="72dp"
android:layout_height="match_parent"
app:cardBackgroundColor="@color/designMainColor"
app:cardCornerRadius="16dp">
<ImageView
android:layout_width="45dp"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:cropToPadding="true"
android:maxWidth="70dp"
android:src="@drawable/ic_chatbot" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/bl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Krecker Chat Bot"
android:textColor="@color/primaryTextColor"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Machine Learning algorithm"
android:textColor="@color/teal_700"
android:textSize="15sp"
android:textStyle="bold"
android:maxLines="3"
android:layout_marginBottom="10dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/teal_700"
android:textSize="15sp"
android:textStyle="bold"
android:maxLines="3"
android:layout_marginBottom="10dp"
/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/chatdisplay" />
</LinearLayout>
<!--remove the below layout with recycler view, use card poplar courses as model for design-->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.PlaceholderFragment">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintTop_creator="1" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="5dp"
android:elevation="8dp"
android:layout_gravity="end"
app:cardCornerRadius="8dp">
<LinearLayout
android:background="@color/user_back_color"
android:layout_width="wrap_content"
android:layout_gravity="end"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/idUser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:padding="3dp"
android:text="User Message"
android:textColor="@color/white" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:src="@drawable/ic_username" />
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment