aboutsummaryrefslogtreecommitdiff
path: root/Client
diff options
context:
space:
mode:
Diffstat (limited to 'Client')
-rw-r--r--Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml17
-rw-r--r--Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml17
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt206
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt200
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityShowFollowersAndFollowing.kt110
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt189
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityUserProfile.kt238
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivity.kt10
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivityConversation.kt36
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt193
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt34
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatPreviewsAdapter.kt12
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostHistoryAdapter.kt3
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt2
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt13
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt7
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt65
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePage.kt8
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePageMainScroll.kt132
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowUserPosts.kt (renamed from Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserProfile.kt)16
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowers.kt71
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowing.kt65
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPostsProfileActivity.kt64
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IBackendApi.kt43
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Chat.kt3
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt6
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/RatingData.kt11
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt8
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/DBHelper.kt45
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt29
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt15
-rw-r--r--Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsRepository.kt4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_message_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml2
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_7.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_description_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_location_on_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_tag_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_add_alt_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_remove_24.xml7
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_chat_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_message_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_button.xml4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/view_bottom_corner_radius.xml10
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/view_corner_radius.xml10
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml10
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml90
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml97
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml68
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml20
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_show_followers_and_following.xml83
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/activity_user_profile.xml193
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml78
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/chat_message_other.xml79
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml10
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml71
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml96
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml4
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_user_posts.xml17
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml18
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml18
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml3
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_profile_activity.xml18
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_profile.xml248
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/map_dialogue.xml11
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml112
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml93
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml39
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/values/colors.xml2
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/values/styles.xml14
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml5
79 files changed, 2454 insertions, 1024 deletions
diff --git a/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..394c76a
--- /dev/null
+++ b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="deploymentTargetDropDown">
+ <targetSelectedWithDropDown>
+ <Target>
+ <type value="QUICK_BOOT_TARGET" />
+ <deviceKey>
+ <Key>
+ <type value="VIRTUAL_DEVICE_PATH" />
+ <value value="C:\Users\TAMARA\.android\avd\Pixel_3a_XL_API_33.avd" />
+ </Key>
+ </deviceKey>
+ </Target>
+ </targetSelectedWithDropDown>
+ <timeTargetWasSelectedWithDropDown value="2022-11-28T13:21:51.009462400Z" />
+ </component>
+</project> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml
index 0c412d8..2241c80 100644
--- a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml
+++ b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml
@@ -37,9 +37,17 @@
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
+ android:name=".Activities.ActivityShowFollowersAndFollowing"
+ android:exported="false"
+ android:screenOrientation="portrait">
+ <meta-data
+ android:name="android.app.lib_name"
+ android:value="" />
+ </activity>
+ <activity
android:name=".Activities.ActivityUserProfile"
android:exported="false"
- android:screenOrientation="portrait" >
+ android:screenOrientation="portrait">
<meta-data
android:name="android.app.lib_name"
android:value="" />
@@ -47,8 +55,8 @@
<activity
android:name=".Activities.ChatActivityConversation"
android:exported="false"
- android:windowSoftInputMode="stateVisible|adjustPan"
- android:screenOrientation="portrait" >
+ android:screenOrientation="portrait"
+ android:windowSoftInputMode="stateVisible|adjustPan">
<meta-data
android:name="android.app.lib_name"
android:value="" />
@@ -56,11 +64,10 @@
<activity
android:name=".Activities.ChatActivity"
android:exported="true"
- android:screenOrientation="portrait" >
+ android:screenOrientation="portrait">
<meta-data
android:name="android.app.lib_name"
android:value="" />
-
</activity>
<meta-data
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt
index 2d305a6..746d8b0 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt
@@ -9,12 +9,14 @@ import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
+import android.view.KeyEvent
import android.view.View
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
+import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.setMargins
import com.example.brzodolokacije.Models.Location
@@ -51,37 +53,43 @@ class ActivityAddPost : AppCompatActivity() {
private lateinit var tagText: EditText
private lateinit var tagButtonAdd:Button
private lateinit var tagList: MutableList<String>
+ private lateinit var locText: EditText
private var tagidcounter:Int = 0
- val incorectCoord:Double=1000.0
val LOCATIONREQCODE=123
- var longitude:Double=incorectCoord
- var latitude:Double=incorectCoord
+ var locationId:String?=null
var progressDialog:ProgressDialog?=null
- //private var paths :ArrayList<String?>?=null
+ private lateinit var addDescription:Button
+
+
+
private var place=0;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_add_post)
-// Toast.makeText(
-// applicationContext, "Add new ", Toast.LENGTH_LONG
-// ).show();
+
uploadedImages= ArrayList()
tagList = mutableListOf()
tagButtons= mutableListOf()
tagidcounter = 0
- //paths= ArrayList()
uploadFromGallery=findViewById<View>(R.id.btnActivityAddPostUploadFromGalleryVisible) as Button
showNextImage=findViewById<View>(R.id.nextImage) as Button
showPreviousImage=findViewById<View>(R.id.previousImage) as Button
switcher=findViewById<View>(R.id.isActivityAddPostSwitcher) as ImageSwitcher
- location=findViewById<View>(R.id.etActivityAddPostLocation) as EditText
description=findViewById<View>(R.id.etActivityAddPostDescription) as EditText
post=findViewById<View>(R.id.btnActivityAddPostPost) as Button
addLocation=findViewById<View>(R.id.btnActivityAddPostAddLocation) as Button
tagText =findViewById<View>(R.id.acTags) as EditText
tagButtonAdd = findViewById<View>(R.id.btnActivityAddPostAddTag) as Button
tagLayout = findViewById<View>(R.id.llTags) as LinearLayout
+ locText=findViewById<View>(R.id.etActivityAddPostLocationText) as EditText
+
+ addDescription=findViewById<View>(R.id.tvActivityAddPostDescriptiontext)as Button
+
+ tagText.isGone=true
+ tagText.isVisible=false
+ description.isGone=true
+ description.isVisible=false
progressDialog= ProgressDialog(this)
progressDialog!!.setMessage("Molimo sacekajte!!!")
@@ -96,45 +104,26 @@ class ActivityAddPost : AppCompatActivity() {
imgView}
addLocation.setOnClickListener {
val myIntent = Intent(this, MapsActivity::class.java)
- if(location.text!=null && !location.text.trim().equals(""))
- myIntent.putExtra("search",location.text.toString())
startActivityForResult(myIntent,LOCATIONREQCODE)
}
-
+ addDescription.setOnClickListener {
+ description.isGone=false
+ description.isVisible=true
+ }
//dodavanje i brisanje tagova
tagButtonAdd.setOnClickListener {
- if(tagList.count()<5) {
- var tagstr = tagText.text.toString()
- var newbtn = Button(this)
- newbtn.setId(tagidcounter)
- newbtn.text = tagstr
- var layoutParams = LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- 50
- )
- layoutParams.setMargins(3)
- newbtn.layoutParams=layoutParams
- newbtn.setBackgroundColor(Color.parseColor("#1C789A"))
- newbtn.setTextColor(Color.WHITE)
- newbtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10F)
- newbtn.setPadding(3,1,3,1)
-
- newbtn.setOnClickListener {
- var btntext = newbtn.text.toString()
- tagList.remove(btntext)
- tagButtons.remove(newbtn)
- tagLayout.removeView(newbtn)
- }
-
- tagList.add(tagstr)
- tagButtons.add(newbtn)
- tagLayout.addView(newbtn)
- tagText.text.clear()
- }
- else{
- Toast.makeText(this,"Maksimalno 5 tagova",Toast.LENGTH_LONG)
- }
+ addTag()
}
+ tagText.setOnKeyListener(View.OnKeyListener { v1, keyCode, event -> // If the event is a key-down event on the "enter" button
+ if (event.action === KeyEvent.ACTION_DOWN &&
+ keyCode == KeyEvent.KEYCODE_ENTER
+ ) {
+ // Perform action on key press
+ addTag()
+ return@OnKeyListener true
+ }
+ false
+ })
//dodavanje iz galerije
uploadFromGallery.setOnClickListener{
@@ -179,27 +168,62 @@ class ActivityAddPost : AppCompatActivity() {
}
post.setOnClickListener{
- locationString=location.text.toString().trim()
+ //locationString=location.text.toString().trim()
descriptionString=description.text.toString().trim()
//prazan unos?
- if(locationString.isEmpty()) {
+ /* if(locationString.isEmpty()) {
location.hint="Unesite naziv lokaciju"
location.setHintTextColor(Color.RED)
- }
+ }*/
if(descriptionString.isEmpty()) {
- description.hint="Unesite lokaciju"
+ description.hint="Unesite opis"
description.setHintTextColor(Color.RED)
}
- if(longitude!=incorectCoord && latitude!=incorectCoord){
+ if(locationId==null || locationId!!.trim()==""){
Toast.makeText(this,"Unesite lokaciju klikom na dugme",Toast.LENGTH_LONG)
}
- if(!locationString.isEmpty() && !descriptionString.isEmpty() && longitude!=incorectCoord && latitude!=incorectCoord && uploadedImages!!.size>0){
+ if(!descriptionString.isEmpty() && uploadedImages!!.size>0){
sendPost()
}
}
}
+ fun addTag(){
+ tagText.isGone=false
+ tagText.isVisible=true
+
+ if(tagList.count()<4 && tagText.text.toString().length>=3) {
+ var tagstr = tagText.text.toString()
+ var newbtn = Button(this)
+ newbtn.setId(tagidcounter)
+ newbtn.text = tagstr
+ var layoutParams = LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ 50
+ )
+ layoutParams.setMargins(3)
+ newbtn.layoutParams=layoutParams
+ newbtn.setBackgroundColor(Color.parseColor("#1C789A"))
+ newbtn.setTextColor(Color.WHITE)
+ newbtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10F)
+ newbtn.setPadding(3,1,3,1)
+
+ newbtn.setOnClickListener {
+ var btntext = newbtn.text.toString()
+ tagList.remove(btntext)
+ tagButtons.remove(newbtn)
+ tagLayout.removeView(newbtn)
+ }
+ tagList.add(tagstr)
+ tagButtons.add(newbtn)
+ tagLayout.addView(newbtn)
+ tagText.text.clear()
+ }
+ else{
+ Toast.makeText(this,"Maksimalno 4 tagova ( duzine + karaktera)",Toast.LENGTH_LONG)
+ }
+ }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@@ -234,11 +258,11 @@ class ActivityAddPost : AppCompatActivity() {
}
if(requestCode==LOCATIONREQCODE && resultCode== RESULT_OK){
var bundle=data!!.extras
- longitude=bundle!!.getDouble("longitude",incorectCoord)
- latitude=bundle!!.getDouble("latitude",incorectCoord)
- var locName=bundle!!.getString("name")
- if(location.text.toString().trim().equals("") && locName!=null && !locName.toString().trim().equals(""))
- location.setText(locName,TextView.BufferType.EDITABLE)
+ locationId=bundle!!.getString("locationId")
+ var name=bundle!!.getString("name")
+ locText.isGone=false
+ locText.isVisible=true
+ locText.setText(name,TextView.BufferType.EDITABLE)
}
}
private fun sendPost(){
@@ -246,60 +270,11 @@ class ActivityAddPost : AppCompatActivity() {
}
fun uploadLocation() {
- //TO DO SEARCH EXISTING LOCATION FROM DB
- //IF NOT EXISTS ADD NEW LOCATION
- progressDialog!!.show()
- val api =RetrofitHelper.getInstance()
- var geocoder=GeocoderHelper.getInstance()
- var loc1=geocoder!!.getFromLocation(latitude,longitude,1)
- if(loc1==null ||loc1.size<=0)
- {
- progressDialog!!.dismiss()
- Toast.makeText(this,"Lokacija ne postoji",Toast.LENGTH_LONG);
- return
- }
- var countryName=loc1[0].countryName
- var address="todo not possible in query"
- var city="its null"
- if(loc1[0].adminArea!=null)
- city=loc1[0].adminArea//not possible
- var loc:Location=Location("",locationString,city,countryName,address,latitude,longitude,LocationType.GRAD)
- var jwtString= SharedPreferencesHelper.getValue("jwt",this)
- var data=api.addLocation("Bearer "+jwtString,loc)
-
- data.enqueue(object : retrofit2.Callback<Location?> {
- override fun onResponse(call: Call<Location?>, response: Response<Location?>) {
- if(response.isSuccessful()){
-
- uploadPost(response.body()!!._id)
- Toast.makeText(
- applicationContext, "USPEH", Toast.LENGTH_LONG
- ).show();
-
- }else {
- progressDialog!!.dismiss()
-
- if (response.errorBody() != null) {
- Log.d("Main",response.errorBody()!!.string())
- Log.d("Main",response.message())
- }
- Log.d("Main",response.errorBody()!!.string())
- Log.d("Main",response.message())
- }
-
-
- }
-
- override fun onFailure(call: Call<Location?>, t: Throwable) {
- Toast.makeText(
- applicationContext, t.toString(), Toast.LENGTH_LONG
- ).show();
- Log.d("Main",t.toString())
- progressDialog!!.dismiss()
- }
- })
+ if(locationId!=null && locationId!!.trim()!="")
+ uploadPost(locationId!!)
}
fun uploadPost(loc:String){
+ progressDialog!!.show()
val api =RetrofitHelper.getInstance()
var desc=descriptionString
description.text.clear()
@@ -309,10 +284,12 @@ class ActivityAddPost : AppCompatActivity() {
var descReq=RequestBody.create("text/plain".toMediaTypeOrNull(),desc)
var idReq=RequestBody.create("text/plain".toMediaTypeOrNull(),"dsa")
- var tagliststring=""
- for(tag in tagList){
- tagliststring=tagliststring+tag+"|"
- }
+ var tagliststring="none"
+ if(tagList.count()>0){
+ tagliststring=""
+ for(tag in tagList){
+ tagliststring=tagliststring+tag+"|"
+ }}
var tagReq=RequestBody.create("text/plain".toMediaTypeOrNull(),tagliststring)
val imagesParts = arrayOfNulls<MultipartBody.Part>(
@@ -340,9 +317,12 @@ class ActivityAddPost : AppCompatActivity() {
override fun onResponse(call: Call<PostPreview?>, response: Response<PostPreview?>) {
progressDialog!!.dismiss()
if(response.isSuccessful()){
- Toast.makeText(
- applicationContext, "USPEH", Toast.LENGTH_LONG
- ).show();
+ val intent:Intent = Intent(this@ActivityAddPost,ActivitySinglePost::class.java)
+ var b=Bundle()
+ b.putParcelable("selectedPost",response.body())
+ intent.putExtras(b)
+ startActivity(intent)
+ finish()
}else {
if (response.errorBody() != null) {
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt
index b02abad..79062c9 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt
@@ -11,12 +11,14 @@ import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.util.TypedValue
+import android.view.KeyEvent
import android.view.View
import android.widget.*
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
+import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.setMargins
import com.example.brzodolokacije.Models.Location
@@ -40,13 +42,10 @@ import java.io.InputStream
class ActivityCapturePost : AppCompatActivity() {
private lateinit var takePhoto: Button
- private lateinit var location: EditText
private lateinit var description: EditText
- private lateinit var locationString: String
private lateinit var descriptionString: String
private lateinit var post: Button
private lateinit var showImage: ImageView
- private var uploadedImages: Uri? = null
private lateinit var addLocation:Button
private lateinit var tagLayout:LinearLayout
private lateinit var tagButtons:MutableList<Button>
@@ -54,11 +53,13 @@ class ActivityCapturePost : AppCompatActivity() {
private lateinit var tagButtonAdd:Button
private lateinit var tagList: MutableList<String>
private var tagidcounter:Int = 0
+ private lateinit var addDescription:Button
+ private lateinit var locText: EditText
+
- val incorectCoord:Double=1000.0
val LOCATIONREQCODE=123
- var longitude:Double=incorectCoord
- var latitude:Double=incorectCoord
+ var locationId:String?=null
+
var progressDialog: ProgressDialog?=null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -68,7 +69,6 @@ class ActivityCapturePost : AppCompatActivity() {
tagButtons= mutableListOf()
tagidcounter = 0
- location = findViewById<View>(R.id.etActivityCapturePostLocation) as EditText
description = findViewById<View>(R.id.etActivityCapturePostDescription) as EditText
post = findViewById<View>(R.id.btnActivityCapturePostPost) as Button
showImage = findViewById<View>(R.id.ivActivityCapturePostImage) as ImageView
@@ -78,47 +78,38 @@ class ActivityCapturePost : AppCompatActivity() {
tagButtonAdd = findViewById<View>(R.id.btnActivityAddPostAddTagCap) as Button
tagLayout = findViewById<View>(R.id.llTagsCap) as LinearLayout
+ addDescription=findViewById<View>(R.id.tvActivityCapturePostDescriptiontext)as Button
+ locText=findViewById<View>(R.id.etActivityAddPostLocationText) as EditText
+
+
progressDialog= ProgressDialog(this)
progressDialog!!.setMessage("Molimo sacekajte!!!")
progressDialog!!.setCancelable(false)
progressDialog!!.setCanceledOnTouchOutside(false)
+ tagText.isGone=true
+ tagText.isVisible=false
+ description.isGone=true
+ description.isVisible=false
+ addDescription.setOnClickListener {
+ description.isGone=false
+ description.isVisible=true
+ }
//dodavanje i brisanje tagova
tagButtonAdd.setOnClickListener {
- if(tagList.count()<5) {
- var tagstr = tagText.text.toString()
- var newbtn = Button(this)
- newbtn.setId(tagidcounter)
- newbtn.text = tagstr
- var layoutParams = LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- 50
- )
- layoutParams.setMargins(3)
- newbtn.layoutParams=layoutParams
- newbtn.setBackgroundColor(Color.parseColor("#1C789A"))
- newbtn.setTextColor(Color.WHITE)
- newbtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10F)
- newbtn.setPadding(3,1,3,1)
-
- newbtn.setOnClickListener {
- var btntext = newbtn.text.toString()
- tagList.remove(btntext)
- tagButtons.remove(newbtn)
- tagLayout.removeView(newbtn)
- }
-
- tagList.add(tagstr)
- tagButtons.add(newbtn)
- tagLayout.addView(newbtn)
- tagText.text.clear()
- }
- else{
- Toast.makeText(this,"Maksimalno 5 tagova",Toast.LENGTH_LONG)
- }
+ addTag()
}
-
+ tagText.setOnKeyListener(View.OnKeyListener { v1, keyCode, event -> // If the event is a key-down event on the "enter" button
+ if (event.action === KeyEvent.ACTION_DOWN &&
+ keyCode == KeyEvent.KEYCODE_ENTER
+ ) {
+ // Perform action on key press
+ addTag()
+ return@OnKeyListener true
+ }
+ false
+ })
//dodavanje sa kamere
@@ -168,8 +159,8 @@ class ActivityCapturePost : AppCompatActivity() {
addLocation.setOnClickListener {
val myIntent = Intent(this, MapsActivity::class.java)
- if(location.text!=null && !location.text.trim().equals(""))
- myIntent.putExtra("search",location.text.toString())
+ // if(location.text!=null && !location.text.trim().equals(""))
+ // myIntent.putExtra("search",location.text.toString())
startActivityForResult(myIntent,LOCATIONREQCODE)
}
@@ -198,17 +189,13 @@ class ActivityCapturePost : AppCompatActivity() {
}
post.setOnClickListener {
- locationString = location.text.toString().trim()
+ // locationString = location.text.toString().trim()
descriptionString = description.text.toString().trim()
//prazan unos?
- if (locationString.isEmpty()) {
- location.hint = "Unesite lokaciju"
- location.setHintTextColor(Color.RED)
- }else
if (descriptionString.isEmpty()) {
description.hint = "Unesite opis"
description.setHintTextColor(Color.RED)
- }else if(f!=null && longitude!=incorectCoord && latitude!=incorectCoord){
+ }else if(f!=null && locationId!=null && locationId!!.trim()!=""){
uploadLocation()
}
@@ -217,15 +204,51 @@ class ActivityCapturePost : AppCompatActivity() {
}
}
+ fun addTag(){
+ tagText.isGone=false
+ tagText.isVisible=true
+
+ if(tagList.count()<4 && tagText.text.toString().length>=3) {
+ var tagstr = tagText.text.toString()
+ var newbtn = Button(this)
+ newbtn.setId(tagidcounter)
+ newbtn.text = tagstr
+ var layoutParams = LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ 50
+ )
+ layoutParams.setMargins(3)
+ newbtn.layoutParams=layoutParams
+ newbtn.setBackgroundColor(Color.parseColor("#1C789A"))
+ newbtn.setTextColor(Color.WHITE)
+ newbtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10F)
+ newbtn.setPadding(3,1,3,1)
+
+ newbtn.setOnClickListener {
+ var btntext = newbtn.text.toString()
+ tagList.remove(btntext)
+ tagButtons.remove(newbtn)
+ tagLayout.removeView(newbtn)
+ }
+
+ tagList.add(tagstr)
+ tagButtons.add(newbtn)
+ tagLayout.addView(newbtn)
+ tagText.text.clear()
+ }
+ else{
+ Toast.makeText(this,"Maksimalno 4 tagova ( duzine + karaktera)",Toast.LENGTH_LONG)
+ }
+ }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode==LOCATIONREQCODE && resultCode== RESULT_OK){
var bundle=data!!.extras
- longitude=bundle!!.getDouble("longitude",incorectCoord)
- latitude=bundle!!.getDouble("latitude",incorectCoord)
- var locName=bundle!!.getString("name")
- if(location.text.toString().trim().equals("") && locName!=null && !locName.toString().trim().equals(""))
- location.setText(locName, TextView.BufferType.EDITABLE)
+ locationId=bundle!!.getString("locationId")
+ var name=bundle!!.getString("name")
+ locText.isGone=false
+ locText.isVisible=true
+ locText.setText(name,TextView.BufferType.EDITABLE)
}
}
var f:File?=null
@@ -250,59 +273,11 @@ class ActivityCapturePost : AppCompatActivity() {
}
fun uploadLocation() {
- //TO DO SEARCH EXISTING LOCATION FROM DB
- //IF NOT EXISTS ADD NEW LOCATION
- progressDialog!!.show()
- val api =RetrofitHelper.getInstance()
- var geocoder= GeocoderHelper.getInstance()
- var loc1=geocoder!!.getFromLocation(latitude,longitude,1)
- if(loc1==null ||loc1.size<=0)
- {
- progressDialog!!.dismiss()
- Toast.makeText(this,"Lokacija ne postoji",Toast.LENGTH_LONG);
- return
- }
- var countryName=loc1[0].countryName
- var address="todo not possible in query"
- var city=loc1[0].adminArea//not possible
- //var address=loc1[0].subAdminArea
- var loc:Location=Location("",locationString,city,countryName,address,latitude,longitude,LocationType.GRAD)
- var jwtString= SharedPreferencesHelper.getValue("jwt",this)
- var data=api.addLocation("Bearer "+jwtString,loc)
-
- data.enqueue(object : retrofit2.Callback<Location?> {
- override fun onResponse(call: Call<Location?>, response: Response<Location?>) {
- if(response.isSuccessful()){
-
- uploadPost(response.body()!!._id)
- Toast.makeText(
- applicationContext, "USPEH", Toast.LENGTH_LONG
- ).show();
-
- }else {
- progressDialog!!.dismiss()
-
- if (response.errorBody() != null) {
- Log.d("Main",response.errorBody()!!.string())
- Log.d("Main",response.message())
- }
- Log.d("Main",response.errorBody()!!.string())
- Log.d("Main",response.message())
- }
-
-
- }
-
- override fun onFailure(call: Call<Location?>, t: Throwable) {
- Toast.makeText(
- applicationContext, t.toString(), Toast.LENGTH_LONG
- ).show();
- Log.d("Main",t.toString())
- progressDialog!!.dismiss()
- }
- })
+ if(locationId!=null && locationId!!.trim()!="")
+ uploadPost(locationId!!)
}
fun uploadPost(loc:String){
+ progressDialog!!.show()
val api = RetrofitHelper.getInstance()
var desc=descriptionString
description.text.clear()
@@ -312,10 +287,12 @@ class ActivityCapturePost : AppCompatActivity() {
var descReq= RequestBody.create("text/plain".toMediaTypeOrNull(),desc)
var idReq= RequestBody.create("text/plain".toMediaTypeOrNull(),"dsa")
- var tagliststring=""
- for(tag in tagList){
- tagliststring=tagliststring+tag+"|"
- }
+ var tagliststring="none"
+ if(tagList.count()>0){
+ tagliststring=""
+ for(tag in tagList){
+ tagliststring=tagliststring+tag+"|"
+ }}
var tagReq=RequestBody.create("text/plain".toMediaTypeOrNull(),tagliststring)
val imagesParts = arrayOfNulls<MultipartBody.Part>(
@@ -333,9 +310,12 @@ class ActivityCapturePost : AppCompatActivity() {
override fun onResponse(call: Call<PostPreview?>, response: Response<PostPreview?>) {
if(response.isSuccessful()){
progressDialog!!.dismiss()
- Toast.makeText(
- applicationContext, "USPEH", Toast.LENGTH_LONG
- ).show();
+ val intent:Intent = Intent(this@ActivityCapturePost,ActivitySinglePost::class.java)
+ var b=Bundle()
+ b.putParcelable("selectedPost",response.body())
+ intent.putExtras(b)
+ startActivity(intent)
+ finish()
}else {
progressDialog!!.dismiss()
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityShowFollowersAndFollowing.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityShowFollowersAndFollowing.kt
new file mode 100644
index 0000000..fe0d546
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityShowFollowersAndFollowing.kt
@@ -0,0 +1,110 @@
+package com.example.brzodolokacije.Activities
+
+import android.content.Intent
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+import android.widget.*
+import androidx.fragment.app.FragmentTransaction
+import com.example.brzodolokacije.Fragments.*
+import com.example.brzodolokacije.Models.UserReceive
+import com.example.brzodolokacije.R
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
+import com.google.gson.Gson
+import kotlinx.android.synthetic.main.list_item.*
+import retrofit2.Call
+import retrofit2.Response
+
+class ActivityShowFollowersAndFollowing : AppCompatActivity() {
+
+ // private lateinit var showFollowers:Button
+ //private lateinit var showFollowing:Button
+ private lateinit var fragmentContainer:FrameLayout
+ private lateinit var followersOrFollowing:String
+ private lateinit var userId:String
+ private lateinit var text:TextView
+ private lateinit var back: ImageView
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_show_followers_and_following)
+
+ val bundle = intent.extras
+ if (bundle != null){
+ userId= bundle.getString("userId").toString().trim()
+ followersOrFollowing=bundle.get("show").toString().trim()
+ }
+
+ fragmentContainer=findViewById(R.id.flActivityShowFollowerAndFollowing)
+ text=findViewById(R.id.tvActivityShowFollowersOrFollowingShow)
+ back=findViewById(R.id.btnActivityShowFollowersAndFollowingBackToUser)
+
+ if(followersOrFollowing=="followers"){
+ text.text="Pratioci"
+ val mFragmentManager = supportFragmentManager
+ val mFragmentTransaction = mFragmentManager.beginTransaction()
+ val mFragment = FragmentUserFollowers()
+ val mBundle = Bundle()
+ mBundle.putString("userId",userId)
+ mFragment.arguments = mBundle
+ mFragmentTransaction.replace(R.id.flActivityShowFollowerAndFollowing, mFragment).commit()
+ }
+
+ if(followersOrFollowing=="following"){
+ text.text="Praćenja"
+ val mFragmentManager = supportFragmentManager
+ val mFragmentTransaction = mFragmentManager.beginTransaction()
+ val mFragment = FragmentUserFollowing()
+ val mBundle = Bundle()
+ mBundle.putString("userId",userId)
+ mFragment.arguments = mBundle
+ mFragmentTransaction.replace(R.id.flActivityShowFollowerAndFollowing, mFragment).commit()
+ }
+
+ back.setOnClickListener {
+ var token= SharedPreferencesHelper.getValue("jwt", this).toString()
+ val api= RetrofitHelper.getInstance()
+ val request= api.getProfileFromId("Bearer " + token, userId)
+ request.enqueue(object : retrofit2.Callback<UserReceive> {
+ override fun onResponse(call: Call<UserReceive>,
+ response: Response<UserReceive>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ var userData = response.body()!!
+ val intent: Intent = Intent(this@ActivityShowFollowersAndFollowing,ActivityUserProfile::class.java)
+ var b= Bundle()
+ intent.putExtra("user", Gson().toJson(userData))
+ startActivity(intent)
+ }
+
+ override fun onFailure(call: Call<UserReceive>, t: Throwable) {
+
+ }
+ })
+
+ }
+
+
+/*
+ showFollowers=findViewById(R.id.btnActivityShowFollowersAndFollowingShowFollowers)
+ showFollowing=findViewById(R.id.btnActivityShowFollowersAndFollowingShowFollowing)
+ fragmentContainer=findViewById(R.id.flActivityShowFollowerAndFollowing)
+
+ showFollowers.setOnClickListener {
+ followersOrFollowing="followers"
+ var fm: FragmentTransaction =supportFragmentManager.beginTransaction()
+ fm.replace(R.id.flActivityShowFollowerAndFollowing, FragmentUserFollowers())
+ fm.commit()
+ }
+
+ showFollowing.setOnClickListener {
+ followersOrFollowing="following"
+ var fm: FragmentTransaction =supportFragmentManager.beginTransaction()
+ fm.replace(R.id.flActivityShowFollowerAndFollowing, FragmentUserFollowing())
+ fm.commit()
+ }
+*/
+ }
+} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt
index f969669..edbec21 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt
@@ -1,11 +1,18 @@
package com.example.brzodolokacije.Activities
import android.content.Intent
+import android.graphics.Color
+import android.graphics.drawable.ColorDrawable
+import android.media.Image
import android.os.Bundle
+import android.preference.PreferenceManager
+import android.provider.ContactsContract.CommonDataKinds.Im
import android.util.Log
+import android.widget.ImageButton
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.brzodolokacije.Adapters.CommentsAdapter
@@ -15,9 +22,14 @@ import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.RetrofitHelper
import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.example.brzodolokacije.databinding.ActivitySinglePostBinding
+import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.gson.Gson
-import kotlinx.android.synthetic.main.activity_single_post.*
import okhttp3.ResponseBody
+import org.osmdroid.config.Configuration
+import org.osmdroid.tileprovider.tilesource.TileSourceFactory
+import org.osmdroid.util.GeoPoint
+import org.osmdroid.views.MapView
+import org.osmdroid.views.overlay.Marker
import retrofit2.Call
import retrofit2.Response
@@ -57,14 +69,49 @@ class ActivitySinglePost : AppCompatActivity() {
setRatingListeners()
translateOwnerIdToName(post.ownerId)
+ val alreadyrated= RatingReceive(starNumber.toInt(),post._id)
+ requestAddRating(alreadyrated)
+
binding.tvUser.setOnClickListener {
val intent: Intent = Intent(this@ActivitySinglePost,ActivityUserProfile::class.java)
var b= Bundle()
intent.putExtra("user", Gson().toJson(userData))
this.startActivity(intent)
}
+ binding.tvLocationType.setOnClickListener{
+ getMap()
+
+ }
+ }
+ fun getMap(){
+ val mapDialogue = BottomSheetDialog(this@ActivitySinglePost, android.R.style.Theme_Black_NoTitleBar)
+ mapDialogue.getWindow()?.setBackgroundDrawable(ColorDrawable(Color.argb(100, 0, 0, 0)))
+ mapDialogue.setContentView(R.layout.map_dialogue)
+ mapDialogue.setCancelable(true)
+ mapDialogue.setCanceledOnTouchOutside(true)
+ var map: MapView? = null
+ Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this));
+ map=mapDialogue.findViewById(R.id.MapDialogueMapView)
+ //findViewById(R.id.MapDialogueMapView) as MapView
+ map!!.setTileSource(TileSourceFactory.MAPNIK);
+ map!!.setBuiltInZoomControls(true);
+ map!!.setMultiTouchControls(true);
+ val mapController = map!!.controller
+ mapController.setZoom(15)
+
+ val LocMarker = GeoPoint(post.location.latitude,post.location.longitude)
+ val startMarker = Marker(map)
+ val marker = ContextCompat.getDrawable(this@ActivitySinglePost, R.drawable.ic_baseline_location_on_24);
+ startMarker.icon=marker
+ startMarker.setPosition(LocMarker)
+ startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER)
+ map!!.getOverlays().add(startMarker)
+ map!!.controller.setCenter(LocMarker)
+ mapDialogue.show()
+
}
+
fun buildRecyclerViewComments(){
recyclerViewComments=binding.rvComments
adapterComments=CommentsAdapter(comments as MutableList<CommentSend>)
@@ -74,13 +121,29 @@ class ActivitySinglePost : AppCompatActivity() {
recyclerViewComments!!.adapter= adapterComments
}
- fun setRatingListeners(){
- val emptyStar=R.drawable.empty_star
- val fullStar=R.drawable.full_star
-
+ fun setRatingListeners() {
+ val emptyStar = R.drawable.empty_star
+ val fullStar = R.drawable.full_star
+ /*var starlist: ArrayList<ImageButton> = arrayListOf()
+ starlist.add(findViewById(R.id.rateStar1) as ImageButton)
+ starlist.add(findViewById(R.id.rateStar2) as ImageButton)
+ starlist.add(findViewById(R.id.rateStar3) as ImageButton)
+ starlist.add(findViewById(R.id.rateStar4) as ImageButton)
+ starlist.add(findViewById(R.id.rateStar5) as ImageButton)
+ for (i in 0..4) {
+ starlist[i].setOnClickListener {
+ for (j in 1..i) {
+ starlist[j].setImageResource(fullStar)
+ }
+ for (k in i..5) {
+ starlist[k].setImageResource(emptyStar)
+ }
+ starNumber = i+1;
+ }
+ }*/
binding.rateStar1.setOnClickListener {
- Toast.makeText(this,"kliknuta prva zvezdica",Toast.LENGTH_SHORT).show()
+ //Toast.makeText(this,"kliknuta prva zvezdica",Toast.LENGTH_SHORT).show()
binding.rateStar1.setImageResource(fullStar)
binding.rateStar2.setImageResource(emptyStar)
binding.rateStar3.setImageResource(emptyStar)
@@ -89,7 +152,7 @@ class ActivitySinglePost : AppCompatActivity() {
starNumber=1
}
binding.rateStar2.setOnClickListener {
- Toast.makeText(this,"kliknuta druga zvezdica",Toast.LENGTH_SHORT).show()
+ //Toast.makeText(this,"kliknuta druga zvezdica",Toast.LENGTH_SHORT).show()
binding.rateStar1.setImageResource(fullStar)
binding.rateStar2.setImageResource(fullStar)
binding.rateStar3.setImageResource(emptyStar)
@@ -98,7 +161,7 @@ class ActivitySinglePost : AppCompatActivity() {
starNumber=2
}
binding.rateStar3.setOnClickListener {
- Toast.makeText(this,"kliknuta treca zvezdica",Toast.LENGTH_SHORT).show()
+ //Toast.makeText(this,"kliknuta treca zvezdica",Toast.LENGTH_SHORT).show()
binding.rateStar1.setImageResource(fullStar)
binding.rateStar2.setImageResource(fullStar)
binding.rateStar3.setImageResource(fullStar)
@@ -107,7 +170,7 @@ class ActivitySinglePost : AppCompatActivity() {
starNumber=3
}
binding.rateStar4.setOnClickListener {
- Toast.makeText(this,"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show()
+ //Toast.makeText(this,"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show()
binding.rateStar1.setImageResource(fullStar)
binding.rateStar2.setImageResource(fullStar)
binding.rateStar3.setImageResource(fullStar)
@@ -116,7 +179,7 @@ class ActivitySinglePost : AppCompatActivity() {
starNumber=4
}
binding.rateStar5.setOnClickListener {
- Toast.makeText(this,"kliknuta peta zvezdica",Toast.LENGTH_SHORT).show()
+ //Toast.makeText(this,"kliknuta peta zvezdica",Toast.LENGTH_SHORT).show()
binding.rateStar1.setImageResource(fullStar)
binding.rateStar2.setImageResource(fullStar)
binding.rateStar3.setImageResource(fullStar)
@@ -150,10 +213,12 @@ class ActivitySinglePost : AppCompatActivity() {
val postApi= RetrofitHelper.getInstance()
val token= SharedPreferencesHelper.getValue("jwt", this@ActivitySinglePost)
val request=postApi.addComment("Bearer "+token,post._id,comment)
- request.enqueue(object : retrofit2.Callback<ResponseBody?> {
- override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) {
+ request.enqueue(object : retrofit2.Callback<CommentSend?> {
+ override fun onResponse(call: Call<CommentSend?>, response: Response<CommentSend?>) {
if(response.isSuccessful){
- requestGetComments()
+
+ var newComment=response.body()!!
+ requestGetComments(newComment)
binding.NewComment.text.clear()
}else{
if(response.errorBody()!=null)
@@ -163,53 +228,77 @@ class ActivitySinglePost : AppCompatActivity() {
}
- override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
+ override fun onFailure(call: Call<CommentSend?>, t: Throwable) {
Log.d("main2",t.message.toString())
}
})
}
- fun requestGetComments(){
- val postApi= RetrofitHelper.getInstance()
- val token= SharedPreferencesHelper.getValue("jwt", this@ActivitySinglePost)
- val request=postApi.getComments("Bearer "+token,post._id)
- request.enqueue(object : retrofit2.Callback<MutableList<CommentSend>?> {
- override fun onResponse(call: Call<MutableList<CommentSend>?>, response: Response<MutableList<CommentSend>?>) {
- if(response.isSuccessful){
- comments= response.body()!!
- if(comments!=null && comments!!.isNotEmpty()){
- buildRecyclerViewComments()
- if(comments!=null)
- binding.tvCommentCount.text=comments?.size.toString()
- else
- binding.tvCommentCount.text="0"
+ fun requestGetComments(newComment:CommentSend?=null){
+ if(newComment==null){
+ val postApi= RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", this@ActivitySinglePost)
+ val request=postApi.getComments("Bearer "+token,post._id)
+ request.enqueue(object : retrofit2.Callback<MutableList<CommentSend>?> {
+ override fun onResponse(call: Call<MutableList<CommentSend>?>, response: Response<MutableList<CommentSend>?>) {
+ if(response.isSuccessful){
+ comments= response.body()!!
+ if(comments!=null && comments!!.isNotEmpty()){
+ buildRecyclerViewComments()
+ if(comments!=null)
+ binding.tvCommentCount.text=comments?.size.toString()
+ else
+ binding.tvCommentCount.text="0"
+ }
+ }else{
+ if(response.errorBody()!=null)
+ Log.d("main1",response.message().toString())
}
- }else{
- if(response.errorBody()!=null)
- Log.d("main1",response.message().toString())
- }
- }
+ }
- override fun onFailure(call: Call<MutableList<CommentSend>?>, t: Throwable) {
- Log.d("main2",t.message.toString())
- }
- })
+ override fun onFailure(call: Call<MutableList<CommentSend>?>, t: Throwable) {
+ Log.d("main2",t.message.toString())
+ }
+ })
+ }
+ else{
+ (adapterComments as CommentsAdapter).items.add(0,newComment)
+ recyclerViewComments?.adapter=adapterComments
+ Log.d("main",newComment.username)
+ binding.tvCommentCount.text=comments?.size.toString()
+ }
}
fun requestAddRating(rating:RatingReceive){
val postApi= RetrofitHelper.getInstance()
val token= SharedPreferencesHelper.getValue("jwt", this@ActivitySinglePost)
val request=postApi.addRating("Bearer "+token,post._id,rating)
- request.enqueue(object : retrofit2.Callback<ResponseBody?> {
- override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) {
+ request.enqueue(object : retrofit2.Callback<RatingData?> {
+ override fun onResponse(call: Call<RatingData?>, response: Response<RatingData?>) {
if(response.isSuccessful){
- //zasad hardkodovano, zameniti te vrednosti sa brojem ocena kada se doda
- post.ratings=((post.ratings)*10+rating.rating)/11
- binding.tvRating.text=String.format("%.2f",post.ratings)
- Toast.makeText(
- this@ActivitySinglePost, "prosao zahtev", Toast.LENGTH_LONG
- ).show()
+ var data=response.body()!!
+ binding.tvRating.text=String.format("%.2f",data.ratings)
+ binding.tvNumberOfRatings.text=String.format("%d",data.ratingscount)
+ Log.d("--------------",data.ratings.toString()+" "+data.ratingscount.toString())
+ when(data.myrating){
+ 1->binding.rateStar1.performClick()
+ 2->binding.rateStar2.performClick()
+ 3->binding.rateStar3.performClick()
+ 4->binding.rateStar4.performClick()
+ 5->binding.rateStar5.performClick()
+ else->{
+ val emptyStar = R.drawable.empty_star
+ binding.rateStar1.setImageResource(emptyStar)
+ binding.rateStar2.setImageResource(emptyStar)
+ binding.rateStar3.setImageResource(emptyStar)
+ binding.rateStar4.setImageResource(emptyStar)
+ binding.rateStar5.setImageResource(emptyStar)
+ }
+ }
+ /*Toast.makeText(
+ this@ActivitySinglePost, "prosao zahtev", Toast.LENGTH_LONG
+ ).show()*/
}else{
if(response.errorBody()!=null)
Log.d("main1",response.errorBody().toString())
@@ -218,7 +307,7 @@ class ActivitySinglePost : AppCompatActivity() {
}
- override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
+ override fun onFailure(call: Call<RatingData?>, t: Throwable) {
Log.d("main2",t.message.toString())
}
})
@@ -228,13 +317,14 @@ class ActivitySinglePost : AppCompatActivity() {
binding.apply {
tvTitle.text= post.location.name
tvTitle.invalidate()
- tvLocationType.text="TODO"
+ tvLocationType.text="Otvorite Mapu"
+ tvLocationType.setTextColor(Color.BLUE)
tvLocationType.invalidate()
tvLocationParent.text="TODO"
tvLocationParent.invalidate()
tvRating.text=post.ratings.toString()
tvRating.invalidate()
- tvNumberOfRatings.text=post.ratings.toString()
+ tvNumberOfRatings.text=post.ratingscount.toString()
tvNumberOfRatings.invalidate()
tvDescription.text=post.description
tvDescription.invalidate()
@@ -258,6 +348,7 @@ class ActivitySinglePost : AppCompatActivity() {
}
fun translateOwnerIdToName(id:String) {
+ //binding.tvUser.text="proba"
var token= SharedPreferencesHelper.getValue("jwt", this).toString()
val api= RetrofitHelper.getInstance()
val request= api.getProfileFromId("Bearer " + token, id)
@@ -268,6 +359,7 @@ class ActivitySinglePost : AppCompatActivity() {
return
}
userData = response.body()!!
+
binding.tvUser.text= userData!!.username.toString()
}
@@ -276,5 +368,4 @@ class ActivitySinglePost : AppCompatActivity() {
}
})
}
-
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityUserProfile.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityUserProfile.kt
index 50c2b0e..61a5db1 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityUserProfile.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityUserProfile.kt
@@ -1,14 +1,26 @@
package com.example.brzodolokacije.Activities
+import android.annotation.SuppressLint
+import android.content.Intent
import android.os.Bundle
-import android.widget.ImageView
-import android.widget.TextView
+import android.util.Log
+import android.widget.*
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.isVisible
+import androidx.fragment.app.FragmentManager
+import androidx.fragment.app.FragmentTransaction
import com.bumptech.glide.Glide
+import com.example.brzodolokacije.Fragments.FragmentUserPostsProfileActivity
import com.example.brzodolokacije.Models.UserReceive
import com.example.brzodolokacije.R
+import com.example.brzodolokacije.R.*
import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.google.gson.Gson
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+
class ActivityUserProfile : AppCompatActivity() {
private lateinit var name:TextView
@@ -16,34 +28,228 @@ class ActivityUserProfile : AppCompatActivity() {
private lateinit var followersNumber:TextView
private lateinit var followingNumber:TextView
private lateinit var profilePicture:ImageView
+ private lateinit var followUser: Button
+ private lateinit var showUserPosts: Button
+ private lateinit var fragmentContainer: FrameLayout
+ private lateinit var userObject:UserReceive
+ private lateinit var openChat:ImageButton
+ private lateinit var unfollowUser:Button
+
+ private lateinit var showFollowers:Button
+ private lateinit var showFollowing:Button
+
+ private var follow:Boolean=false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_user_profile)
+ setContentView(layout.activity_user_profile)
+
+ name=findViewById(id.tvActivityUserProfileName)
+ postsNumber=findViewById(id.tvActivityUserProfilePostsNo)
+ followersNumber=findViewById(id.tvActivityUserProfileFollowersNo)
+ followingNumber=findViewById(id.tvActivityUserProfileFollowNo)
+ profilePicture=findViewById(id.tvActivityProfileProfilePicture)
+ followUser=findViewById(id.btnActivityUserProfileFollow)
+ unfollowUser=findViewById(id.btnActivityUserProfileUnFollow)
+ showUserPosts=findViewById(id.btnActivityUserProfileShowPosts)
+ fragmentContainer=findViewById(id.flActivityProfileFragmentContainer)
+ openChat=findViewById(id.activityUserProfileOpenChat)
+ showFollowing=findViewById(id.tvActivityUserProfileFollow)
+ showFollowers=findViewById(R.id.tvActivityUserProfileFollowers)
- name=findViewById(R.id.tvActivityUserProfileName)
- postsNumber=findViewById(R.id.tvActivityUserProfilePostsNo)
- followersNumber=findViewById(R.id.tvActivityUserProfileFollowersNo)
- followingNumber=findViewById(R.id.tvActivityUserProfileFollowNo)
- profilePicture=findViewById(R.id.tvActivityProfileProfilePicture)
val jsonMyObject: String
val extras = intent.extras
if (extras != null) {
jsonMyObject = extras.getString("user")!!
- val myObject: UserReceive = Gson().fromJson(jsonMyObject, UserReceive::class.java)
+ //val myObject: UserReceive = Gson().fromJson(jsonMyObject, UserReceive::class.java)
+
+ userObject= Gson().fromJson(jsonMyObject, UserReceive::class.java)
- name.text=myObject.name
- postsNumber.text=myObject.postNumber.toString()
- followersNumber.text="0"
- followingNumber.text="0"
+ name.text=userObject.name
+ postsNumber.text=userObject.postNumber.toString()
+ followersNumber.text=userObject?.followersCount.toString()
+ followingNumber.text=userObject?.followingCount.toString()
- if(myObject.pfp!=null) {
- Glide.with(this)
- .load(RetrofitHelper.baseUrl + "/api/post/image/" + myObject.pfp!!._id)
+ if(userObject.pfp!=null) {
+ Glide.with(this@ActivityUserProfile)
+ .load(RetrofitHelper.baseUrl + "/api/post/image/" + userObject.pfp!!._id)
.circleCrop()//Round image
.into(profilePicture)
}
}
+
+ checkIfAlreadyFollow()
+ updateUserData()
+
+ followUser.setOnClickListener{
+ val api = RetrofitHelper.getInstance()
+ val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile)
+ var data = api.addFollower("Bearer " + token, userObject._id);
+ data.enqueue(object : Callback<Boolean> {
+ override fun onResponse(
+ call: Call<Boolean>,
+ response: Response<Boolean>
+ ) {
+ unfollowUser.isVisible=true
+ unfollowUser.isClickable=true
+ unfollowUser.isEnabled=true
+ followUser.isVisible=false
+ followUser.isClickable=false
+ followUser.isEnabled=false
+
+ updateUserData()
+
+ Toast.makeText(
+ this@ActivityUserProfile, "PRATITE KORISNIKA", Toast.LENGTH_LONG
+ ).show();
+ }
+
+ override fun onFailure(call: Call<Boolean>, t: Throwable) {
+ Toast.makeText(
+ this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG
+ ).show();
+ }
+ })
+
+ }
+ unfollowUser.setOnClickListener {
+ val api = RetrofitHelper.getInstance()
+ val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile)
+ var data = api.unfollow("Bearer " + token, userObject._id);
+ data.enqueue(object : Callback<Boolean> {
+ override fun onResponse(
+ call: Call<Boolean>,
+ response: Response<Boolean>
+ ) {
+ unfollowUser.isVisible = false
+ unfollowUser.isClickable = false
+ unfollowUser.isEnabled = false
+ followUser.isVisible = true
+ followUser.isClickable = true
+ followUser.isEnabled = true
+ updateUserData()
+ Toast.makeText(
+ this@ActivityUserProfile, "VIŠE NE PRATITE KORISNIKA", Toast.LENGTH_LONG
+ ).show();
+ }
+
+ override fun onFailure(call: Call<Boolean>, t: Throwable) {
+ Toast.makeText(
+ this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG
+ ).show();
+ }
+ })
+ }
+ showFollowers.setOnClickListener {
+ val bundle = Bundle()
+ bundle.putString("userId", userObject._id.toString())
+ bundle.putString("show","followers")
+ val intent = Intent(this@ActivityUserProfile,ActivityShowFollowersAndFollowing::class.java)
+ intent.putExtras(bundle)
+ startActivity(intent)
+
+ }
+
+ showFollowing.setOnClickListener {
+ val bundle = Bundle()
+ bundle.putString("userId", userObject._id.toString())
+ bundle.putString("show","following")
+ val intent = Intent(this@ActivityUserProfile,ActivityShowFollowersAndFollowing::class.java)
+ intent.putExtras(bundle)
+ startActivity(intent)
+ }
+
+
+
+ showUserPosts.setOnClickListener {
+ var fm: FragmentTransaction =supportFragmentManager.beginTransaction()
+ val fragment = FragmentUserPostsProfileActivity()
+ val b = Bundle()
+ b.putString("userId", userObject._id.toString())
+ fragment.arguments = b
+ fm.replace(R.id.flActivityProfileFragmentContainer, fragment)
+ fm.commit()
+ }
+ }
+
+ fun checkIfAlreadyFollow(){
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile)
+ var data=api.checkIfAlreadyFollow("Bearer "+token,userObject._id);
+ data.enqueue(object : Callback<Boolean> {
+
+ override fun onFailure(call: Call<Boolean>, t: Throwable) {;
+ Log.d("fail","faillllllllllllllllllllllllllllllllllllllllllllllllllllllll")
+ Log.d("fail",t.toString())
+ }
+
+ @SuppressLint("ResourceAsColor")
+ override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
+ Log.d("success","successsssssssssssssssssss")
+ if (response.body() == null) {
+ return
+ }
+ var follow = response.body()!!
+ if(follow){
+
+ Log.d("success","follow")
+ /*followUser.setCompoundDrawablesWithIntrinsicBounds(drawable.ic_outline_person_remove_24,0,0,0)
+ followUser.text="Ne prati više"
+ follow=false
+ */
+ unfollowUser.isVisible=true
+ unfollowUser.isClickable=true
+ unfollowUser.isEnabled=true
+ followUser.isVisible=false
+ followUser.isClickable=false
+ followUser.isEnabled=false
+ }
+ else{
+ Log.d("success","not follow")
+ /*followUser.setCompoundDrawablesWithIntrinsicBounds(drawable.ic_outline_person_add_alt_24,0,0,0)
+ followUser.text="Prati"
+ follow=true
+ */
+
+ unfollowUser.isVisible=false
+ unfollowUser.isClickable=false
+ unfollowUser.isEnabled=false
+ followUser.isVisible=true
+ followUser.isClickable=true
+ followUser.isEnabled=true
+
+
+ }
+
+ }
+ })
+
+ }
+
+ fun updateUserData(){
+ val api = RetrofitHelper.getInstance()
+ val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile)
+ var data = api.getProfileFromId("Bearer " + token, userObject._id);
+ data.enqueue(object : Callback<UserReceive> {
+ override fun onResponse(
+ call: Call<UserReceive>,
+ response: Response<UserReceive>
+ ) {
+ var userData=response.body()!!
+
+ name.text=userData.name
+ postsNumber.text=userData.postNumber.toString()
+ followersNumber.text=userData.followersCount.toString()
+ followingNumber.text=userData.followingCount.toString()
+ }
+
+ override fun onFailure(call: Call<UserReceive>, t: Throwable) {
+ Toast.makeText(
+ this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG
+ ).show();
+ }
+ })
}
+
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivity.kt
index e99142a..951cbb4 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivity.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivity.kt
@@ -21,6 +21,7 @@ import com.example.brzodolokacije.chat.SignalRListener
import com.example.brzodolokacije.databinding.ActivityChatBinding
import retrofit2.Call
import retrofit2.Response
+import java.util.*
class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener {
@@ -32,6 +33,7 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener {
var layoutVar:LinearLayoutManager?=null
var items:MutableList<ChatPreview>?= mutableListOf()
private var swipeRefreshLayout: SwipeRefreshLayout?=null
+ var clickedChat:ChatActivityConversation?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -82,9 +84,11 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener {
if(!messages.isNullOrEmpty()){
var dbHelper= DBHelper.getInstance(this@ChatActivity)
for( message in messages){
+ var cal: Calendar = Calendar.getInstance()
+ cal.time=message.timestamp
dbHelper.addMessage(
Message(message.senderId+message.timestamp,message.senderId,
- JWT(SharedPreferencesHelper.getValue("jwt",this@ChatActivity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp),false)
+ JWT(SharedPreferencesHelper.getValue("jwt",this@ChatActivity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp,cal),false)
}
}
requestForChats()
@@ -117,6 +121,10 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener {
swipeRefreshLayout?.isRefreshing=false
}
+ fun setClickedActivity(activity:ChatActivityConversation){
+ clickedChat=activity
+ }
+
override fun onRefresh() {
requestNewMessages()
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivityConversation.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivityConversation.kt
index 4bd72bc..19fd836 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivityConversation.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ChatActivityConversation.kt
@@ -20,8 +20,11 @@ import com.example.brzodolokacije.Services.RetrofitHelper
import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.example.brzodolokacije.chat.SignalRListener
import com.example.brzodolokacije.databinding.ActivityChatConversationBinding
+import kotlinx.coroutines.MainScope
+import kotlinx.coroutines.launch
import retrofit2.Call
import retrofit2.Response
+import java.util.*
class ChatActivityConversation : AppCompatActivity() {
@@ -46,6 +49,7 @@ class ChatActivityConversation : AppCompatActivity() {
setRecyclerView()
requestMessages()
webSocketConnection=SignalRListener.getInstance(this@ChatActivityConversation)
+ (webSocketConnection!!.activity as ChatActivity).setClickedActivity(this@ChatActivityConversation)
setListeners()
}
@@ -53,7 +57,6 @@ class ChatActivityConversation : AppCompatActivity() {
findViewById<ImageButton>(R.id.btnSendMessage).setOnClickListener {
var token=SharedPreferencesHelper.getValue("jwt",this@ChatActivityConversation)
var messageContent=findViewById<EditText>(R.id.etNewMessage).text.toString()
- Log.d("main",token!!)
val Api= RetrofitHelper.getInstance()
if(userId.isNullOrEmpty() || userId.equals("null")){
//zahtev sa username=om
@@ -76,6 +79,9 @@ class ChatActivityConversation : AppCompatActivity() {
if(response.isSuccessful()){
//zahtev da se posalje poruka
var responseMessage=response.body()
+ var cal: Calendar = Calendar.getInstance()
+ cal.time=responseMessage?.timestamp
+ responseMessage?.usableTimeStamp=cal
dbConnection?.addMessage(responseMessage!!)
requestMessages()
binding.etNewMessage.text?.clear()
@@ -113,6 +119,9 @@ class ChatActivityConversation : AppCompatActivity() {
if(response.isSuccessful()){
//zahtev da se posalje poruka
var responseMessage=response.body()
+ var cal: Calendar = Calendar.getInstance()
+ cal.time=responseMessage?.timestamp
+ responseMessage?.usableTimeStamp=cal
dbConnection?.addMessage(responseMessage!!)
requestMessages()
binding.etNewMessage.text?.clear()
@@ -150,15 +159,22 @@ class ChatActivityConversation : AppCompatActivity() {
}
}
fun setRecyclerView(setParams:Boolean=true){
- if(setParams){
- adapterVar= items?.let { ChatMessagesAdapter(it,this@ChatActivityConversation) }
- layoutVar= LinearLayoutManager(this@ChatActivityConversation)
+ MainScope().launch {
+ if (setParams) {
+ adapterVar = items?.let { ChatMessagesAdapter(it, this@ChatActivityConversation) }
+ layoutVar = LinearLayoutManager(this@ChatActivityConversation)
+ }
+ recyclerView = binding.rvMain
+ recyclerView?.setHasFixedSize(true)
+ recyclerView?.layoutManager = layoutVar
+ try {
+ recyclerView?.adapter = adapterVar
+
+ } catch (e: Exception) {
+ Log.d("error", e.message!!)
+ }
+ recyclerView?.scrollToPosition(items?.size?.minus(1) ?: 0)
}
- recyclerView = binding.rvMain
- recyclerView?.setHasFixedSize(true)
- recyclerView?.layoutManager=layoutVar
- recyclerView?.adapter=adapterVar
- recyclerView?.scrollToPosition(items?.size?.minus(1) ?: 0)
}
fun requestMessages(){
@@ -170,6 +186,6 @@ class ChatActivityConversation : AppCompatActivity() {
}
adapterVar= items?.let { ChatMessagesAdapter(it,this@ChatActivityConversation) }
setRecyclerView(setParams = false)
-
+ dbConnection?.readContact(userId!!)
}
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt
index 1ff07f6..238c7e8 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt
@@ -1,8 +1,11 @@
package com.example.brzodolokacije.Activities
import android.Manifest
+import android.app.AlertDialog
import android.content.Context
+import android.content.DialogInterface
import android.content.pm.PackageManager
+import android.graphics.Color
import android.location.Location
import android.location.LocationManager
import android.os.Build
@@ -15,23 +18,28 @@ import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
-import android.widget.TextView
-import android.widget.Toast
+import android.widget.*
+import android.widget.AdapterView.OnItemClickListener
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
+import androidx.core.widget.addTextChangedListener
+import com.example.brzodolokacije.Models.LocationType
+import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.GeocoderHelper
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.google.android.gms.location.*
import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.FloatingActionButton
-import com.google.android.material.textfield.TextInputEditText
import org.osmdroid.config.Configuration
import org.osmdroid.tileprovider.tilesource.TileSourceFactory
import org.osmdroid.util.GeoPoint
import org.osmdroid.views.MapView
import org.osmdroid.views.Projection
import org.osmdroid.views.overlay.ItemizedIconOverlay
+import org.osmdroid.views.overlay.Marker
import org.osmdroid.views.overlay.Overlay
import org.osmdroid.views.overlay.OverlayItem
import org.osmdroid.views.overlay.ScaleBarOverlay
@@ -40,6 +48,10 @@ import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider
import org.osmdroid.views.overlay.gestures.RotationGestureOverlay
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
+import retrofit2.Call
+import retrofit2.Response
+import java.util.*
+import kotlin.collections.ArrayList
class MapsActivity : AppCompatActivity() {
@@ -52,10 +64,12 @@ class MapsActivity : AppCompatActivity() {
private lateinit var searchButton: MaterialButton
private lateinit var gpsButton: FloatingActionButton
private lateinit var confirmButton: FloatingActionButton
- private lateinit var searchBar: TextInputEditText
+ private lateinit var searchBar: AutoCompleteTextView
var client: FusedLocationProviderClient? = null
var locLongitude:Double?=null
var locLatitude:Double?=null
+ var selectedLocation:com.example.brzodolokacije.Models.Location?=null
+ var responseLocations:MutableList<com.example.brzodolokacije.Models.Location>?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maps)
@@ -68,7 +82,7 @@ class MapsActivity : AppCompatActivity() {
searchButton=findViewById<View>(R.id.ActivityMapsSearchButton) as MaterialButton
gpsButton=findViewById<View>(R.id.ActivityMapsMyLocation) as FloatingActionButton
confirmButton=findViewById<View>(R.id.ActivityMapsConfirmLocation) as FloatingActionButton
- searchBar=findViewById<View>(R.id.ActivityMapsSearchBar) as TextInputEditText
+ searchBar=findViewById<View>(R.id.ActivityMapsSearchBar) as AutoCompleteTextView
client= LocationServices.getFusedLocationProviderClient(this)
searchButton.setOnClickListener{
searchMap()
@@ -78,8 +92,12 @@ class MapsActivity : AppCompatActivity() {
getLocation()
}
confirmButton.setOnClickListener{
- if(locLatitude!=null && locLatitude!=null)
+ if(selectedLocation!=null)
returnValue()
+ else{
+ addLocation()
+
+ }
}
searchBar.setOnKeyListener(View.OnKeyListener { v1, keyCode, event -> // If the event is a key-down event on the "enter" button
if (event.action === KeyEvent.ACTION_DOWN &&
@@ -91,6 +109,9 @@ class MapsActivity : AppCompatActivity() {
}
false
})
+ searchBar.addTextChangedListener{
+ onTextEnter()
+ }
val extras = intent.extras
if (extras != null) {
val value = extras.getString("search")
@@ -98,22 +119,171 @@ class MapsActivity : AppCompatActivity() {
searchBar.setText(value,TextView.BufferType.EDITABLE)
searchMap()
}
+ setUpSpinner()
+
+
+
+ }
+ fun addLocation(){
+ var editText=EditText(this)
+ var dialog=AlertDialog.Builder(this).setTitle("Naziv").setMessage("Unesite naziv")
+ .setView(editText)
+ dialog.setPositiveButton("Dodaj") { dialog, which ->
+ uploadLocation(editText.text.toString())
+ }
+ dialog.setNegativeButton("Prekini") { dialog, which ->
+
+ }
+ dialog.show()
+
+ }
+ fun uploadLocation(locationName:String){
+ val api =RetrofitHelper.getInstance()
+ var geocoder=GeocoderHelper.getInstance()
+ var loc1=geocoder!!.getFromLocation(locLatitude!!,locLongitude!!,1)
+ if(loc1==null ||loc1.size<=0)
+ {
+ return
+ }
+ var countryName=loc1[0].countryName
+ var address="todo not possible in query"
+ var city="its null"
+ if(loc1[0].adminArea!=null)
+ city=loc1[0].adminArea//not possible
+ var loc: com.example.brzodolokacije.Models.Location =
+ com.example.brzodolokacije.Models.Location(
+ "",
+ locationName,
+ city,
+ countryName,
+ address,
+ locLatitude!!,
+ locLongitude!!,
+ LocationType.GRAD
+ )
+ var jwtString= SharedPreferencesHelper.getValue("jwt",this)
+ var data=api.addLocation("Bearer "+jwtString,loc)
+
+ data.enqueue(object : retrofit2.Callback<com.example.brzodolokacije.Models.Location?> {
+ override fun onResponse(call: Call<com.example.brzodolokacije.Models.Location?>, response: Response<com.example.brzodolokacije.Models.Location?>) {
+ if(response.isSuccessful()){
+ selectedLocation=response.body()
+ returnValue()
+
+ }else {
+
+ if (response.errorBody() != null) {
+ Log.d("Main",response.errorBody()!!.string())
+ Log.d("Main",response.message())
+ }
+ Log.d("Main",response.errorBody()!!.string())
+ Log.d("Main",response.message())
+ }
+
+
+ }
+ override fun onFailure(call: Call<com.example.brzodolokacije.Models.Location?>, t: Throwable) {
+ Toast.makeText(
+ applicationContext, t.toString(), Toast.LENGTH_LONG
+ ).show();
+ Log.d("Main",t.toString())
+ }
+ })
+ }
+ var arraySpinner :MutableList<String>?=null
+ var spinnerAdapter: ArrayAdapter<String>?=null
+
+ fun setUpSpinner() {
+ arraySpinner=mutableListOf<String>()
+ spinnerAdapter= ArrayAdapter<String>(
+ this,
+ android.R.layout.simple_list_item_1, arraySpinner!!)
+ searchBar.threshold=1
+ searchBar.setAdapter(spinnerAdapter)
+ searchBar.setOnItemClickListener(OnItemClickListener { parent, view, position, id ->
+ val selected = parent.getItemAtPosition(position) as String
+ selectedLocation=responseLocations!!.find { location -> location.name==selected }
+ Log.d("main",selectedLocation.toString())
+ confirmButton.visibility=View.VISIBLE
+ val locGeopoint=GeoPoint(selectedLocation!!.latitude,selectedLocation!!.longitude)
+ map!!.controller.animateTo(locGeopoint)
+ val marker = ContextCompat.getDrawable(this@MapsActivity, R.drawable.ic_baseline_add_location_24);
+ locLatitude=selectedLocation!!.latitude
+ locLongitude=selectedLocation!!.longitude
+
+
+ val overlayArray = ArrayList<OverlayItem>()
+ val mapItem = OverlayItem(
+ "", "", locGeopoint
+ )
+ mapItem.setMarker(marker)
+ overlayArray.add(mapItem)
+ if (anotherItemizedIconOverlay == null) {
+ anotherItemizedIconOverlay =
+ ItemizedIconOverlay(applicationContext, overlayArray, null)
+ map!!.overlays.add(anotherItemizedIconOverlay)
+ map!!.invalidate()
+ } else {
+ map!!.overlays.remove(anotherItemizedIconOverlay)
+ map!!.invalidate()
+ anotherItemizedIconOverlay =
+ ItemizedIconOverlay(applicationContext, overlayArray, null)
+ map!!.overlays.add(anotherItemizedIconOverlay)
+ }
+
+ })
}
+ var anotherItemizedIconOverlay: ItemizedIconOverlay<OverlayItem>? = null
fun returnValue(){
val intent = intent
val bundle = Bundle()
- bundle.putDouble("longitude", locLongitude!!)
- bundle.putDouble("latitude", locLatitude!!)
- if(searchBar.text!=null && !searchBar.text.toString().equals(""))
- bundle.putString("name", searchBar.text.toString())
+ if(selectedLocation==null)
+ return
+ if(selectedLocation!!.latitude!=locLatitude || selectedLocation!!.longitude!=locLongitude)
+ {
+ addLocation()
+ return
+ }
+ bundle.putString("locationId",selectedLocation!!._id)
+ bundle.putString("name",selectedLocation!!.name)
intent.putExtras(bundle)
setResult(RESULT_OK, intent)
finish()
}
+ fun onTextEnter(){
+ var api=RetrofitHelper.getInstance()
+ var jwtString= SharedPreferencesHelper.getValue("jwt",this)
+ var text=searchBar.text
+ if(text==null ||text.toString().trim()=="")
+ return
+ var data=api.searchLocationsQuery("Bearer "+jwtString,text.toString())
+ data.enqueue(object : retrofit2.Callback<MutableList<com.example.brzodolokacije.Models.Location>> {
+ override fun onResponse(call: Call<MutableList<com.example.brzodolokacije.Models.Location>?>, response: Response<MutableList<com.example.brzodolokacije.Models.Location>>) {
+ if(response.isSuccessful){
+ var existingLocation=responseLocations
+ responseLocations=response.body()!!
+ var tempList=mutableListOf<String>()
+ if(existingLocation!=null && existingLocation.size>0)
+ for(loc in existingLocation!!){
+ spinnerAdapter!!.remove(loc.name)
+ }
+ for(loc in responseLocations!!){
+ spinnerAdapter!!.add(loc.name)
+ }
+ spinnerAdapter!!.notifyDataSetChanged()
+ }
+ }
+ override fun onFailure(call: Call<MutableList<com.example.brzodolokacije.Models.Location>>, t: Throwable) {
+
+ }
+ })
+
+
+ }
override fun onResume() {
super.onResume()
map!!.onResume()
@@ -160,7 +330,7 @@ class MapsActivity : AppCompatActivity() {
val touchOverlay: Overlay = object : Overlay(this) {
- var anotherItemizedIconOverlay: ItemizedIconOverlay<OverlayItem>? = null
+
override fun onSingleTapConfirmed(e: MotionEvent, mapView: MapView): Boolean {
val marker = ContextCompat.getDrawable(this@MapsActivity, R.drawable.ic_baseline_add_location_24);
val proj: Projection = mapView.projection
@@ -224,6 +394,7 @@ class MapsActivity : AppCompatActivity() {
}
}
fun searchMap(){
+
var geocoder= GeocoderHelper.getInstance()
//Log.d("Main",geocoder!!.getFromLocationName("Paris",1)[0].countryName)
var locString=searchBar.text.toString().trim()
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt
index 45ffbf0..403b736 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt
@@ -2,6 +2,7 @@ package com.example.brzodolokacije.Adapters
import android.app.Activity
import android.view.LayoutInflater
+import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.auth0.android.jwt.JWT
@@ -9,6 +10,7 @@ import com.example.brzodolokacije.Models.Message
import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.example.brzodolokacije.databinding.ChatMessageBinding
import com.example.brzodolokacije.databinding.ChatMessageOtherBinding
+import java.util.*
class ChatMessagesAdapter (val items : MutableList<Message>, val activity:Activity)
: RecyclerView.Adapter<RecyclerView.ViewHolder>(){
@@ -49,6 +51,17 @@ class ChatMessagesAdapter (val items : MutableList<Message>, val activity:Activi
fun bind(item : Message){
bindingOther?.apply {
tvMessage?.text=item.messagge
+ tvTimestamp.text=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY).toString() + ":" + item.usableTimeStamp.get(Calendar.MINUTE).toString()
+ if(layoutPosition==0 || isDifferentDays(items[layoutPosition].usableTimeStamp,items[layoutPosition-1].usableTimeStamp)){
+
+ tvDate.text=item.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+
+ (item.usableTimeStamp.get(Calendar.MONTH)+1).toString()+"/"+
+ item.usableTimeStamp.get(Calendar.YEAR).toString()
+ }
+ else{
+ tvDate.visibility= View.GONE
+ tvDate.forceLayout()
+ }
}
}
}
@@ -56,10 +69,31 @@ class ChatMessagesAdapter (val items : MutableList<Message>, val activity:Activi
fun bind(item : Message){
binding?.apply {
tvMessage.text=item.messagge
+ tvTimestamp.text=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY).toString() + ":" + item.usableTimeStamp.get(Calendar.MINUTE).toString()
+ if(layoutPosition==0 || isDifferentDays(items[layoutPosition].usableTimeStamp,items[layoutPosition-1].usableTimeStamp)){
+
+ tvDate.text=item.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+
+ (item.usableTimeStamp.get(Calendar.MONTH)+1).toString()+"/"+
+ item.usableTimeStamp.get(Calendar.YEAR).toString()
+ }
+ else{
+ tvDate.visibility= View.GONE
+ tvDate.forceLayout()
+ }
}
}
}
+ fun isDifferentDays(c1:Calendar,c2:Calendar):Boolean{
+ if(c1.get(Calendar.DAY_OF_YEAR)!=c2.get(Calendar.DAY_OF_YEAR)){
+ return true
+ }
+ else if(c1.get(Calendar.YEAR)!=c2.get(Calendar.YEAR)){
+ return true
+ }
+ return false
+ }
+
override fun getItemViewType(position: Int): Int {
var sender=items.get(position).senderId
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatPreviewsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatPreviewsAdapter.kt
index 94a72f3..6e62180 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatPreviewsAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatPreviewsAdapter.kt
@@ -1,12 +1,14 @@
package com.example.brzodolokacije.Adapters
-import android.app.Activity
import android.content.Intent
+import android.graphics.Typeface
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
+import com.exam.DBHelper
+import com.example.brzodolokacije.Activities.ChatActivity
import com.example.brzodolokacije.Activities.ChatActivityConversation
import com.example.brzodolokacije.Interfaces.IBackendApi
import com.example.brzodolokacije.Models.ChatPreview
@@ -18,13 +20,14 @@ import kotlinx.android.synthetic.main.chat_preview.view.*
import retrofit2.Call
import retrofit2.Response
-class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Activity)
+class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:ChatActivity)
: RecyclerView.Adapter<ChatPreviewsAdapter.ViewHolder>(){
//constructer has one argument - list of objects that need to be displayed
//it is bound to xml of single item
private var api: IBackendApi?=null
private var token:String?=null
private lateinit var binding: ChatPreviewBinding
+ private var db:DBHelper=DBHelper.getInstance(activity)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val inflater = LayoutInflater.from(parent.context)
binding=ChatPreviewBinding.inflate(inflater,parent,false)
@@ -39,6 +42,9 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Act
val intent: Intent = Intent(activity, ChatActivityConversation::class.java)
intent.putExtra("userId",items[position].userId)
intent.putExtra("username",holder.itemView.tvUsername.text)
+ db.readContact(items[position].userId)
+ items[position].read=true
+ holder.itemView.tvUsername.typeface= Typeface.DEFAULT
activity.startActivity(intent)
}
}
@@ -54,6 +60,8 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Act
if(response.isSuccessful()){
//zahtev da se posalje poruka
var user=response.body()!!
+ if(!item.read)
+ tvUsername.typeface= Typeface.DEFAULT_BOLD
tvUsername.text=user.username
if(user.pfp!=null) {
Glide.with(activity)
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt
index e439d0e..5381ebc 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt
@@ -33,10 +33,10 @@ class FollowersAdapter (var followers:MutableList<UserReceive>, val activity: Ac
inner class FollowerViewHolder(view: View): RecyclerView.ViewHolder(view){
private val name: TextView =view.findViewById(R.id.tvFollowerItemName)
- private val username:TextView=view.findViewById(R.id.tvFolloewItemUsername)
+ private val username:TextView=view.findViewById(R.id.tvFollowerItemUsername)
fun bindView(follower: UserReceive){
name.text=follower.name
- username.text=follower.username
+ username.text="@"+follower.username
}
}
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt
index 1b57e5b..e557e02 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt
@@ -49,10 +49,11 @@ class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview>
binding.apply {
tvTitle.text = item.location.name
tvLocationParent.text = item.location.country
- tvLocationType.text = "TODO"
+ tvPostPreviewRating.text=item.ratings.toString()
+ // tvLocationType.text = "TODO"
if(item.images.isNotEmpty()) {
Glide.with(activity)
- .load(RetrofitHelper.baseUrl + "/api/post/image/" + item.images[0]._id)
+ .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item.images[0]._id)
.into(locationImage)
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostHistoryAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostHistoryAdapter.kt
index db3fc2e..79f0af2 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostHistoryAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostHistoryAdapter.kt
@@ -13,6 +13,7 @@ import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.Services.RetrofitHelper
import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.example.brzodolokacije.databinding.SinglePostHistoryBinding
+import java.text.SimpleDateFormat
class PostHistoryAdapter (val activity:Activity,val items : MutableList<PostPreview>)
@@ -39,7 +40,7 @@ class PostHistoryAdapter (val activity:Activity,val items : MutableList<PostPrev
fun bind(item: PostPreview) {
binding.apply {
tvTitleSinglePostHistory.text = item.location.name
- tvLocationParentSinglePostHistory.text = "22.11.2022"
+ tvLocationParentSinglePostHistory.text = SimpleDateFormat("dd/MM/yyyy").format(item.lastViewed)
tvLocationTypeSinglePostHistory.text = item.location.country
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt
index 655b717..74bfd92 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt
@@ -33,7 +33,7 @@ class PostImageAdapter(val activity: Activity, val items : MutableList<PostImage
binding.apply {
if(item!=null) {
Glide.with(activity)
- .load(RetrofitHelper.baseUrl + "/api/post/image/" + item._id)
+ .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item._id)
.into(locationImage)
}
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt
index 0bd625f..8605246 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt
@@ -2,8 +2,6 @@ package com.example.brzodolokacije.Adapters
import android.app.Activity
import android.content.Intent
-import android.graphics.BitmapFactory
-import android.os.AsyncTask
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
@@ -13,18 +11,11 @@ import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.example.brzodolokacije.Activities.ActivitySinglePost
-import com.example.brzodolokacije.Activities.NavigationActivity
import com.example.brzodolokacije.Interfaces.IBackendApi
-import com.example.brzodolokacije.Models.LocationType
import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.Services.RetrofitHelper
import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.example.brzodolokacije.databinding.PostPreviewBinding
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.launch
-import okhttp3.ResponseBody
-import retrofit2.Call
-import retrofit2.Response
class ShowPostsAdapter (val activity:Activity,val items : MutableList<PostPreview>?=null)
@@ -77,10 +68,10 @@ class ShowPostsAdapter (val activity:Activity,val items : MutableList<PostPrevie
binding.apply {
tvTitle.text = item.location.name
tvLocationParent.text = item.location.country
- tvLocationType.text = "TODO"
+ //tvLocationType.text = "TODO"
if(item.images.isNotEmpty()) {
Glide.with(activity)
- .load(RetrofitHelper.baseUrl + "/api/post/image/" + item.images[0]._id)
+ .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item.images[0]._id)
.into(locationImage)
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt
index 3391355..5b6d0f2 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt
@@ -47,15 +47,20 @@ class ShowPostsHomePageAdapter(var postPreview:MutableList<PostPreview>,val acti
inner class PostViewHolder(view: View):RecyclerView.ViewHolder(view){
private val background:com.google.android.material.imageview.ShapeableImageView=view.findViewById(R.id.ivPIHPBackground)
private val locationName:TextView=view.findViewById(R.id.tvPIHPLocationName)
+ private val locationDetail:TextView=view.findViewById(R.id.tvPIHPLocationDetail)
+ private val rating:TextView=view.findViewById(R.id.tvPIHPRecension)
fun bindView(postPreview:PostPreview){
//background.setImageURI(postPreview.images[0]._id.to)
if(postPreview.images.isNotEmpty()) {
Glide.with(activity)
- .load(RetrofitHelper.baseUrl + "/api/post/image/" + postPreview.images[0]._id)
+ .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + postPreview.images[0]._id)
.into(background)
}
locationName.text=postPreview.location.name
+ rating.text=postPreview.ratings.toString()
+ locationDetail.text="Srbija, Kragujevac"
+
}
}
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt
index a21ffe0..57e1833 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt
@@ -2,6 +2,7 @@ package com.example.brzodolokacije.Fragments
import android.Manifest
import android.content.Context
+import android.content.Intent
import android.content.pm.PackageManager
import android.location.Location
import android.location.LocationManager
@@ -12,6 +13,7 @@ import android.os.StrictMode
import android.os.StrictMode.ThreadPolicy
import android.preference.PreferenceManager
import android.util.DisplayMetrics
+import android.util.Log
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
@@ -21,8 +23,12 @@ import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
+import com.example.brzodolokacije.Activities.ActivitySinglePost
+import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.GeocoderHelper
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
import com.google.android.gms.location.*
import com.google.android.material.button.MaterialButton
import com.google.android.material.floatingactionbutton.FloatingActionButton
@@ -32,12 +38,15 @@ import org.osmdroid.tileprovider.tilesource.TileSourceFactory
import org.osmdroid.util.GeoPoint
import org.osmdroid.views.MapView
import org.osmdroid.views.overlay.Marker
+import org.osmdroid.views.overlay.Marker.OnMarkerClickListener
import org.osmdroid.views.overlay.ScaleBarOverlay
import org.osmdroid.views.overlay.compass.CompassOverlay
import org.osmdroid.views.overlay.compass.InternalCompassOrientationProvider
import org.osmdroid.views.overlay.gestures.RotationGestureOverlay
import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider
import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay
+import retrofit2.Call
+import retrofit2.Response
class FragmentBrowse : Fragment(R.layout.fragment_browse) {
@@ -136,6 +145,8 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) {
CompassOverlay(context, InternalCompassOrientationProvider(context), map)
mCompassOverlay!!.enableCompass()
map!!.getOverlays().add(this.mCompassOverlay)
+
+ getMarkers()
}
fun checkLocPerm(){
if (ContextCompat.checkSelfPermission(
@@ -179,16 +190,62 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) {
else{
//move to spot
val searchPoint = GeoPoint(result.latitude,result.longitude)
- val startMarker = Marker(map)
- startMarker.setPosition(searchPoint)
- startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
- map!!.getOverlays().add(startMarker)
map!!.controller.animateTo(searchPoint)
}
}
}
+ private fun getMarkers(){
+ val startMarker = Marker(map)
+ var api=RetrofitHelper.getInstance()
+ var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity())
+ var data=api.getPosts("Bearer "+jwtString)
+
+ data.enqueue(object : retrofit2.Callback<MutableList<PostPreview>> {
+ override fun onResponse(call: Call<MutableList<PostPreview>>, response: Response<MutableList<PostPreview>>) {
+ if(response.isSuccessful()){
+ var postList=response.body()
+ if (postList != null) {
+ for(post in postList){
+ Log.d("main",post.toString())
+ val startMarker = Marker(map)
+ startMarker.setPosition(GeoPoint(post.location.latitude,post.location.longitude))
+ startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
+ startMarker.setOnMarkerClickListener(object:OnMarkerClickListener{
+ override fun onMarkerClick(
+ marker: Marker?,
+ mapView: MapView?
+ ): Boolean {
+ val intent: Intent = Intent(activity, ActivitySinglePost::class.java)
+ var b=Bundle()
+ b.putParcelable("selectedPost",post)
+ intent.putExtras(b)
+ requireActivity().startActivity(intent)
+ return true
+ }
+
+ })
+ map!!.getOverlays().add(startMarker)
+
+
+ }
+ }
+
+
+
+ }else {
+
+ }
+
+
+ }
+
+ override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
+ }
+ })
+
+ }
private fun getLocation() {
if (ContextCompat.checkSelfPermission(
requireActivity(),
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt
index f1d9321..767c192 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt
@@ -56,9 +56,10 @@ class FragmentFollowers : Fragment() {
return view
}
- fun getFollowers(){
+ fun getFollowers(){
val api = RetrofitHelper.getInstance()
- val data=api.getFollowers(userId)
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.getMyFollowers("Bearer "+token)
data.enqueue(object : Callback<MutableList<UserReceive>> {
override fun onResponse(
call: Call<MutableList<UserReceive>>,
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt
index b7a40dc..fe52723 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt
@@ -13,6 +13,7 @@ import com.example.brzodolokacije.Adapters.FollowersAdapter
import com.example.brzodolokacije.Models.UserReceive
import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@@ -52,7 +53,8 @@ class FragmentFollowing : Fragment() {
fun getFollowing(){
val api = RetrofitHelper.getInstance()
- val data=api.getFollowers(userId)
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.getMyFollowings("Bearer "+token)
data.enqueue(object : Callback<MutableList<UserReceive>> {
override fun onResponse(
call: Call<MutableList<UserReceive>>,
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePage.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePage.kt
index 1be978d..cb48d3e 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePage.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePage.kt
@@ -1,5 +1,6 @@
package com.example.brzodolokacije.Fragments
+import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@@ -14,6 +15,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
+import com.example.brzodolokacije.Activities.ChatActivity
import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter
import com.example.brzodolokacije.Interfaces.IBackendApi
import com.example.brzodolokacije.Models.LocationType
@@ -30,6 +32,7 @@ import retrofit2.converter.gson.GsonConverterFactory
class FragmentHomePage : Fragment() {
+ private lateinit var btnChat:ImageView
private lateinit var btnBack:ImageView
/* override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -43,6 +46,7 @@ class FragmentHomePage : Fragment() {
// Inflate the layout for this fragment
var view:View= inflater.inflate(R.layout.fragment_home_page, container, false)
btnBack=view.findViewById(R.id.btnFragmentHomePageBack)
+ btnChat=view.findViewById(R.id.ivFragmentHomePageChat)
setBtnBackInvisible()
var fm: FragmentTransaction =childFragmentManager.beginTransaction()
@@ -54,6 +58,10 @@ class FragmentHomePage : Fragment() {
setBtnBackInvisible()
}
+ btnChat.setOnClickListener {
+ val intent: Intent = Intent(activity, ChatActivity::class.java)
+ requireActivity().startActivity(intent)
+ }
return view
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePageMainScroll.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePageMainScroll.kt
index cf811df..46904d4 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePageMainScroll.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHomePageMainScroll.kt
@@ -4,8 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Button
import android.widget.ImageButton
+import android.widget.LinearLayout
import android.widget.Toast
+import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.recyclerview.widget.LinearLayoutManager
@@ -17,6 +20,7 @@ import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.RetrofitHelper
import com.example.brzodolokacije.Services.SharedPreferencesHelper
+import kotlinx.android.synthetic.main.fragment_home_page_main_scroll.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
@@ -42,9 +46,11 @@ class FragmentHomePageMainScroll : Fragment() {
private lateinit var location_amusement_park: ImageButton
private lateinit var location_attraction: ImageButton
private lateinit var location_landmark: ImageButton
-
+private lateinit var change:Button
private lateinit var filter: LocationType
private lateinit var filterString: String
+ private lateinit var ll1: LinearLayout
+ private lateinit var ll2:LinearLayout
override fun onCreateView(
@@ -59,7 +65,9 @@ class FragmentHomePageMainScroll : Fragment() {
rvPopular=view.findViewById(R.id.rvFragmentHomePagePopular)
rvNewest=view.findViewById(R.id.rvFragmentHomePageNewest)
rvBestRated=view.findViewById(R.id.rvFragmentHomePageBestRated)
-
+ //change=view.findViewById(R.id.change)
+ ll1=view.findViewById(R.id.ll1)
+ ll2=view.findViewById(R.id.ll2)
location_amusement_park=view.findViewById(R.id.btnFragmentHomePagelocation_amusement_park)
location_attraction=view.findViewById(R.id.btnFragmentHomePagelocation_attraction)
location_beach=view.findViewById(R.id.btnFragmentHomePagelocation_beach)
@@ -174,13 +182,21 @@ class FragmentHomePageMainScroll : Fragment() {
parentFrag.setBtnBackVisible()
}
+ /* ll1.isVisible=true
+ ll2.isVisible=false
+ change.setOnClickListener {
+ ll1.isVisible=true
+ ll2.isVisible=false
+ }
-
-
+*/
return view
}
private fun getAllPosts(){
+ Toast.makeText(
+ activity," get all", Toast.LENGTH_LONG
+ ).show();
val api = Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(RetrofitHelper.baseUrl)
@@ -206,9 +222,9 @@ class FragmentHomePageMainScroll : Fragment() {
// activity, "get all ", Toast.LENGTH_LONG
// ).show();
posts = response.body()!!.toMutableList<PostPreview>()
- getPopularPosts(posts)
- getNewestPosts(posts)
- getBestRatedPosts(posts)
+ getPopularPosts()
+ getNewestPosts()
+ getBestRatedPosts()
}
override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
@@ -219,41 +235,101 @@ class FragmentHomePageMainScroll : Fragment() {
})
}
- private fun getPopularPosts(allPosts:MutableList<PostPreview>){//most viewed
+ private fun getPopularPosts(){//most viewed
// Toast.makeText(
// activity, "get all mv ", Toast.LENGTH_LONG
// ).show();
- mostViewedPosts=allPosts
- mostViewedPosts.sortByDescending { it.views }
- rvPopular.apply {
- layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
- adapter= ShowPostsHomePageAdapter(mostViewedPosts,requireActivity())
+ Toast.makeText(
+ activity," get popular all", Toast.LENGTH_LONG
+ ).show();
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.get10MostViewed("Bearer "+token)
+
+ data.enqueue(object : Callback<MutableList<PostPreview>> {
+ override fun onResponse(
+ call: Call<MutableList<PostPreview>>,
+ response: Response<MutableList<PostPreview>>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ var mostpopular = response.body()!!.toMutableList<PostPreview>()
+ rvPopular.apply {
+ layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
+ adapter= ShowPostsHomePageAdapter(mostpopular,requireActivity())
+
+ }
+ }
+ override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
+
+ }
+ })
- }
}
- private fun getNewestPosts(allPosts:MutableList<PostPreview>){
+ private fun getNewestPosts(){
// Toast.makeText(
// activity, "get all r ", Toast.LENGTH_LONG
// ).show();
- newestPosts=allPosts/// izmeniti nakon dodavanja datuma u model!!!!!!
- newestPosts.sortBy { it.ratings}
- rvNewest.apply {
- layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
- adapter= ShowPostsHomePageAdapter(newestPosts,requireActivity())
- }
+ Toast.makeText(
+ activity," get all newest", Toast.LENGTH_LONG
+ ).show();
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.get10Newest("Bearer "+token)
+
+ data.enqueue(object : Callback<MutableList<PostPreview>> {
+ override fun onResponse(
+ call: Call<MutableList<PostPreview>>,
+ response: Response<MutableList<PostPreview>>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ var newestposts = response.body()!!.toMutableList<PostPreview>()
+ rvNewest.apply {
+ layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
+ adapter= ShowPostsHomePageAdapter(newestposts,requireActivity())
+ }
+ }
+ override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
+
+ }
+ })
+
}
- private fun getBestRatedPosts(allPosts:MutableList<PostPreview>){
+ private fun getBestRatedPosts(){
// Toast.makeText(
// activity, "get all br ", Toast.LENGTH_LONG
// ).show();
- bestRatedPosts=allPosts
- bestRatedPosts.sortByDescending { it.ratings }
- rvBestRated.apply {
- layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
- adapter= ShowPostsHomePageAdapter(bestRatedPosts,requireActivity())
- }
+ Toast.makeText(
+ activity," get all best", Toast.LENGTH_LONG
+ ).show();
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.get10Best("Bearer "+token)
+
+ data.enqueue(object : Callback<MutableList<PostPreview>> {
+ override fun onResponse(
+ call: Call<MutableList<PostPreview>>,
+ response: Response<MutableList<PostPreview>>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ var bestposts = response.body()!!.toMutableList<PostPreview>()
+ rvBestRated.apply {
+ layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
+ adapter= ShowPostsHomePageAdapter(bestposts,requireActivity())
+ }
+ }
+ override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
+
+ }
+ })
+
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt
index 928a128..9cce17f 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt
@@ -2,11 +2,12 @@ package com.example.brzodolokacije.Fragments
import android.content.Intent
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
+import androidx.fragment.app.Fragment
+import com.exam.DBHelper
import com.example.brzodolokacije.Activities.ActivityLoginRegister
import com.example.brzodolokacije.R
import com.example.brzodolokacije.Services.SharedPreferencesHelper
@@ -55,6 +56,7 @@ class FragmentMyProfileInfo : Fragment() {
fun logOut(){
if(SharedPreferencesHelper.removeValue("jwt",requireActivity()))
{
+ DBHelper.getInstance(requireActivity()).deleteDB();
val intent= Intent(requireActivity(), ActivityLoginRegister::class.java)
startActivity(intent)
requireActivity().finish()
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt
index 7c6d998..669b978 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt
@@ -214,8 +214,8 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr
username.setText("@"+user.username)
postsCount.setText(user.postcount.toString())
- followersCount.setText("to do")
- followingCount.setText("to do")
+ followersCount.setText(user.followersCount.toString())
+ followingCount.setText(user.followingCount.toString())
userId=user._id
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserProfile.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowUserPosts.kt
index 2635adb..6afd619 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserProfile.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowUserPosts.kt
@@ -1,26 +1,28 @@
package com.example.brzodolokacije.Fragments
+import android.content.Intent.getIntent
import android.os.Bundle
-import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import com.example.brzodolokacije.R
+import androidx.fragment.app.Fragment
+import com.example.brzodolokacije.Models.UserReceive
+import com.google.gson.Gson
-class FragmentUserProfile : Fragment() {
+
+class FragmentShowUserPosts : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
-
- val view= inflater.inflate(R.layout.fragment_user_profile, container, false)
-
-
+ // Inflate the layout for this fragment
+ var view=inflater.inflate(com.example.brzodolokacije.R.layout.fragment_show_user_posts, container, false)
return view
}
+
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowers.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowers.kt
new file mode 100644
index 0000000..09920dc
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowers.kt
@@ -0,0 +1,71 @@
+package com.example.brzodolokacije.Fragments
+
+import android.os.Bundle
+import android.util.Log
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.example.brzodolokacije.Adapters.FollowersAdapter
+import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter
+import com.example.brzodolokacije.Models.PostPreview
+import com.example.brzodolokacije.Models.UserReceive
+import com.example.brzodolokacije.R
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+
+class FragmentUserFollowers : Fragment() {
+
+ private lateinit var followers:MutableList<UserReceive>
+ private lateinit var rvFollowers:RecyclerView
+ private lateinit var userId:String
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ var view=inflater.inflate(R.layout.fragment_user_followers, container, false)
+
+ val bundle = arguments
+ userId = bundle!!.getString("userId").toString()
+
+ rvFollowers=view.findViewById(R.id.rvFragmentUserFollowers)
+
+ getFollowers()
+
+ return view
+ }
+
+ fun getFollowers(){
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.getFollowers("Bearer "+token,userId)
+
+ data.enqueue(object : Callback<MutableList<UserReceive>> {
+
+ override fun onResponse(
+ call: Call<MutableList<UserReceive>>,
+ response: Response<MutableList<UserReceive>>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ followers = response.body()!!.toMutableList<UserReceive>()
+ rvFollowers.apply {
+ layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
+ adapter= FollowersAdapter(followers,requireActivity())
+
+ }
+ }
+ override fun onFailure(call: Call<MutableList<UserReceive>>, t: Throwable) {
+ Log.d("Followers","Faillllllllllllllllllllllllll")
+ Log.d("Followers",t.toString())
+ }
+ })
+ }
+} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowing.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowing.kt
new file mode 100644
index 0000000..0f6323f
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserFollowing.kt
@@ -0,0 +1,65 @@
+package com.example.brzodolokacije.Fragments
+
+import android.os.Bundle
+import android.util.Log
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.example.brzodolokacije.Adapters.FollowersAdapter
+import com.example.brzodolokacije.Models.UserReceive
+import com.example.brzodolokacije.R
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+
+
+class FragmentUserFollowing : Fragment() {
+
+ private lateinit var following:MutableList<UserReceive>
+ private lateinit var rvFollowing: RecyclerView
+ private lateinit var userId:String
+
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ var view=inflater.inflate(R.layout.fragment_user_following, container, false)
+ val bundle = arguments
+ userId = bundle!!.getString("userId").toString()
+ rvFollowing=view.findViewById(R.id.rvFragmentUserFollowing)
+
+ getFollowing()
+
+ return view
+ }
+
+ fun getFollowing(){
+ val api = RetrofitHelper.getInstance()
+ val token= SharedPreferencesHelper.getValue("jwt", requireActivity())
+ val data=api.getFollowing("Bearer "+token,userId)
+ data.enqueue(object : Callback<MutableList<UserReceive>> {
+ override fun onResponse(call: Call<MutableList<UserReceive>>, response: Response<MutableList<UserReceive>>) {
+ if (response.body() == null) {
+ return
+ }
+ Log.d("Following","Sucesssssssssssssssssssssssssssssss")
+ following = response.body()!!.toMutableList<UserReceive>()
+ rvFollowing.apply {
+ layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false)
+ adapter= FollowersAdapter(following,requireActivity())
+ }
+ }
+ override fun onFailure(call: Call<MutableList<UserReceive>>, t: Throwable) {
+ Log.d("Following","Faillllllllllllllllllllllllll")
+ }
+ })
+ }
+
+} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPostsProfileActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPostsProfileActivity.kt
new file mode 100644
index 0000000..9a051e5
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPostsProfileActivity.kt
@@ -0,0 +1,64 @@
+package com.example.brzodolokacije.Fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.example.brzodolokacije.Adapters.MyPostsAdapter
+import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter
+import com.example.brzodolokacije.Models.PostPreview
+import com.example.brzodolokacije.R
+import com.example.brzodolokacije.Services.RetrofitHelper
+import com.example.brzodolokacije.Services.SharedPreferencesHelper
+import retrofit2.Call
+import retrofit2.Callback
+import retrofit2.Response
+
+
+class FragmentUserPostsProfileActivity : Fragment() {
+ private lateinit var recyclerView: RecyclerView
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ // Inflate the layout for this fragment
+ var view =inflater.inflate(R.layout.fragment_user_posts_profile_activity, container, false)
+
+ recyclerView=view.findViewById(R.id.rvFragmentUserPostsProfileActivity)
+
+ val bundle = arguments
+ val userId = bundle!!.getString("userId")
+
+ val api = RetrofitHelper.getInstance()
+ val token = SharedPreferencesHelper.getValue("jwt", requireActivity())
+ var data = api.getUsersPosts("Bearer " + token, userId!!);
+ data.enqueue(object : Callback<MutableList<PostPreview>> {
+ override fun onResponse(
+ call: Call<MutableList<PostPreview>>,
+ response: Response<MutableList<PostPreview>>
+ ) {
+ if (response.body() == null) {
+ return
+ }
+ var posts = response.body()!!.toMutableList<PostPreview>()
+ recyclerView.apply {
+ layoutManager= GridLayoutManager(requireContext(),2,
+ GridLayoutManager.VERTICAL,false)
+ adapter= MyPostsAdapter(requireActivity(),posts)
+ }
+ }
+
+ override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) {
+ }
+ })
+
+
+ return view
+ }
+
+
+} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IBackendApi.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IBackendApi.kt
index cb51627..676023f 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IBackendApi.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IBackendApi.kt
@@ -38,9 +38,9 @@ interface IBackendApi {
,@Part("tags") tags:RequestBody
):Call<PostPreview>
@POST("api/Post/posts/{id}/addrating")
- fun addRating(@Header("Authorization") authHeader:String,@Path("id") id:String,@Body rating: RatingReceive):Call<ResponseBody>
+ fun addRating(@Header("Authorization") authHeader:String,@Path("id") id:String,@Body rating: RatingReceive):Call<RatingData>
@POST("api/Post/posts/{id}/addcomment")
- fun addComment(@Header("Authorization") authHeader:String,@Path("id") id:String,@Body rating: CommentReceive):Call<ResponseBody>
+ fun addComment(@Header("Authorization") authHeader:String,@Path("id") id:String,@Body rating: CommentReceive):Call<CommentSend>
@GET("api/Post/posts/{id}/listcomments")
fun getComments(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<MutableList<CommentSend>>
@@ -72,15 +72,42 @@ interface IBackendApi {
//@POST("putanja")
//fun add(@Body obj:Post,@Header("Authorization") authHeader:String):Call<Post>
- @POST("/api/user/{id}/followers")
- fun getFollowers(@Path("id") id:String):Call <MutableList<UserReceive>>
+ @GET("/api/user/{id}/followers")
+ fun getFollowers(@Header("Authorization") authHeader:String,@Path("id") id:String):Call <MutableList<UserReceive>>
- @POST("/api/user{id}/following")
- fun getFollowing(@Path("id") id:String):Call <MutableList<UserReceive>>
+ @GET("/api/user/{id}/following")
+ fun getFollowing(@Header("Authorization") authHeader:String,@Path("id") id:String):Call <MutableList<UserReceive>>
- @POST("/api/user{id}/addFollower")
- fun addFollower(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<UserReceive>
+ @GET("/api/user/{id}/addFollower")
+ fun addFollower(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<Boolean>
@GET("/api/user/{id}/id/profile")
fun getProfileFromId(@Header("Authorization") authHeader:String,@Path("id") username:String):Call<UserReceive>
+ @GET("/api/Post/posts/get10MostViewed")
+ fun get10MostViewed(@Header("Authorization") authHeader:String):Call<MutableList<PostPreview>>
+
+ @GET("/api/Post/posts/get10Best")
+ fun get10Best(@Header("Authorization") authHeader:String):Call<MutableList<PostPreview>>
+
+ @GET("/api/Post/posts/get10Newest")
+ fun get10Newest(@Header("Authorization") authHeader:String):Call<MutableList<PostPreview>>
+
+ @GET("api/Location/search")
+ fun searchLocationsQuery(@Header("Authorization") authHeader:String,@Query("query") query: String):Call<MutableList<Location>>
+
+ @GET("/api/user/{id}/myFollowings")
+ fun getMyFollowings(@Header("Authorization") authHeader:String):Call <MutableList<UserReceive>>
+
+ @GET("/api/user/{id}/checkIfAlreadyFollow")
+ fun checkIfAlreadyFollow(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<Boolean>
+
+ @GET("/api/user/{id}/unfollow")
+ fun unfollow(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<Boolean>
+
+ @GET("api/Post/posts/{id}/getUserPosts")
+ fun getUsersPosts(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<MutableList<PostPreview>>
+
+ @GET("/api/user/{id}/myFollowers")
+ fun getMyFollowers(@Header("Authorization") authHeader:String):Call <MutableList<UserReceive>>
+
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Chat.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Chat.kt
index 3404541..6725c15 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Chat.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Chat.kt
@@ -18,7 +18,8 @@ data class Message(
var senderId: String,
var receiverId: String,
var messagge: String,
- var timestamp: Date
+ var timestamp: Date,
+ var usableTimeStamp:Calendar
)
data class ChatPreview(
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt
index e2e9209..f0f67a7 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt
@@ -4,6 +4,7 @@ import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import okhttp3.MultipartBody
import java.time.LocalDateTime
+import java.util.*
data class Post (
var _id:String,
@@ -35,7 +36,12 @@ data class PostPreview (
var ratings:Float,
var comments:List<CommentSend>?,
var images:List<PostImage>,
+ var ratingscount:Int,
+ var createdAt:Date,
+ var lastViewed: Date?, //samo za istoriju pregleda
var tags:List<String>?
+
+
//nedostaju datum i vreme kreiranja
):Parcelable
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/RatingData.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/RatingData.kt
new file mode 100644
index 0000000..630c325
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/RatingData.kt
@@ -0,0 +1,11 @@
+package com.example.brzodolokacije.Models
+
+import android.os.Parcelable
+import kotlinx.android.parcel.Parcelize
+
+@Parcelize
+data class RatingData(
+ var ratings:Double,
+ var ratingscount:Int,
+ var myrating:Int
+):Parcelable \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt
index 46338b3..6e282a9 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt
@@ -29,10 +29,10 @@ data class UserReceive(
var creationDate: Date,
var pfp:PostImage?,
var postcount:Int,
- var followers:List<User>,
- var followersNumber:Int,
- var following:List<User>,
- var followingNumber:Int,
+ var followers:List<String>,
+ var followersCount:Int,
+ var following:List<String>,
+ var followingCount:Int,
var postIds:List<Int>,
var postNumber:Int
) \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/DBHelper.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/DBHelper.kt
index 479b9cb..a3d5a13 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/DBHelper.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/DBHelper.kt
@@ -41,7 +41,7 @@ class DBHelper :
if(!doesTableExist(CONTACTS_TABLE_NAME,db)){
var sql:String="CREATE TABLE "+ CONTACTS_TABLE_NAME+" (" +
"userId " +"TEXT PRIMARY KEY,"+
- "read " +"INT"+
+ "read " +"INTEGER"+
")"
db?.execSQL(sql)
}
@@ -51,7 +51,7 @@ class DBHelper :
"senderId " +"TEXT,"+
"receiverId "+"TEXT,"+
"messagge " +"TEXT,"+
- "timestamp "+"TEXT"+
+ "timestamp "+"INTEGER"+
")"
db?.execSQL(sql)
}
@@ -59,7 +59,7 @@ class DBHelper :
fun doesTableExist(tableName:String,db: SQLiteDatabase?):Boolean{
if(db!=null){
- var sqlString:String="select DISTINCT tbl_name from sqlite_master where tbl_name = '\"+tableName+\"'"
+ var sqlString:String="select DISTINCT tbl_name from sqlite_master where tbl_name = '"+tableName+"'"
var cursor: Cursor=db.rawQuery(sqlString,null)
if(cursor!=null){
if(cursor.count>0){
@@ -78,6 +78,7 @@ class DBHelper :
}
fun addMessage(message: Message, sent:Boolean=true){
+ onCreate(db)
if(!message._id.isNullOrEmpty() && message.senderId==message.receiverId){
Log.d("main", "ne zapisuje se dupla poruka")
} else {
@@ -87,8 +88,8 @@ class DBHelper :
var sql="INSERT INTO "+ MESSAGES_TABLE_NAME+"(_id,senderId,receiverid,messagge,timestamp) VALUES('"+message._id+"','"+
message.senderId+"','"+
message.receiverId+"','"+
- message.messagge+ "','"+
- message.timestamp+ "')"
+ message.messagge+ "',"+
+ message.usableTimeStamp.timeInMillis+")"
db?.execSQL(sql)
if(sent)
sql="SELECT * FROM "+ CONTACTS_TABLE_NAME+" WHERE userId='"+message.receiverId+"'"
@@ -104,14 +105,19 @@ class DBHelper :
read+"')"
db?.execSQL(sql)
}
+ else{
+ if(!sent)
+ unreadContact(message.senderId)
+ }
}
}
fun getMessages(userId:String, self:Boolean=false): MutableList<Message>? {
+ onCreate(db)
var sql:String
if(!self)
- sql="SELECT * FROM "+ MESSAGES_TABLE_NAME+" WHERE senderId='"+userId+"' OR receiverId='"+userId+"'"
+ sql="SELECT * FROM "+ MESSAGES_TABLE_NAME+" WHERE senderId='"+userId+"' OR receiverId='"+userId+"' ORDER BY timestamp ASC"
else
- sql="SELECT * FROM "+ MESSAGES_TABLE_NAME+" WHERE senderId='"+userId+"' AND receiverId='"+userId+"'"
+ sql="SELECT * FROM "+ MESSAGES_TABLE_NAME+" WHERE senderId='"+userId+"' AND receiverId='"+userId+"' ORDER BY timestamp ASC"
var cursor=db?.rawQuery(sql,null)
if(cursor?.count!! >0){
var messagesList:MutableList<Message> =mutableListOf()
@@ -121,23 +127,28 @@ class DBHelper :
var messageIndex=cursor.getColumnIndexOrThrow("messagge")
var timestampIndex=cursor.getColumnIndexOrThrow("timestamp")
while(cursor.moveToNext()){
+ var cal:Calendar= Calendar.getInstance()
+ cal.timeInMillis=cursor.getLong(timestampIndex)
messagesList.add(
Message(
cursor.getString(idIndex),
cursor.getString(senderIdIndex),
cursor.getString(receiverIdIndex),
cursor.getString(messageIndex),
- Date()
+ cal.time,
+ cal
)
)
+ Log.d("main",cal.time.toString())
}
- Log.d("main",messagesList.size.toString())
+ readContact(userId)
return messagesList
}
return null
}
fun getContacts(): MutableList<ChatPreview>? {
+ onCreate(db)
var sql="SELECT * FROM "+ CONTACTS_TABLE_NAME
var cursor=db?.rawQuery(sql,null)
if(cursor?.count!! >0){
@@ -152,4 +163,20 @@ class DBHelper :
}
return null
}
+
+ fun deleteDB() {
+ var sql="DROP TABLE IF EXISTS "+ CONTACTS_TABLE_NAME
+ db?.execSQL(sql)
+ sql="DROP TABLE IF EXISTS "+ MESSAGES_TABLE_NAME
+ db?.execSQL(sql)
+ }
+
+ fun readContact(userId: String){
+ var sql="UPDATE "+ CONTACTS_TABLE_NAME+" SET read=1 WHERE userId='"+userId+"'"
+ db?.execSQL(sql)
+ }
+ fun unreadContact(userId: String){
+ var sql="UPDATE "+ CONTACTS_TABLE_NAME+" SET read=0 WHERE userId='"+userId+"'"
+ db?.execSQL(sql)
+ }
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt
index d091c5d..39689c7 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt
@@ -2,8 +2,10 @@ package com.example.brzodolokacije.chat
import android.app.Activity
import android.util.Log
+import android.widget.Toast
import com.auth0.android.jwt.JWT
import com.exam.DBHelper
+import com.example.brzodolokacije.Activities.ChatActivity
import com.example.brzodolokacije.Models.Message
import com.example.brzodolokacije.Models.MessageReceive
import com.example.brzodolokacije.Services.RetrofitHelper
@@ -12,10 +14,11 @@ import com.microsoft.signalr.Action1
import com.microsoft.signalr.HubConnection
import com.microsoft.signalr.HubConnectionBuilder
import com.microsoft.signalr.HubConnectionState
+import java.util.*
class SignalRListener private constructor(val activity: Activity){
- private var hubConnection:HubConnection
+ public var hubConnection:HubConnection
private var dbHelper:DBHelper
init{
dbHelper= DBHelper.getInstance(activity)
@@ -25,13 +28,16 @@ class SignalRListener private constructor(val activity: Activity){
hubConnection.keepAliveInterval=120
hubConnection.on("Message",
Action1 {
- message:MessageReceive->dbHelper.addMessage(Message(message.senderId+message.timestamp,message.senderId,
- JWT(SharedPreferencesHelper.getValue("jwt",activity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp),false)
+ message:MessageReceive->addToDbAndloadMessageIfInChat(message,activity)
},
MessageReceive::class.java
)
- hubConnection.start().blockingAwait()
-
+ try{
+ hubConnection.start().blockingAwait()
+ }
+ catch(e:Exception){
+ Toast.makeText(activity,"Greska",Toast.LENGTH_LONG).show()
+ }
Log.d("main", hubConnection.connectionState.toString())
}
@@ -56,6 +62,19 @@ class SignalRListener private constructor(val activity: Activity){
Log.d("main",hubConnection.connectionState.toString())
}
+ fun addToDbAndloadMessageIfInChat(message:MessageReceive,activity: Activity){
+ var cal:Calendar= Calendar.getInstance()
+ cal.time=message.timestamp
+ dbHelper.addMessage(Message(message.senderId+message.timestamp,message.senderId,
+ JWT(SharedPreferencesHelper.getValue("jwt",activity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp,cal),false)
+ if(activity is ChatActivity){
+ if(activity.clickedChat?.userId==message.senderId){
+ activity.clickedChat?.requestMessages()
+ }
+ activity.requestNewMessages()
+ }
+ }
+
fun log(){
Log.d("Debug infor siganlR ", hubConnection.connectionId)
}
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt
index b1c89db..cee39ce 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt
@@ -2,9 +2,10 @@ package com.example.brzodolokacije.paging
import android.app.Activity
import android.util.Log
+import androidx.paging.ExperimentalPagingApi
import androidx.paging.PagingSource
+import androidx.paging.PagingState
import com.example.brzodolokacije.Interfaces.IBackendApi
-import com.example.brzodolokacije.Models.PagedPosts
import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.Models.SearchParams
import com.example.brzodolokacije.Services.SharedPreferencesHelper
@@ -23,10 +24,10 @@ class SearchPostsPagingSource(
val response=backend.getPagedPosts("Bearer "+token,searchParams.locationId,
page,searchParams.sorttype,searchParams.filterdate
)
- Log.d("main",page.toString())
+ Log.d("main","stranicenje: "+page.toString())
LoadResult.Page(
response.posts,prevKey=if(page==0) null else page-1,
- nextKey=if(response.posts.isEmpty()) null else page+1
+ nextKey=if(page==response.totalpages) null else page+1
)
}catch(exception:IOException){
return LoadResult.Error(exception)
@@ -35,4 +36,12 @@ class SearchPostsPagingSource(
}
}
+ @ExperimentalPagingApi
+ override fun getRefreshKey(state: PagingState<Int, PostPreview>): Int? {
+ return state.anchorPosition?.let{ anchorPosition->
+ val anchorPage=state.closestPageToPosition(anchorPosition)
+ anchorPage?.prevKey?.plus(1)?:anchorPage?.nextKey?.minus(1)
+ }
+ }
+
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsRepository.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsRepository.kt
index 4eeb85b..f43bc31 100644
--- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsRepository.kt
+++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsRepository.kt
@@ -4,7 +4,6 @@ import android.app.Activity
import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
-import androidx.paging.cachedIn
import com.example.brzodolokacije.Models.PostPreview
import com.example.brzodolokacije.Models.SearchParams
import com.example.brzodolokacije.Services.RetrofitHelper
@@ -14,6 +13,7 @@ class SearchPostsRepository(val activity: Activity,val searchParams: SearchParam
companion object{
const val DEFAULT_PAGE_SIZE=20
const val DEFAULT_PAGE_INDEX=1
+ const val PREFETCH_DISTANCE=6
fun getInstance(activity: Activity,searchParams: SearchParams)=SearchPostsRepository(activity,searchParams)
}
@@ -26,6 +26,6 @@ class SearchPostsRepository(val activity: Activity,val searchParams: SearchParam
}
private fun getDefaultPageConfig(): PagingConfig {
- return PagingConfig(pageSize= DEFAULT_PAGE_SIZE, enablePlaceholders = false)
+ return PagingConfig(pageSize= DEFAULT_PAGE_SIZE, prefetchDistance = PREFETCH_DISTANCE, enablePlaceholders = false)
}
} \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_message_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_message_24.xml
new file mode 100644
index 0000000..cacf08d
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_message_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FFFFFF"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
index 09fe069..86ad75d 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
@@ -1,5 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
- android:tint="#274352" android:viewportHeight="24"
+ android:tint="#737374" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_24.xml
new file mode 100644
index 0000000..4d57238
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="15dp" android:tint="#F1DB24"
+ android:viewportHeight="15" android:viewportWidth="15"
+ android:width="15dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_7.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_7.xml
new file mode 100644
index 0000000..6d080ea
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_circle_7.xml
@@ -0,0 +1,5 @@
+<vector android:height="7dp" android:tint="#F1DB24"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="7dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_description_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_description_24.xml
new file mode 100644
index 0000000..6c09587
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_description_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#F1DB24"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M14,2L6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6zM16,18L8,18v-2h8v2zM16,14L8,14v-2h8v2zM13,9L13,3.5L18.5,9L13,9z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_location_on_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_location_on_24.xml
new file mode 100644
index 0000000..5a1bcff
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_location_on_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FD3636"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml
new file mode 100644
index 0000000..cdafe07
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#F1DB24"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M14.43,10l-2.43,-8l-2.43,8l-7.57,0l6.18,4.41l-2.35,7.59l6.17,-4.69l6.18,4.69l-2.35,-7.59l6.17,-4.41z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_tag_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_tag_24.xml
new file mode 100644
index 0000000..608a7a3
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_tag_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#F1DB24"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M20,10L20,8h-4L16,4h-2v4h-4L10,4L8,4v4L4,8v2h4v4L4,14v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4h4zM14,14h-4v-4h4v4z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_add_alt_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_add_alt_24.xml
new file mode 100644
index 0000000..0c0ec5a
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_add_alt_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FFFFFF"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M20,9V6h-2v3h-3v2h3v3h2v-3h3V9H20zM9,12c2.21,0 4,-1.79 4,-4c0,-2.21 -1.79,-4 -4,-4S5,5.79 5,8C5,10.21 6.79,12 9,12zM9,6c1.1,0 2,0.9 2,2c0,1.1 -0.9,2 -2,2S7,9.1 7,8C7,6.9 7.9,6 9,6zM15.39,14.56C13.71,13.7 11.53,13 9,13c-2.53,0 -4.71,0.7 -6.39,1.56C1.61,15.07 1,16.1 1,17.22V20h16v-2.78C17,16.1 16.39,15.07 15.39,14.56zM15,18H3v-0.78c0,-0.38 0.2,-0.72 0.52,-0.88C4.71,15.73 6.63,15 9,15c2.37,0 4.29,0.73 5.48,1.34C14.8,16.5 15,16.84 15,17.22V18z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_remove_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_remove_24.xml
new file mode 100644
index 0000000..3272d5e
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_person_remove_24.xml
@@ -0,0 +1,7 @@
+<vector android:height="24dp" android:tint="#FFFFFF"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M14,8c0,-2.21 -1.79,-4 -4,-4C7.79,4 6,5.79 6,8c0,2.21 1.79,4 4,4C12.21,12 14,10.21 14,8zM12,8c0,1.1 -0.9,2 -2,2c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2C11.1,6 12,6.9 12,8z"/>
+ <path android:fillColor="@android:color/white" android:pathData="M2,18v2h16v-2c0,-2.66 -5.33,-4 -8,-4C7.33,14 2,15.34 2,18zM4,18c0.2,-0.71 3.3,-2 6,-2c2.69,0 5.77,1.28 6,2H4z"/>
+ <path android:fillColor="@android:color/white" android:pathData="M17,10h6v2h-6z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_chat_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_chat_24.xml
new file mode 100644
index 0000000..69108ca
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_chat_24.xml
@@ -0,0 +1,5 @@
+<vector android:autoMirrored="true" android:height="24dp"
+ android:tint="#747474" android:viewportHeight="24"
+ android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM7,9h10c0.55,0 1,0.45 1,1s-0.45,1 -1,1L7,11c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1zM13,14L7,14c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h6c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM17,8L7,8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h10c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_message_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_message_24.xml
new file mode 100644
index 0000000..130c826
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_message_24.xml
@@ -0,0 +1,5 @@
+<vector android:autoMirrored="true" android:height="24dp"
+ android:tint="#FFFFFF" android:viewportHeight="24"
+ android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM17,14L7,14c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h10c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM17,11L7,11c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h10c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM17,8L7,8c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h10c0.55,0 1,0.45 1,1s-0.45,1 -1,1z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_button.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_button.xml
new file mode 100644
index 0000000..52d0c26
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_button.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <corners android:radius="20dp"/>
+</shape> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/view_bottom_corner_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_bottom_corner_radius.xml
new file mode 100644
index 0000000..b5b8ad3
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_bottom_corner_radius.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#FFFFFFFF"/>
+ <corners
+ android:topLeftRadius="0dp"
+ android:topRightRadius="0dp"
+ android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ />
+</shape> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/view_corner_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_corner_radius.xml
new file mode 100644
index 0000000..dd92db4
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_corner_radius.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#FFFFFFFF"/>
+ <corners
+ android:topLeftRadius="10dp"
+ android:topRightRadius="10dp"
+ android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp"
+ />
+</shape> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml
new file mode 100644
index 0000000..dad1a7a
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="#FFFFFFFF"/>
+ <corners
+ android:topLeftRadius="10dp"
+ android:topRightRadius="10dp"
+ android:bottomLeftRadius="0dp"
+ android:bottomRightRadius="0dp"
+ />
+</shape> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml
index fbe2230..405c221 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml
@@ -46,66 +46,57 @@
tools:ignore="SpeakableTextPresentCheck" />
<Button
- android:clickable="false"
android:id="@+id/btnActivityAddPostUploadFromGallery"
android:layout_width="177dp"
android:layout_height="19dp"
+ android:clickable="false"
android:text="Otvori galeriju"
android:visibility="invisible"
app:cornerRadius="20dp"
- app:layout_constraintBottom_toTopOf="@+id/tvActivityAddPostLocationtext"
+ app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddLocation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent" />
- <TextView
- android:id="@+id/tvActivityAddPostLocationtext"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:layout_marginBottom="16dp"
- android:text="Lokacija"
- app:layout_constraintBottom_toTopOf="@+id/etActivityAddPostLocation"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent" />
-
- <EditText
- android:id="@+id/etActivityAddPostLocation"
- android:layout_width="200dp"
- android:layout_height="50dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:ems="10"
- android:hint="Reykjavik, Iceland"
- android:inputType="textEmailAddress"
- app:layout_constraintBottom_toTopOf="@+id/tvActivityAddPostDescriptiontext"
- app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnActivityAddPostAddLocation"
android:layout_width="wrap_content"
android:layout_height="50dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:background="@drawable/rounded_cyan_button"
- android:backgroundTint="#1C789A"
+ android:stateListAnimator="@null"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_location_on_24"
android:text="Dodaj lokaciju"
+ android:textColor="#757471"
app:layout_constraintBottom_toTopOf="@+id/tvActivityAddPostDescriptiontext"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@+id/etActivityAddPostLocation" />
-
+ app:layout_constraintHorizontal_bias="0.074"
+ app:layout_constraintStart_toStartOf="parent" />
- <TextView
+ <EditText
+ android:id="@+id/etActivityAddPostLocationText"
+ android:layout_width="wrap_content"
+ android:layout_height="50dp"
+ android:ems="10"
+ android:enabled="false"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="@+id/btnActivityAddPostAddLocation"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/btnActivityAddPostAddLocation" />
+ <Button
android:id="@+id/tvActivityAddPostDescriptiontext"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
- android:text="Opis"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_description_24"
+ android:stateListAnimator="@null"
+ android:text="Dodaj opis"
+ android:textColor="#757471"
app:layout_constraintBottom_toTopOf="@+id/etActivityAddPostDescription"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<EditText
@@ -117,6 +108,7 @@
android:ems="10"
android:hint="Reykjavik, Iceland"
android:inputType="textEmailAddress"
+ android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/llTags"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
@@ -151,12 +143,12 @@
<LinearLayout
android:id="@+id/llTags"
- android:layout_width="0dp"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
- app:layout_constraintBottom_toTopOf="@+id/acTags"
+ app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddTag"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"></LinearLayout>
@@ -164,29 +156,27 @@
android:id="@+id/acTags"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:layout_marginRight="20dp"
+ android:layout_marginStart="28dp"
android:hint="Planina,Reka,Park..."
+ android:maxLength="12"
android:minHeight="48dp"
- android:maxLength= "12"
+ android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostPost"
- app:layout_constraintEnd_toStartOf="@+id/btnActivityAddPostAddTag"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnActivityAddPostAddTag"
android:layout_width="wrap_content"
android:layout_height="40dp"
- android:layout_marginTop="5dp"
- android:layout_marginEnd="20dp"
- android:layout_marginStart="20dp"
- android:layout_marginBottom="5dp"
- android:background="@drawable/rounded_cyan_button"
- android:backgroundTint="#1C789A"
+ android:layout_marginStart="16dp"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_tag_24"
+ android:stateListAnimator="@null"
+
android:text="Dodaj tag"
- app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostPost"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/llTags" />
+ android:textColor="#757471"
+ app:layout_constraintBottom_toTopOf="@+id/acTags"
+ app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml
index 2b64a27..cb2c8dc 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml
@@ -14,8 +14,10 @@
android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostCapture"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="1.0"
tools:ignore="ImageContrastCheck"
tools:srcCompat="@tools:sample/avatars" />
@@ -23,68 +25,56 @@
android:id="@+id/btnActivityCapturePostCapture"
android:layout_width="68dp"
android:layout_height="15dp"
+ android:clickable="false"
android:visibility="invisible"
app:cornerRadius="30dp"
app:icon="@android:drawable/ic_menu_camera"
app:iconTint="#FFFFFF"
- android:clickable="false"
- app:layout_constraintBottom_toTopOf="@+id/tvActivityCapturePostLocationtext"
+ app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostAddLocation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="SpeakableTextPresentCheck" />
- <TextView
- android:id="@+id/tvActivityCapturePostLocationtext"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:text="Lokacija"
- app:layout_constraintBottom_toTopOf="@+id/etActivityCapturePostLocation"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent" />
- <EditText
- android:id="@+id/etActivityCapturePostLocation"
- android:layout_width="200dp"
- android:layout_height="50dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:ems="10"
- android:hint="Reykjavik, Iceland"
- android:importantForAutofill="no"
- android:inputType="textEmailAddress"
- app:layout_constraintBottom_toTopOf="@+id/tvActivityCapturePostDescriptiontext"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- tools:ignore="DuplicateSpeakableTextCheck,TextContrastCheck" />
<Button
android:id="@+id/btnActivityCapturePostAddLocation"
android:layout_width="wrap_content"
android:layout_height="50dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
- android:background="@drawable/rounded_cyan_button"
- android:backgroundTint="#1C789A"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_location_on_24"
+ android:stateListAnimator="@null"
android:text="Dodaj lokaciju"
+ android:textColor="#757471"
app:layout_constraintBottom_toTopOf="@+id/tvActivityCapturePostDescriptiontext"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@+id/etActivityCapturePostLocation" />
-
+ app:layout_constraintHorizontal_bias="0.092"
+ app:layout_constraintStart_toStartOf="parent" />
+ <EditText
+ android:id="@+id/etActivityAddPostLocationText"
+ android:layout_width="wrap_content"
+ android:layout_height="50dp"
+ android:ems="10"
+ android:enabled="false"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="@+id/btnActivityCapturePostAddLocation"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/btnActivityCapturePostAddLocation" />
- <TextView
+ <Button
android:id="@+id/tvActivityCapturePostDescriptiontext"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
- android:text="Opis"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_description_24"
+ android:stateListAnimator="@null"
+ android:text="Dodaj opis"
+ android:textColor="#757471"
app:layout_constraintBottom_toTopOf="@+id/etActivityCapturePostDescription"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="1.0"
+ app:layout_constraintHorizontal_bias="0.017"
app:layout_constraintStart_toStartOf="parent" />
<EditText
@@ -95,6 +85,7 @@
android:layout_marginEnd="16dp"
android:ems="10"
android:hint="Reykjavik, Iceland"
+ android:visibility="gone"
android:importantForAutofill="no"
android:inputType="textEmailAddress"
app:layout_constraintBottom_toTopOf="@+id/llTagsCap"
@@ -142,36 +133,38 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
- app:layout_constraintBottom_toTopOf="@+id/acTagsCap"
+ app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddTagCap"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.4"
app:layout_constraintStart_toStartOf="parent"></LinearLayout>
<EditText
android:id="@+id/acTagsCap"
- android:layout_width="0dp"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="20dp"
- android:layout_marginRight="20dp"
+ android:layout_marginBottom="28dp"
android:hint="Planina,Reka,Park..."
+ android:maxLength="12"
android:minHeight="48dp"
- android:maxLength= "12"
+ android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostPost"
- app:layout_constraintEnd_toStartOf="@+id/btnActivityAddPostAddTagCap"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.08"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnActivityAddPostAddTagCap"
android:layout_width="wrap_content"
android:layout_height="40dp"
- android:layout_marginTop="5dp"
- android:layout_marginEnd="20dp"
- android:layout_marginStart="20dp"
- android:layout_marginBottom="5dp"
- android:background="@drawable/rounded_cyan_button"
- android:backgroundTint="#1C789A"
+ android:layout_marginBottom="20dp"
+ android:backgroundTint="@color/white"
+ android:drawableLeft="@drawable/ic_baseline_tag_24"
+ android:stateListAnimator="@null"
android:text="Dodaj tag"
- app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostPost"
+ android:textColor="#757471"
+ app:layout_constraintBottom_toTopOf="@+id/acTagsCap"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/llTagsCap" />
+ app:layout_constraintHorizontal_bias="0.076"
+ app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml
index 9e28d6d..680bada 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml
@@ -5,47 +5,65 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Activities.ChatActivity">
- <androidx.constraintlayout.widget.ConstraintLayout
- android:id="@+id/topBanner"
- android:layout_width="match_parent"
- android:clickable="true"
- android:layout_height="50dp"
- android:background="@color/dark_blue_transparent"
- app:layout_constraintStart_toStartOf="parent">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:textSize="40dp"
- android:id="@+id/tvFragmentTitle"
- android:text="Chat"
- android:textColor="@color/white"/>
-
- </androidx.constraintlayout.widget.ConstraintLayout>
+
<ImageButton
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
android:id="@+id/addNewMessage"
+ android:layout_width="60dp"
+ android:layout_height="60dp"
android:clickable="true"
+ android:elevation="50dp"
android:focusable="true"
- app:layout_constraintTop_toBottomOf="@id/topBanner"
- android:src="@drawable/button_chat">
+ android:backgroundTint="@color/unfollow"
+ android:src="@drawable/ic_baseline_add_message_24"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
- </ImageButton>
- <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+ <ImageView
+ android:id="@+id/btnActivityShowFollowersAndFollowingBackToUser"
+ android:layout_width="35dp"
+ android:layout_height="35dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="16dp"
+ android:clickable="true"
+ android:src="@drawable/ic_baseline_arrow_back"
+ android:textAllCaps="false"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
+
+ <TextView
+ android:id="@+id/tvActivityShowFollowersOrFollowingShow"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_width="match_parent"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="268dp"
+ android:text="Poruke"
+ android:textSize="25dp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeContainer"
- app:layout_constraintTop_toBottomOf="@id/addNewMessage">
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginTop="8dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tvActivityShowFollowersOrFollowingShow"
+ app:layout_constraintVertical_bias="1.0"
+ tools:layout_editor_absoluteX="-27dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" >
+ app:layout_constraintTop_toTopOf="parent">
</androidx.recyclerview.widget.RecyclerView>
+
+
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml
index 8d37c29..0051893 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml
@@ -33,6 +33,7 @@
app:rippleColor="#FFFFFF"
app:srcCompat="@android:drawable/ic_menu_mylocation" />
+
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/ActivityMapsConfirmLocation"
android:layout_width="wrap_content"
@@ -64,7 +65,7 @@
app:layout_constraintTop_toTopOf="parent">
- <com.google.android.material.textfield.TextInputEditText
+ <AutoCompleteTextView
android:id="@+id/ActivityMapsSearchBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -86,4 +87,21 @@
</androidx.cardview.widget.CardView>
+<!-- <Spinner-->
+<!-- android:id="@+id/MapsActivitySpinner"-->
+<!-- android:layout_width="match_parent"-->
+<!-- android:layout_height="40dp"-->
+<!-- android:background="@null"-->
+<!-- app:layout_constraintEnd_toEndOf="parent"-->
+<!-- app:layout_constraintStart_toStartOf="parent"-->
+<!-- app:layout_constraintTop_toBottomOf="@+id/ActivityMapsCardViewSearch" />-->
+
+<!-- <AutoCompleteTextView-->
+<!-- android:id="@+id/ActivityMapsAutoCompleteTextView"-->
+<!-- android:layout_width="match_parent"-->
+<!-- android:layout_height="40dp"-->
+<!-- app:layout_constraintEnd_toEndOf="parent"-->
+<!-- app:layout_constraintStart_toStartOf="parent"-->
+<!-- app:layout_constraintTop_toBottomOf="@+id/ActivityMapsCardViewSearch" />-->
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_show_followers_and_following.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_show_followers_and_following.xml
new file mode 100644
index 0000000..7ee4cbe
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_show_followers_and_following.xml
@@ -0,0 +1,83 @@
+<?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:padding="16dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".Activities.ActivityShowFollowersAndFollowing">
+
+ <!--
+ <View
+ android:id="@+id/divider"
+ android:layout_width="409dp"
+ android:layout_height="1dp"
+ android:layout_marginTop="4dp"
+ android:background="?android:attr/listDivider"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/btnActivityShowFollowersAndwingShowFollowers" />
+
+ <Button
+ android:id="@+id/btnActivityShowFollowersAndFollowingShowFollowers"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:backgroundTint="#FFFFFF"
+ android:stateListAnimator="@null"
+ android:text="Pratioci"
+ android:textColor="@color/cardview_dark_background"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/btnActiShowFollowersAndFollowingBackToUser" />
+
+ <Button
+ android:id="@+id/btnActivityShowFollowersAndFollowingShowFollowing"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="20dp"
+ android:backgroundTint="#FFFFFF"
+ android:stateListAnimator="@null"
+ android:text="Praćenja"
+ android:textColor="@color/cardview_dark_background"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/btnActivityShowFollowersAndFollowingBackToUser" />
+ -->
+
+ <ImageView
+ android:id="@+id/btnActivityShowFollowersAndFollowingBackToUser"
+ android:layout_width="35dp"
+ android:layout_height="35dp"
+ android:layout_marginStart="4dp"
+ android:layout_marginTop="4dp"
+ android:clickable="true"
+ android:src="@drawable/ic_baseline_arrow_back"
+ android:textAllCaps="false"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
+
+ <TextView
+ android:id="@+id/tvActivityShowFollowersOrFollowingShow"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="4dp"
+ android:textSize="25dp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.11"
+ app:layout_constraintStart_toEndOf="@+id/btnActivityShowFollowersAndFollowingBackToUser"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <FrameLayout
+ android:id="@+id/flActivityShowFollowerAndFollowing"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginTop="16dp"
+ android:orientation="vertical"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/btnActivityShowFollowersAndFollowingBackToUser"/>
+ </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_user_profile.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_user_profile.xml
index 8762183..cbcafc5 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_user_profile.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_user_profile.xml
@@ -15,7 +15,7 @@
android:id="@+id/imageView3"
android:layout_width="match_parent"
- android:layout_height="300dp"
+ android:layout_height="250dp"
android:foreground="@drawable/b3"
android:foregroundGravity="center_vertical|center|center_horizontal|fill"
android:src="@drawable/b3"
@@ -28,9 +28,9 @@
android:id="@+id/tvFragmentProfileInfoContainer"
android:layout_width="0dp"
- android:layout_height="199dp"
+ android:layout_height="240dp"
android:layout_marginStart="20dp"
- android:layout_marginTop="150dp"
+ android:layout_marginTop="120dp"
android:layout_marginEnd="20dp"
android:adjustViewBounds="true"
android:background="@drawable/profile_view_background"
@@ -46,10 +46,10 @@
<androidx.cardview.widget.CardView
android:id="@+id/cvFragmentHomePageProfile"
- android:layout_width="140dp"
- android:layout_height="140dp"
+ android:layout_width="130dp"
+ android:layout_height="130dp"
android:layout_gravity="center"
- android:layout_marginTop="80dp"
+ android:layout_marginTop="60dp"
android:elevation="10dp"
app:cardCornerRadius="250dp"
app:layout_constraintEnd_toEndOf="parent"
@@ -74,10 +74,10 @@
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/btnFragmentUserProfileShowPosts" />
+ app:layout_constraintTop_toBottomOf="@+id/btnActivityUserProfileShowPosts" />
<Button
- android:id="@+id/btnFragmentUserProfileShowPosts"
+ android:id="@+id/btnActivityUserProfileShowPosts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
@@ -116,26 +116,27 @@
android:stateListAnimator="@null"
android:text="Recenzije"
android:textColor="@color/cardview_dark_background"
- app:layout_constraintStart_toEndOf="@+id/btnFragmentUserProfileShowPosts"
+ app:layout_constraintStart_toEndOf="@+id/btnActivityUserProfileShowPosts"
app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" />
<FrameLayout
- android:id="@+id/flFragmentProfileFragmentContainer"
+ android:id="@+id/flActivityProfileFragmentContainer"
android:layout_width="409dp"
android:layout_height="319dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/divider">
- </FrameLayout>
+ app:layout_constraintTop_toTopOf="@+id/divider"
+ app:layout_constraintVertical_bias="0.0"></FrameLayout>
<TableLayout
android:layout_width="363dp"
- android:layout_height="122dp"
+ android:layout_height="wrap_content"
android:layout_marginStart="30dp"
- android:layout_marginTop="8dp"
+ android:layout_marginTop="5dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="8dp"
android:elevation="1dp"
@@ -145,7 +146,8 @@
app:layout_constraintBottom_toBottomOf="@+id/tvFragmentProfileInfoContainer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile">
+ app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile"
+ app:layout_constraintVertical_bias="0.35000002">
<TableRow
android:layout_width="match_parent"
@@ -158,92 +160,149 @@
android:layout_height="match_parent"
android:layout_column="1"
android:layout_gravity="center"
- android:layout_marginBottom="5dp"
android:text="Petar Petrović"
- android:textSize="20sp" />
+ android:textStyle="bold"
+ android:textSize="23sp" />
</TableRow>
- <TableRow>
-
- <androidx.constraintlayout.widget.ConstraintLayout android:layout_span="3">
-
- <ImageButton
- android:id="@+id/materialButton"
- android:layout_width="115dp"
- android:layout_height="40dp"
- android:layout_marginStart="16dp"
- android:background="@drawable/rounded_transparent_button"
- android:foreground="@drawable/button_follow"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:ignore="TouchTargetSizeCheck" />
-
- <ImageButton
- android:layout_width="115dp"
- android:layout_height="40dp"
- android:layout_gravity="center"
- android:layout_marginEnd="16dp"
- android:height="40dp"
- android:background="@drawable/rounded_transparent_button"
- android:foreground="@drawable/button_chat"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:ignore="SpeakableTextPresentCheck" />
- </androidx.constraintlayout.widget.ConstraintLayout>
- </TableRow>
-
-
- <TableRow android:layout_marginTop="5dp">
+ <TableRow android:layout_marginTop="20dp">
<TextView
android:id="@+id/tvFragmentUserProfilePosts"
- android:layout_width="110dp"
+ android:layout_width="105dp"
android:gravity="center"
- android:text="OBJAVE" />
+ android:text="OBJAVE"
+ android:stateListAnimator="@null"
+ android:backgroundTint="@color/white"
+ android:textColor="#757471"/>
- <TextView
- android:id="@+id/tvFragmentUserProfileFollowers"
- android:layout_width="10dp"
+ <Button
+ android:id="@+id/tvActivityUserProfileFollowers"
+ android:layout_width="110dp"
+ android:layout_height="28dp"
+ android:layout_margin="0dp"
+ android:backgroundTint="@color/white"
+ android:clickable="true"
android:gravity="center"
- android:text="PRATIOCI" />
+ android:padding="0dp"
+ android:stateListAnimator="@null"
+ android:text="PRATIOCI"
+ android:textColor="#757471"
- <TextView
- android:id="@+id/tvFragmentUserProfileFollow"
+ tools:ignore="TouchTargetSizeCheck" />
+ <Button
+ android:id="@+id/tvActivityUserProfileFollow"
android:layout_width="110dp"
+ android:layout_height="28dp"
+ android:layout_margin="0dp"
+ android:backgroundTint="@color/white"
+ android:clickable="true"
android:gravity="center"
- android:text="PRAĆENJA" />
+ android:padding="0dp"
+ android:stateListAnimator="@null"
+ android:text="PRAĆENJA"
+ android:textColor="#757471"
+ tools:ignore="TouchTargetSizeCheck" />
</TableRow>
- <TableRow>
-
+ <TableRow
+ android:layout_height="wrap_content"
+ >
<TextView
android:id="@+id/tvActivityUserProfilePostsNo"
android:layout_width="110dp"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:gravity="center"
android:text="156"
- android:textFontWeight="700" />
+ android:textSize="20dp"
+ android:textStyle="bold" />
<TextView
android:id="@+id/tvActivityUserProfileFollowersNo"
android:layout_width="110dp"
android:gravity="center"
- android:text="50" />
+ android:text="50"
+ android:textSize="20dp"
+ android:textStyle="bold"/>
<TextView
android:id="@+id/tvActivityUserProfileFollowNo"
android:layout_width="110dp"
android:gravity="center"
- android:text="40" />
+ android:text="40"
+ android:textSize="20dp"
+ android:textStyle="bold"/>
</TableRow>
+ <TableRow
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ >
+
+ <androidx.constraintlayout.widget.ConstraintLayout android:layout_span="3">
+
+ <Button
+
+ android:id="@+id/btnActivityUserProfileFollow"
+ android:layout_width="280dp"
+ android:layout_height="30dp"
+ android:layout_marginStart="16dp"
+ android:clickable="true"
+ android:drawableLeft="@drawable/ic_outline_person_add_alt_24"
+ android:insetTop="0dp"
+ android:insetBottom="0dp"
+ android:backgroundTint="@color/button_main"
+ android:text="PRATI"
+ android:visibility="visible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.13"
+ app:shapeAppearanceOverlay="@style/Circular"
+ tools:ignore="TouchTargetSizeCheck" />
+
+ <Button
+
+ android:id="@+id/btnActivityUserProfileUnFollow"
+ android:layout_width="280dp"
+ android:layout_height="30dp"
+ android:layout_marginStart="16dp"
+ android:clickable="false"
+ android:drawableLeft="@drawable/ic_outline_person_remove_24"
+ android:insetTop="0dp"
+ android:insetBottom="0dp"
+ android:text="NE PRATI više"
+ android:backgroundTint="@color/unfollow"
+
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.13"
+ app:shapeAppearanceOverlay="@style/Circular"
+ tools:ignore="TouchTargetSizeCheck" />
+
+
+ <ImageButton
+ android:id="@+id/activityUserProfileOpenChat"
+ android:layout_width="35dp"
+ android:layout_height="30dp"
+ android:layout_gravity="center"
+ android:layout_marginEnd="16dp"
+ android:height="40dp"
+ android:background="@drawable/rounded_button"
+ android:backgroundTint="@color/button_main"
+ android:src="@drawable/ic_round_message_24"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.0"
+ app:shapeAppearanceOverlay="@style/Circular"
+ tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
+ </androidx.constraintlayout.widget.ConstraintLayout>
+ </TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml
index 2342779..7858e94 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml
@@ -1,26 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:background="@drawable/rounded_cyan_button"
- android:clipToOutline="true"
+
android:id="@+id/clMessage"
android:layout_margin="@dimen/text_padding"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
android:layout_gravity="end">
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/cardView"
+ android:layout_width="wrap_content"
+ android:layout_height="30dp"
+ android:backgroundTint="@color/unfollow"
+ android:elevation="5dp"
+ app:cardCornerRadius="15dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+
+ <com.google.android.material.textview.MaterialTextView
+
+ android:id="@+id/tvMessage"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:background="@drawable/view_corner_radius"
+ android:backgroundTint="@color/unfollow"
+ android:padding="5dp"
+ android:text="blabla"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/tvDate"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="32dp"
+ android:paddingStart="8dp"
+ android:paddingTop="4dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="4dp"
+ android:text="June 10"
+ android:textColor="#C0C0C0"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
<androidx.cardview.widget.CardView
+ android:id="@+id/cvContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ app:cardBackgroundColor="@color/dark_blue_transparent"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="0dp"
+ app:cardPreventCornerOverlap="false"
+ app:cardUseCompatPadding="true"
app:layout_constraintEnd_toEndOf="parent"
- app:cardBackgroundColor="@color/cardview_dark_background">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/white"
- android:id="@+id/tvMessage"
- android:text="blabla"
- android:padding="@dimen/component_padding"/>
+ app:layout_constraintTop_toBottomOf="@id/tvDate">
+
+
+
+
</androidx.cardview.widget.CardView>
+ <TextView
+ android:id="@+id/tvTimestamp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="10:00"
+ android:textColor="#C0C0C0"
+ android:textSize="10sp"
+ app:layout_constraintBottom_toBottomOf="@+id/cvContainer"
+ app:layout_constraintEnd_toStartOf="@+id/cvContainer" />
+
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message_other.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message_other.xml
index 647127c..aaabd86 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message_other.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message_other.xml
@@ -1,23 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:background="@drawable/rounded_cyan_button"
+
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clMessage"
- android:layout_margin="@dimen/text_padding"
- android:clipToOutline="true">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
- <androidx.cardview.widget.CardView
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="16dp">
+
+ <TextView
+ android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- app:cardBackgroundColor="@color/dark_blue_transparent">
+ android:layout_marginTop="32dp"
+ android:elevation="10dp"
+
+ android:paddingTop="4dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="4dp"
+ android:text="June 10"
+ android:textColor="#C0C0C0"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <androidx.cardview.widget.CardView
+ android:id="@+id/cvContainer"
+ android:layout_width="wrap_content"
+ android:layout_height="30dp"
+ android:layout_margin="5dp"
+ android:elevation="5dp"
+ app:cardCornerRadius="10dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent">
+
+
+
+ <LinearLayout
+ android:id="@+id/llContainer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ android:id="@+id/tvMessage"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="5dp"
+ android:text="blabla"
+ app:cardBackgroundColor="#eef1f6"
+ app:cardCornerRadius="12dp"
+ app:cardElevation="0dp"
+ app:cardPreventCornerOverlap="false"
+ app:cardUseCompatPadding="true"
+ app:layout_constraintTop_toBottomOf="@+id/tvDate"/>
+
+ </LinearLayout>
+
+ </androidx.cardview.widget.CardView>
+
+
<TextView
+ android:id="@+id/tvTimestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/white"
- android:id="@+id/tvMessage"
- android:text="blabla"
- android:padding="@dimen/component_padding"/>
- </androidx.cardview.widget.CardView>
+ android:layout_marginStart="4dp"
+ android:layout_marginTop="-5dp"
+ android:text="8:00"
+ android:textColor="#C0C0C0"
+ android:textSize="10sp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tvDate" />
+
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml
index bc43f1b..d0c6a2d 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml
@@ -4,13 +4,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvFolloewItemUsername"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
+ android:elevation="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
@@ -19,8 +20,8 @@
<androidx.cardview.widget.CardView
android:id="@+id/cvFragmentHomePageProfile"
- android:layout_width="100dp"
- android:layout_height="100dp"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
android:layout_gravity="center"
android:elevation="10dp"
@@ -58,13 +59,14 @@
</TextView>
<TextView
+ android:id="@+id/tvFollowerItemUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Petar Petrovic"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/materialButton"
- app:layout_constraintHorizontal_bias="0.656"
+ app:layout_constraintHorizontal_bias="0.597"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvFollowerItemName"
app:layout_constraintVertical_bias="0.0" />
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml
index 5d9e62c..f39acf2 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml
@@ -4,44 +4,56 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="#f6f6f6"
tools:context=".Fragments.FragmentHomePage">
+ <TextView
+ android:id="@+id/brzodolokacije"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="20dp"
+ android:layout_marginTop="40dp"
+ android:text="BrzoDoLokacije"
+ android:textSize="20dp"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+ <!--
<TextView
android:id="@+id/tvFragmentHomePageHelloName"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
+ android:layout_marginStart="20dp"
android:layout_marginTop="56dp"
- android:layout_marginEnd="107dp"
android:text="Zdravo, Mia"
- app:layout_constraintEnd_toStartOf="@+id/cvFragmentHomePageProfile"
- app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/cvFragmentHomePageProfile"
app:layout_constraintTop_toTopOf="parent" />
-
+ -->
<androidx.cardview.widget.CardView
android:id="@+id/cvFragmentHomePageProfile"
- android:layout_width="70dp"
- android:layout_height="70dp"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginTop="24dp"
- android:layout_marginEnd="24dp"
+ android:layout_marginEnd="16dp"
app:cardCornerRadius="250dp"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toEndOf="@+id/tvFragmentHomePageHelloName"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/ivFragmentHomePageProfile"
- android:layout_width="70dp"
- android:layout_height="70dp"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_baseline_person_24"
- tools:ignore="ContentDescription" />
+ tools:ignore="ContentDescription"
+ tools:layout_editor_absoluteX="9dp"
+ tools:layout_editor_absoluteY="15dp" />
</androidx.cardview.widget.CardView>
-
-
+<!--
<TextView
android:id="@+id/tvFragmentHomePageSearch"
android:layout_width="wrap_content"
@@ -49,34 +61,35 @@
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Pretraži lokacije"
+ android:visibility="invisible"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile" />
-
+ -->
<androidx.cardview.widget.CardView
android:id="@+id/cvFragmentHomePageSearch"
android:layout_width="0dp"
android:layout_height="40dp"
- android:layout_marginTop="10dp"
android:layout_marginStart="16dp"
+ android:layout_marginTop="45dp"
android:layout_marginEnd="16dp"
android:elevation="0dp"
app:cardCornerRadius="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/tvFragmentHomePageSearch">
+ app:layout_constraintTop_toBottomOf="@+id/brzodolokacije">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etFragmentHomePageSearch"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/rounded_white_button_login"
- android:hint=" Pretraga"
- android:paddingLeft="15dp"
- android:inputType="textPersonName" />
+ android:backgroundTint="@color/white"
+ android:hint=" Pretraži lokacije"
+ android:inputType="textPersonName"
+ android:paddingLeft="15dp" />
<com.google.android.material.button.MaterialButton
android:layout_width="49dp"
@@ -95,6 +108,7 @@
android:id="@+id/btnFragmentHomePageBack"
android:layout_width="63dp"
android:layout_height="40dp"
+ android:layout_marginTop="8dp"
android:clickable="true"
android:src="@drawable/ic_baseline_arrow_back_24"
app:layout_constraintStart_toStartOf="parent"
@@ -104,8 +118,6 @@
android:id="@+id/flFragmentHomePageMainContent"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_marginStart="16dp"
- android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -113,4 +125,17 @@
app:layout_constraintTop_toBottomOf="@+id/btnFragmentHomePageBack">
</FrameLayout>
+
+ <ImageView
+ android:id="@+id/ivFragmentHomePageChat"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="40dp"
+ android:layout_marginEnd="20dp"
+ android:clickable="true"
+ android:src="@drawable/ic_round_chat_24"
+ app:layout_constraintEnd_toStartOf="@+id/cvFragmentHomePageProfile"
+ app:layout_constraintTop_toTopOf="parent" />
+
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml
index 90d1037..07d34a3 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml
@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragments.FragmentHomePageMainScroll">
<LinearLayout
@@ -12,37 +13,47 @@
<androidx.cardview.widget.CardView
- android:id="@+id/cvFragmentHomePageText1"
+ android:backgroundTint="#f6f6f6"
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="16dp"
+app:cardElevation="0dp"
+ android:id="@+id/cvFragmentHomePageText2"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:stateListAnimator="@null"
+ android:elevation="0dp"
+ android:layout_marginTop="16dp">
<TextView
- android:id="@+id/tvFragmentHomePagePopular"
+ android:id="@+id/tvFragmentHomePageNewest"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
- android:text="Popularno"
+ android:text="Najnovije"
+ android:clickable="true"
android:textStyle="bold" />
+
<TextView
- android:id="@+id/tvFragmentHomePagePopularShowAll"
+ android:id="@+id/tvFragmentHomePageNewestShowAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:clickable="true"
- android:text="Prikaži sve"
-
- tools:ignore="TouchTargetSizeCheck" />
-
+ android:text="Prikaži sve" />
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
- android:id="@+id/rvFragmentHomePagePopular"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:id="@+id/rvFragmentHomePageNewest"
+ android:layout_marginBottom="20dp"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp" />
+ android:layout_height="wrap_content" />
<HorizontalScrollView
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
android:id="@+id/hsvFragmentHomePageLocationButtonScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -128,36 +139,72 @@
</LinearLayout>
</HorizontalScrollView>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+<LinearLayout
+ android:orientation="vertical"
+ android:id="@+id/ll1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
- android:id="@+id/cvFragmentHomePageText2"
+ android:backgroundTint="#f6f6f6"
+ android:layout_marginTop="16dp"
+ android:id="@+id/cvFragmentHomePageText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="16dp">
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:elevation="0dp"
+ app:cardElevation="0dp"
+ >
<TextView
- android:id="@+id/tvFragmentHomePageNewest"
+ android:id="@+id/tvFragmentHomePagePopular"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_gravity="left"
- android:text="Najnovije"
+ android:text="Popularno"
android:textStyle="bold" />
<TextView
- android:id="@+id/tvFragmentHomePageNewestShowAll"
+ android:id="@+id/tvFragmentHomePagePopularShowAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:clickable="true"
- android:text="Prikaži sve" />
+ android:text="Prikaži sve"
+
+ tools:ignore="TouchTargetSizeCheck" />
+
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
- android:id="@+id/rvFragmentHomePageNewest"
+ android:id="@+id/rvFragmentHomePagePopular"
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp" />
+ </LinearLayout>
+ <LinearLayout
+ android:id="@+id/ll2"
+
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
+ android:backgroundTint="#f6f6f6"
+app:cardElevation="0dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
android:id="@+id/cvFragmentHomePageText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -168,7 +215,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
- android:text="Najposećenije"
+ android:text="Najbolje ocenjeno"
android:textStyle="bold" />
<TextView
@@ -181,10 +228,13 @@
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
android:id="@+id/rvFragmentHomePageBestRated"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
+</LinearLayout></LinearLayout>
+</LinearLayout>
</LinearLayout>
-
</ScrollView> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml
index ec78de6..7531cf5 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml
@@ -188,8 +188,7 @@
<View
android:id="@+id/divider"
android:layout_width="409dp"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider"
+ android:layout_height="40dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnFragmentProfileShowMyPosts" />
@@ -241,6 +240,7 @@
android:id="@+id/flFragmentProfileFragmentContainer"
android:layout_width="409dp"
android:layout_height="319dp"
+ android:layout_marginTop="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_user_posts.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_user_posts.xml
new file mode 100644
index 0000000..59450d3
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_user_posts.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout 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=".Fragments.FragmentShowUserPosts">
+
+ <!-- TODO: Update blank fragment layout -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml
new file mode 100644
index 0000000..8b820bc
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout 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=".Fragments.FragmentUserFollowers">
+
+ <!-- TODO: Update blank fragment layout -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/rvFragmentUserFollowers"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml
new file mode 100644
index 0000000..7558375
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout 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=".Fragments.FragmentUserFollowing">
+
+ <!-- TODO: Update blank fragment layout -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/rvFragmentUserFollowing"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml
index effb6e5..a396416 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml
@@ -10,8 +10,7 @@ android:orientation="vertical"
<!-- TODO: Update blank fragment layout -->
<androidx.cardview.widget.CardView
- android:layout_marginTop="35dp"
- android:layout_width="match_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_profile_activity.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_profile_activity.xml
new file mode 100644
index 0000000..2c5012e
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_profile_activity.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout 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=".Fragments.FragmentUserPostsProfileActivity">
+
+ <!-- TODO: Update blank fragment layout -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/rvFragmentUserPostsProfileActivity"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_profile.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_profile.xml
deleted file mode 100644
index 15031e3..0000000
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_profile.xml
+++ /dev/null
@@ -1,248 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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=".Fragments.FragmentUserProfile">
-
-
- <androidx.constraintlayout.widget.ConstraintLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ImageView
-
- android:id="@+id/imageView3"
- android:layout_width="match_parent"
- android:layout_height="300dp"
- android:foreground="@drawable/b3"
- android:foregroundGravity="center_vertical|center|center_horizontal|fill"
- android:src="@drawable/b3"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
-
- <com.google.android.material.imageview.ShapeableImageView
-
- android:id="@+id/tvFragmentProfileInfoContainer"
- android:layout_width="0dp"
- android:layout_height="199dp"
- android:layout_marginStart="20dp"
- android:layout_marginTop="150dp"
- android:layout_marginEnd="20dp"
- android:adjustViewBounds="true"
- android:background="@drawable/profile_view_background"
-
- android:elevation="1dp"
- android:scaleType="fitEnd"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/imageView3"
- app:shapeAppearanceOverlay="@style/imageViewRoundedEdge" />
-
-
- <androidx.cardview.widget.CardView
- android:id="@+id/cvFragmentHomePageProfile"
- android:layout_width="140dp"
- android:layout_height="140dp"
- android:layout_gravity="center"
- android:layout_marginTop="80dp"
- android:elevation="10dp"
- app:cardCornerRadius="250dp"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent">
-
- <ImageView
-
- android:id="@+id/tvFragmentProfileProfilePicture"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:elevation="10dp"
- android:scaleType="centerCrop"
- android:src="@drawable/ic_baseline_person_24"
- tools:ignore="ContentDescription" />
- </androidx.cardview.widget.CardView>
-
- <View
- android:id="@+id/divider"
- android:layout_width="409dp"
- android:layout_height="1dp"
- android:background="?android:attr/listDivider"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/btnFragmentUserProfileShowPosts" />
-
- <Button
- android:id="@+id/btnFragmentUserProfileShowPosts"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="20dp"
- android:layout_marginTop="4dp"
- android:backgroundTint="#FFFFFF"
- android:stateListAnimator="@null"
- android:text="Objave"
-
- android:textColor="@color/cardview_dark_background"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" />
-
- <Button
- android:id="@+id/btnFragmentUserProfileShowData"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- android:layout_marginEnd="20dp"
- android:backgroundTint="#FFFFFF"
- android:stateListAnimator="@null"
- android:text="Podaci"
-
- android:textColor="@color/cardview_dark_background"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="1.0"
- app:layout_constraintStart_toEndOf="@+id/btnFragmentUserProfileShowRecensions"
- app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" />
-
- <Button
- android:id="@+id/btnFragmentUserProfileShowRecensions"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="36dp"
- android:layout_marginTop="4dp"
- android:backgroundTint="#FFFFFF"
- android:stateListAnimator="@null"
- android:text="Recenzije"
- android:textColor="@color/cardview_dark_background"
- app:layout_constraintStart_toEndOf="@+id/btnFragmentUserProfileShowPosts"
- app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" />
-
- <FrameLayout
- android:id="@+id/flFragmentProfileFragmentContainer"
- android:layout_width="409dp"
- android:layout_height="319dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/divider">
- </FrameLayout>
-
- <TableLayout
- android:elevation="1dp"
-
- android:layout_width="0dp"
- android:layout_height="0dp"
- android:layout_marginStart="30dp"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="30dp"
- android:layout_marginBottom="8dp"
- android:numColumns="3"
-
- android:stretchColumns="1"
- app:layout_constraintBottom_toBottomOf="@+id/tvFragmentProfileInfoContainer"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile">
-
- <TableRow android:layout_column="1">
-
- <TextView
- android:id="@+id/tvFragmentUserProfileName"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_column="1"
- android:layout_gravity="center"
- android:text="Petar Petrović"
- android:textSize="20sp"
- android:layout_marginBottom="5dp"/>
- </TableRow>
-
- <TableRow>
- <androidx.constraintlayout.widget.ConstraintLayout
- android:layout_span="3">
-
- <ImageButton
-
- android:id="@+id/materialButton"
- android:layout_width="115dp"
- android:layout_height="40dp"
- android:layout_marginStart="16dp"
- android:background="@drawable/rounded_transparent_button"
- android:foreground="@drawable/button_follow"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:ignore="TouchTargetSizeCheck" />
-
- <ImageButton
- android:layout_width="115dp"
- android:layout_height="40dp"
- android:layout_gravity="center"
- android:layout_marginEnd="16dp"
- android:height="40dp"
- android:background="@drawable/rounded_transparent_button"
- android:foreground="@drawable/button_chat"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:ignore="SpeakableTextPresentCheck" />
- </androidx.constraintlayout.widget.ConstraintLayout>
- </TableRow>
-
-
- <TableRow
- android:layout_marginTop="5dp">
-
- <TextView
- android:id="@+id/tvFragmentUserProfilePosts"
- android:layout_width="110dp"
- android:gravity="center"
- android:text="OBJAVE" />
-
- <TextView
- android:id="@+id/tvFragmentUserProfileFollowers"
- android:layout_width="10dp"
- android:gravity="center"
- android:text="PRATIOCI" />
-
- <TextView
- android:id="@+id/tvFragmentUserProfileFollow"
-
- android:layout_width="110dp"
- android:gravity="center"
- android:text="PRAĆENJA" />
- </TableRow>
-
- <TableRow>
-
- <TextView
- android:id="@+id/tvFragmentUserProfilePostsNo"
- android:layout_width="110dp"
- android:gravity="center"
- android:textFontWeight="700"
- android:text="156" />
-
- <TextView
- android:id="@+id/tvFragmentUserProfileFollowersNo"
- android:layout_width="110dp"
- android:gravity="center"
- android:text="50" />
-
- <TextView
- android:id="@+id/tvFragmentUserProfileFollowNo"
- android:layout_width="110dp"
- android:gravity="center"
- android:text="40" />
-
- </TableRow>
-
- </TableLayout>
-
- </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-</FrameLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/map_dialogue.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/map_dialogue.xml
new file mode 100644
index 0000000..8b48d9d
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/map_dialogue.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="300dp"
+ android:id="@+id/map_dialogue">
+
+ <org.osmdroid.views.MapView
+ android:id="@+id/MapDialogueMapView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+</RelativeLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml
index 441f97b..2d32b2d 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml
@@ -2,46 +2,106 @@
<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:layout_width="150dp"
- android:layout_height="180dp">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
<com.google.android.material.imageview.ShapeableImageView
- android:id="@+id/ivPIHPBackground"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="16dp"
- android:layout_marginBottom="8dp"
- android:scaleType="fitXY"
+ android:id="@+id/imageView9"
+ android:layout_width="170dp"
+ android:layout_height="240dp"
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="4dp"
+ android:layout_marginEnd="8dp"
+ android:layout_marginBottom="10dp"
+ android:elevation="3dp"
+ android:src="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:shapeAppearanceOverlay="@style/Circular"
- app:srcCompat="@drawable/b1" />
+ app:shapeAppearanceOverlay="@style/Circular" />
<com.google.android.material.imageview.ShapeableImageView
- android:id="@+id/ivPIHPMenu"
- android:layout_width="0dp"
- android:layout_height="22dp"
- app:layout_constraintBottom_toBottomOf="@+id/ivPIHPBackground"
-
- app:layout_constraintEnd_toEndOf="@+id/ivPIHPBackground"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="@+id/ivPIHPBackground"
- app:shapeAppearanceOverlay="@style/roundedBottom"
- app:srcCompat="@color/dark_blue_transparent" />
+ android:id="@+id/ivPIHPBackground"
+ android:layout_width="172dp"
+ android:layout_height="185dp"
+ android:layout_marginStart="1dp"
+ android:layout_marginEnd="1dp"
+ android:elevation="3dp"
+ android:scaleType="centerCrop"
+ app:layout_constraintBottom_toBottomOf="@+id/imageView9"
+ app:layout_constraintEnd_toEndOf="@id/imageView9"
+ app:layout_constraintStart_toStartOf="@id/imageView9"
+ app:layout_constraintTop_toTopOf="@id/imageView9"
+ app:layout_constraintVertical_bias="0.0"
+ app:shapeAppearanceOverlay="@style/roundedTop"
+ app:srcCompat="@drawable/b1" />
<TextView
android:id="@+id/tvPIHPLocationName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="4dp"
+ android:elevation="3dp"
+ android:text="TextView"
+ android:textSize="14sp"
+ android:textStyle="bold"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground" />
+
+ <TextView
+ android:id="@+id/tvPIHPRecension"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+
+ android:layout_marginEnd="8dp"
+ android:elevation="3dp"
android:text="TextView"
- android:textColor="@color/white"
- android:textSize="10dp"
- app:layout_constraintStart_toStartOf="@+id/ivPIHPMenu"
- app:layout_constraintTop_toTopOf="@+id/ivPIHPMenu" />
+ android:textSize="11dp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toEndOf="@+id/imageView9"
+ app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground" />
+
+ <ImageView
+ android:id="@+id/imageView10"
+
+ android:layout_width="15dp"
+ android:layout_height="15dp"
+ android:layout_marginTop="8dp"
+ android:elevation="3dp"
+ app:layout_constraintEnd_toStartOf="@+id/tvPIHPRecension"
+ app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground"
+ app:srcCompat="@drawable/ic_baseline_star_rate_24" />
+
+ <ImageView
+ android:id="@+id/imageView11"
+
+ android:layout_width="20dp"
+ android:layout_height="19dp"
+ android:layout_marginStart="12dp"
+ android:layout_marginTop="2dp"
+ android:elevation="3dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tvPIHPLocationName"
+ app:srcCompat="@drawable/ic_baseline_location_on_24" />
+
+ <TextView
+ android:id="@+id/tvPIHPLocationDetail"
+
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="4dp"
+ android:layout_marginTop="4dp"
+ android:elevation="3dp"
+ android:text="TextView"
+ android:textSize="11dp"
+ app:layout_constraintEnd_toEndOf="@+id/imageView9"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toEndOf="@+id/imageView11"
+ app:layout_constraintTop_toBottomOf="@+id/tvPIHPLocationName" />
+ " />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml
index dad1d41..73e546f 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml
@@ -2,36 +2,51 @@
<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:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_margin="0dp"
- android:background="@drawable/rounded_picture_background"
- android:clipToOutline="true"
>
- <ImageView
+ <!-- <TextView
+ android:id="@+id/tvLocationType"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Tip lokacije"
+ android:textColor="@color/unfollow"
+ tools:layout_editor_absoluteX="146dp"
+ tools:layout_editor_absoluteY="295dp" />-->
+
+ <com.google.android.material.imageview.ShapeableImageView
+ app:shapeAppearanceOverlay="@style/roundedTop"
android:id="@+id/locationImage"
android:layout_width="match_parent"
android:layout_height="250dp"
+ android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
- android:outlineProvider="background"
+ android:layout_marginEnd="16dp"
+ android:background="@drawable/b1"
android:scaleType="centerCrop"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0" />
+ app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/vBanner"
android:layout_width="match_parent"
- android:layout_height="80dp"
- android:background="@color/dark_blue_transparent"
- android:outlineProvider="background"
- app:layout_constraintBottom_toBottomOf="@+id/locationImage"
- tools:layout_editor_absoluteX="10dp">
+ android:layout_height="70dp"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp"
+ android:background="@drawable/view_bottom_corner_radius"
+ android:backgroundTint="#FFFFFF"
+ android:elevation="10dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/locationImage"
+ app:layout_constraintVertical_bias="0.0">
</View>
@@ -40,41 +55,41 @@
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginStart="28dp"
+ android:layout_marginTop="8dp"
+ android:elevation="10dp"
android:gravity="top|left"
android:text="Naslov"
- android:textColor="@color/white"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.076"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/vBanner"
- app:layout_constraintVertical_bias="0.18" />
-
- <TextView
- android:id="@+id/tvLocationType"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Tip lokacije"
- android:textColor="@color/white"
- app:layout_constraintBottom_toBottomOf="@+id/vBanner"
- app:layout_constraintEnd_toStartOf="@+id/tvLocationParent"
- app:layout_constraintHorizontal_bias="0.112"
+ android:textSize="20sp"
+ android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/vBanner"
- app:layout_constraintVertical_bias="0.721" />
+ app:layout_constraintTop_toBottomOf="@+id/locationImage" />
<TextView
+ android:elevation="10dp"
android:id="@+id/tvLocationParent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_marginStart="28dp"
+ android:layout_marginTop="4dp"
+ android:drawableLeft="@drawable/ic_baseline_location_on_24"
+
android:text="grad, drzava"
android:textAlignment="viewEnd"
- android:textColor="@color/white"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.952"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/vBanner"
- app:layout_constraintVertical_bias="0.737" />
+ app:layout_constraintTop_toBottomOf="@+id/tvTitle" />
+ <TextView
+ android:id="@+id/tvPostPreviewRating"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="40dp"
+ android:layout_marginEnd="32dp"
+ android:drawableLeft="@drawable/ic_baseline_star_rate_24"
+ android:elevation="10dp"
+ android:text="TextView"
+ android:textSize="17dp"
+ android:textStyle="bold"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/locationImage" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml
index 12c29ee..72ead29 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml
@@ -5,28 +5,25 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
- android:background="@drawable/rounded_picture_background"
- android:clipToOutline="true"
>
-
-
<View
android:id="@+id/vBannerSinglePostHistory"
android:layout_width="match_parent"
android:layout_height="80dp"
- android:background="@color/dark_blue_transparent"
- android:outlineProvider="background"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="16dp"
+ android:background="@drawable/view_corner_radius"
+ android:elevation="5dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:layout_editor_absoluteX="10dp"
- android:layout_marginTop="5dp"
- >
+ app:layout_constraintVertical_bias="0.0">
</View>
@@ -35,25 +32,29 @@
android:id="@+id/tvTitleSinglePostHistory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginStart="32dp"
+ android:elevation="5dp"
android:gravity="top|left"
android:text="Naslov"
- android:textColor="@color/white"
+ android:textSize="20sp"
+ android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.076"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/vBannerSinglePostHistory"
- app:layout_constraintVertical_bias="0.18" />
+ app:layout_constraintVertical_bias="0.246" />
<TextView
android:id="@+id/tvLocationTypeSinglePostHistory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginStart="32dp"
+ android:elevation="5dp"
android:text="Tip lokacije"
- android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="@+id/vBannerSinglePostHistory"
app:layout_constraintEnd_toStartOf="@+id/tvLocationParentSinglePostHistory"
- app:layout_constraintHorizontal_bias="0.112"
+ app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/vBannerSinglePostHistory"
app:layout_constraintVertical_bias="0.721" />
@@ -62,14 +63,16 @@
android:id="@+id/tvLocationParentSinglePostHistory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_marginEnd="32dp"
+ android:elevation="5dp"
android:text="22.11.2022"
+
android:textAlignment="viewEnd"
- android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.952"
+ app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/vBannerSinglePostHistory"
- app:layout_constraintVertical_bias="0.737" />
+ app:layout_constraintVertical_bias="0.792" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml
index 0d4da4f..fe34814 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml
@@ -7,5 +7,7 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
+ <color name="unfollow">#c4c4c4</color>
<color name="dark_blue_transparent">#DE093A4C</color>
+ <color name="button_main">#183e4b</color>
</resources> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml
index d8a3730..ca3ca44 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml
@@ -7,14 +7,20 @@
</style>
<style name="imageViewRoundedEdge" parent="">
<item name="cornerFamily">rounded</item>
- <item name="cornerSize">15dp</item>
+ <item name="cornerSize">10dp</item>
<item name="color">@color/white</item>
</style>
<style name="Circular">
- <item name="cornerSize">20dp</item>
+ <item name="cornerSize">10dp</item>
+
</style>
<style name="roundedBottom">
- <item name="cornerSizeBottomLeft">20dp</item>
- <item name="cornerSizeBottomRight">20dp</item>
+ <item name="cornerSizeBottomLeft">10dp</item>
+ <item name="cornerSizeBottomRight">10dp</item>
+ </style>
+
+ <style name="roundedTop">
+ <item name="cornerSizeTopLeft">10dp</item>
+ <item name="cornerSizeTopRight">10dp</item>
</style>
</resources> \ No newline at end of file
diff --git a/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml b/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml
index fa0f996..83368ad 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml
@@ -8,6 +8,7 @@
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
- <exclude domain="sharedpref" path="device.xml"/>
--->
+ -->
+ <exclude domain="database" path="."/>
+
</full-backup-content> \ No newline at end of file