diff options
Diffstat (limited to 'Client')
75 files changed, 3270 insertions, 1093 deletions
diff --git a/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml index 394c76a..0d90ad1 100644 --- a/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml +++ b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml @@ -7,11 +7,15 @@ <deviceKey> <Key> <type value="VIRTUAL_DEVICE_PATH" /> - <value value="C:\Users\TAMARA\.android\avd\Pixel_3a_XL_API_33.avd" /> + <value value="C:\Users\PC\.android\avd\Pixel_6_API_33.avd" /> </Key> </deviceKey> </Target> </targetSelectedWithDropDown> - <timeTargetWasSelectedWithDropDown value="2022-11-28T13:21:51.009462400Z" /> +<<<<<<< HEAD + <timeTargetWasSelectedWithDropDown value="2022-12-05T15:17:54.592850800Z" /> +======= + <timeTargetWasSelectedWithDropDown value="2022-12-06T03:10:09.596363200Z" /> +>>>>>>> 8e563f959c168a9778658c5fa2a2b143730d44fa </component> </project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/build.gradle b/Client/BrzoDoLokacije/app/build.gradle index f81ba4b..cae3d80 100644 --- a/Client/BrzoDoLokacije/app/build.gradle +++ b/Client/BrzoDoLokacije/app/build.gradle @@ -7,12 +7,12 @@ plugins { android { namespace 'com.example.brzodolokacije' - compileSdk 32 + compileSdk 33 defaultConfig { applicationId "com.example.brzodolokacije" minSdk 21 - targetSdk 32 + targetSdk 33 versionCode 1 versionName "1.0" diff --git a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml index 2241c80..49e17d8 100644 --- a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml +++ b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" /> + <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.CAMERA" android:required="true" @@ -37,6 +38,14 @@ android:usesCleartextTraffic="true" tools:targetApi="31"> <activity + android:name=".Activities.ActivityChangeUserData" + android:exported="false" + android:screenOrientation="portrait"> + <meta-data + android:name="android.app.lib_name" + android:value="" /> + </activity> + <activity android:name=".Activities.ActivityShowFollowersAndFollowing" android:exported="false" android:screenOrientation="portrait"> @@ -56,7 +65,7 @@ android:name=".Activities.ChatActivityConversation" android:exported="false" android:screenOrientation="portrait" - android:windowSoftInputMode="stateVisible|adjustPan"> + android:windowSoftInputMode="stateAlwaysHidden|adjustResize"> <meta-data android:name="android.app.lib_name" android:value="" /> @@ -82,6 +91,7 @@ android:screenOrientation="portrait" /> <activity android:name=".Activities.ActivitySinglePost" + android:windowSoftInputMode="stateAlwaysHidden|adjustPan" android:screenOrientation="portrait" /> <activity android:name=".Activities.ActivityAddPost" diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangeUserData.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangeUserData.kt new file mode 100644 index 0000000..d84b850 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangeUserData.kt @@ -0,0 +1,279 @@ +package com.example.brzodolokacije.Activities + +import android.content.Intent +import android.graphics.Color +import android.net.Uri +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import android.widget.EditText +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.core.view.isGone +import androidx.core.view.isVisible +import com.bumptech.glide.Glide +import com.exam.DBHelper.Companion.activity +import com.example.brzodolokacije.Models.UserReceive +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.MultipartBody +import okhttp3.RequestBody +import okhttp3.ResponseBody +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response +import java.io.File + +class ActivityChangeUserData : AppCompatActivity() { + private lateinit var username:EditText + private lateinit var name:EditText + private lateinit var editName:ImageView + private lateinit var editUsername:ImageView + private lateinit var confirmName:ImageView + private lateinit var confirmUsername:ImageView + private lateinit var errorName:TextView + private lateinit var errorUsername:TextView + private lateinit var back:ImageView + private lateinit var profilePicture:ImageView + private lateinit var changeProfilePicture:ImageView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_change_user_data) + + //finish() + username=findViewById(R.id.tvActivityChangeUserDataUsername) + name=findViewById(R.id.tvActivityChangeUserDataName) + editName=findViewById(R.id.btnActivityChangeUserDataName) + editUsername=findViewById(R.id.btnActivityChangeUserDataUsername) + confirmName=findViewById(R.id.btnActivityChangeUserDataNameConfirm) + confirmUsername=findViewById(R.id.btnActivityChangeUserDataUsernameConfirm) + errorName=findViewById(R.id.btnActivityChangeUserDataNameError) + errorUsername=findViewById(R.id.btnActivityChangeUserDataUsernameError) + back=findViewById(R.id.btnBackToUser) + profilePicture=findViewById(R.id.tvActivityChangeUserDataProfilePicture) + changeProfilePicture=findViewById(R.id.ChangeProfileEditImageEdit) + + editUsername.isClickable=true + editUsername.isVisible=true + editUsername.isEnabled=true + editUsername.isGone=false + confirmUsername.isClickable=false + confirmUsername.isVisible=false + confirmUsername.isEnabled=false + confirmUsername.isGone=true + errorUsername.isVisible=false + + editName.isClickable=true + editName.isVisible=true + editName.isEnabled=true + editName.isGone=false + confirmName.isClickable=false + confirmName.isVisible=false + confirmName.isEnabled=false + confirmName.isGone=true + errorName.isVisible=false + getUser() + + editUsername.setOnClickListener{ + username.setText("") + editUsername.isClickable=false + editUsername.isVisible=false + editUsername.isEnabled=false + editUsername.isGone=true + confirmUsername.isClickable=true + confirmUsername.isVisible=true + confirmUsername.isEnabled=true + confirmUsername.isGone=false + + //dodati on change listener + + confirmUsername.setOnClickListener { + changeUsername() + getUser() + + } + } + + changeProfilePicture.setOnClickListener { + addProfilePicture() + } + + editName.setOnClickListener{ + name.setText("") + editName.isClickable=false + editName.isVisible=false + editName.isEnabled=false + editName.isGone=true + confirmName.isClickable=true + confirmName.isVisible=true + confirmName.isEnabled=true + confirmName.isGone=false + + confirmName.setOnClickListener { + changeName() + + } + + } + back.setOnClickListener { + finish() + } + + + } + + fun getUser(){ + val api = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) + var data = api.selfProfile("Bearer " + token); + data.enqueue(object : Callback<UserReceive> { + override fun onResponse( + call: Call<UserReceive>, + response: Response<UserReceive> + ) { + var user=response.body()!! + + username.setText(user.username) + name.setText(user.name) + if(user.pfp!=null) { + Glide.with(this@ActivityChangeUserData) + .load(RetrofitHelper.baseUrl + "/api/post/image/" + user.pfp!!._id) + .circleCrop()//Round image + .into(profilePicture) + } + } + + override fun onFailure(call: Call<UserReceive>, t: Throwable) {} + }) + + } + + fun changeUsername(){ + val api = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) + var data = api.changeMyUsername("Bearer " + token,username.text.trim().toString()); + data.enqueue(object : Callback<Int> { + override fun onResponse( + call: Call<Int>, + response: Response<Int> + ) { + var res=response.body()!! + Log.d("res",res.toString()) + if(res==-1){ + errorUsername.isVisible=true + errorUsername.isVisible=true + errorUsername.setText("Izaberite drugo korisničko ime") + errorUsername.setTextColor(Color.RED) + } + else if(res==-2){ + errorUsername.isVisible=true + errorUsername.isVisible=true + errorUsername.setText("Nije moguće promeniti korisničko ime") + errorUsername.setTextColor(Color.RED) + } + else if(res==1){ + errorUsername.isVisible=true + errorUsername.isVisible=true + errorUsername.setText("Korisničko ime je promenjeno") + errorUsername.setTextColor(Color.GREEN) + confirmUsername.isClickable=false + confirmUsername.isVisible=false + confirmUsername.isEnabled=false + confirmUsername.isGone=true + editUsername.isClickable=true + editUsername.isVisible=true + editUsername.isEnabled=true + editUsername.isGone=false + getUser() + } + } + + override fun onFailure(call: Call<Int>, t: Throwable) { + Log.d("changeUsername","failllllllllllllllllllllll") + + } + }) + } + + fun changeName(){ + val api = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) + var data = api.changeMyName("Bearer " + token,name.text.trim().toString()); + data.enqueue(object : Callback<Boolean> { + override fun onResponse( + call: Call<Boolean>, + response: Response<Boolean> + ) { + var res=response.body()!! + Log.d("res",res.toString()) + if(res==false){ + errorName.isVisible=true + errorName.isVisible=true + errorName.setText("Nije moguće promeniti ime") + errorName.setTextColor(Color.RED) + } + else if(res){ + errorName.isVisible=true + errorName.isVisible=true + errorName.setText("Ime je promenjeno") + errorName.setTextColor(Color.GREEN) + confirmName.isClickable=false + confirmName.isVisible=false + confirmName.isEnabled=false + confirmName.isGone=true + editName.isClickable=true + editName.isVisible=true + editName.isEnabled=true + editName.isGone=false + getUser() + } + } + + override fun onFailure(call: Call<Boolean>, t: Throwable) { + Log.d("changename","faillllllllll") + + } + }) + } + private fun addProfilePicture(){ + val intent= Intent(Intent.ACTION_PICK) + intent.action = Intent.ACTION_GET_CONTENT + intent.type="image/*" + startActivityForResult(Intent.createChooser(intent,"Izaberi profilnu sliku"),201) + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + //nakon otvaranja + if(requestCode==201 && resultCode== AppCompatActivity.RESULT_OK) { + var imageUri = data!!.data + + val api =RetrofitHelper.getInstance() + var inputStream=(imageUri?.let { + this@ActivityChangeUserData.getContentResolver().openInputStream( + it + ) + }) + val file: File = File.createTempFile("temp","pfp") + file!!.writeBytes(inputStream!!.readBytes()) + var imageReq= RequestBody.create("image/*".toMediaTypeOrNull(),file) + val imageBody: MultipartBody.Part = MultipartBody.Part.createFormData("image", file.name, imageReq) + val token= SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) + val req=api.setPfp("Bearer "+token,imageBody) + + req.enqueue(object : retrofit2.Callback<ResponseBody?> { + override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) { + if(response.isSuccessful()){ + getUser() + } + } + override fun onFailure(call: Call<ResponseBody?>, t: Throwable) { + + } + }) + } + } +}
\ No newline at end of file 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 index fe0d546..dbc7299 100644 --- 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 @@ -22,6 +22,7 @@ class ActivityShowFollowersAndFollowing : AppCompatActivity() { private lateinit var fragmentContainer:FrameLayout private lateinit var followersOrFollowing:String private lateinit var userId:String + private lateinit var showMy:String private lateinit var text:TextView private lateinit var back: ImageView @@ -33,6 +34,8 @@ class ActivityShowFollowersAndFollowing : AppCompatActivity() { if (bundle != null){ userId= bundle.getString("userId").toString().trim() followersOrFollowing=bundle.get("show").toString().trim() + showMy=bundle.get("showMy").toString().trim() + } fragmentContainer=findViewById(R.id.flActivityShowFollowerAndFollowing) @@ -46,6 +49,7 @@ class ActivityShowFollowersAndFollowing : AppCompatActivity() { val mFragment = FragmentUserFollowers() val mBundle = Bundle() mBundle.putString("userId",userId) + mBundle.putString("showMy",showMy) mFragment.arguments = mBundle mFragmentTransaction.replace(R.id.flActivityShowFollowerAndFollowing, mFragment).commit() } @@ -57,32 +61,14 @@ class ActivityShowFollowersAndFollowing : AppCompatActivity() { val mFragment = FragmentUserFollowing() val mBundle = Bundle() mBundle.putString("userId",userId) + mBundle.putString("showMy",showMy) 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) { - - } - }) + finish() + } 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 edbec21..34a9e6b 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 @@ -2,29 +2,34 @@ 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.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ImageView import android.widget.TextView -import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat +import androidx.core.view.isGone +import androidx.core.view.isVisible +import androidx.fragment.app.FragmentTransaction import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.example.brzodolokacije.Adapters.CommentsAdapter import com.example.brzodolokacije.Adapters.PostImageAdapter -import com.example.brzodolokacije.Models.* +import com.example.brzodolokacije.Fragments.FragmentSinglePostComments +import com.example.brzodolokacije.Fragments.FragmentSinglePostDescription +import com.example.brzodolokacije.Models.CommentSend +import com.example.brzodolokacije.Models.PostImage +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 com.example.brzodolokacije.databinding.ActivitySinglePostBinding -import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.gson.Gson -import okhttp3.ResponseBody +import kotlinx.android.synthetic.main.fragment_single_post_description.* import org.osmdroid.config.Configuration import org.osmdroid.tileprovider.tilesource.TileSourceFactory import org.osmdroid.util.GeoPoint @@ -42,35 +47,71 @@ class ActivitySinglePost : AppCompatActivity() { private var adapterComments: RecyclerView.Adapter<CommentsAdapter.ViewHolder>? = null private var recyclerViewImages: RecyclerView?=null private var recyclerViewComments: RecyclerView?=null - private lateinit var post:PostPreview + private var favouriteImage: ImageView?=null + public lateinit var post: PostPreview + + private var comments:MutableList<CommentSend>?=mutableListOf() private var starNumber:Number=0 - private lateinit var userData:UserReceive - private lateinit var user:TextView + private lateinit var userData: UserReceive + private lateinit var user: TextView + private lateinit var linearLayout2: ConstraintLayout + private lateinit var btnChangeHeightUp:ImageView + private lateinit var btnChangeHeightDown:ImageView + private lateinit var fragmentContainer: FrameLayout override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding=ActivitySinglePostBinding.inflate(layoutInflater) setContentView(binding.root) + //get post -------------------------------- post= intent.extras?.getParcelable("selectedPost")!! + addView() + getMap() + btnChangeHeightUp=findViewById(R.id.activitySinglePostChangeHeightUp) + btnChangeHeightDown=findViewById(R.id.activitySinglePostChangeHeightDown) + btnChangeHeightDown.isVisible=false + btnChangeHeightDown.isGone=true + btnChangeHeightDown.isClickable=false + btnChangeHeightUp.isVisible=true + btnChangeHeightUp.isGone=false + btnChangeHeightUp.isClickable=true + + linearLayout2=findViewById(R.id.linearLayout2) + + linearLayout2.setOnClickListener { + linearLayout2.getLayoutParams().height= ViewGroup.LayoutParams.MATCH_PARENT; + } + + //instantiate adapter and linearLayout adapterImages= PostImageAdapter(this@ActivitySinglePost, post.images as MutableList<PostImage>) layoutManagerImages= LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false) recyclerViewImages = binding.rvMain - buildRecyclerViewComments() - requestGetComments() - // set recyclerView attributes + //DODATI SLIKE recyclerViewImages?.setHasFixedSize(true) recyclerViewImages?.layoutManager = layoutManagerImages recyclerViewImages?.adapter = adapterImages + loadTextComponents() - setRatingListeners() - translateOwnerIdToName(post.ownerId) - val alreadyrated= RatingReceive(starNumber.toInt(),post._id) - requestAddRating(alreadyrated) + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + val fragment = FragmentSinglePostDescription() + val b = Bundle() + b.putString("post", Gson().toJson(post)) + fragment.arguments = b + fm.replace(R.id.flSinglePostFragmentContainer, fragment) + fm.commit() + + /* + favouriteImage=binding.ivFavourite + // set recyclerView attributes + loadFavourite() + + */ + translateOwnerIdToName(post.ownerId) binding.tvUser.setOnClickListener { val intent: Intent = Intent(this@ActivitySinglePost,ActivityUserProfile::class.java) @@ -78,260 +119,144 @@ class ActivitySinglePost : AppCompatActivity() { 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() - - } + //DATA CONTAINER PROMENA VISINE + btnChangeHeightUp.setOnClickListener { + btnChangeHeightUp.isVisible=false + btnChangeHeightUp.isGone=true + btnChangeHeightUp.isClickable=false + btnChangeHeightDown.isVisible=true + btnChangeHeightDown.isGone=false + btnChangeHeightDown.isClickable=true + linearLayout2.setMinHeight(0); + linearLayout2.setMinimumHeight(0); + linearLayout2.getLayoutParams().height= ViewGroup.LayoutParams.MATCH_PARENT; + recyclerViewImages?.setHasFixedSize(true) + recyclerViewImages?.layoutManager = layoutManagerImages + recyclerViewImages?.adapter = adapterImages - fun buildRecyclerViewComments(){ - recyclerViewComments=binding.rvComments - adapterComments=CommentsAdapter(comments as MutableList<CommentSend>) - layoutManagerComments= LinearLayoutManager(this@ActivitySinglePost,LinearLayoutManager.VERTICAL,false) - recyclerViewComments!!.setHasFixedSize(true) - recyclerViewComments!!.layoutManager=layoutManagerComments - recyclerViewComments!!.adapter= adapterComments - } - - 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() - binding.rateStar1.setImageResource(fullStar) - binding.rateStar2.setImageResource(emptyStar) - binding.rateStar3.setImageResource(emptyStar) - binding.rateStar4.setImageResource(emptyStar) - binding.rateStar5.setImageResource(emptyStar) - starNumber=1 } - binding.rateStar2.setOnClickListener { - //Toast.makeText(this,"kliknuta druga zvezdica",Toast.LENGTH_SHORT).show() - binding.rateStar1.setImageResource(fullStar) - binding.rateStar2.setImageResource(fullStar) - binding.rateStar3.setImageResource(emptyStar) - binding.rateStar4.setImageResource(emptyStar) - binding.rateStar5.setImageResource(emptyStar) - starNumber=2 + btnChangeHeightDown.setOnClickListener { + btnChangeHeightDown.isVisible=false + btnChangeHeightDown.isGone=true + btnChangeHeightDown.isClickable=false + btnChangeHeightUp.isVisible=true + btnChangeHeightUp.isGone=false + btnChangeHeightUp.isClickable=true + linearLayout2.setMinHeight(0); + linearLayout2.setMinimumHeight(0); + linearLayout2.getLayoutParams().height= ViewGroup.LayoutParams.WRAP_CONTENT; + recyclerViewImages?.setHasFixedSize(true) + recyclerViewImages?.layoutManager = layoutManagerImages + recyclerViewImages?.adapter = adapterImages + } - binding.rateStar3.setOnClickListener { - //Toast.makeText(this,"kliknuta treca zvezdica",Toast.LENGTH_SHORT).show() - binding.rateStar1.setImageResource(fullStar) - binding.rateStar2.setImageResource(fullStar) - binding.rateStar3.setImageResource(fullStar) - binding.rateStar4.setImageResource(emptyStar) - binding.rateStar5.setImageResource(emptyStar) - starNumber=3 + + /*favouriteImage!!.setOnClickListener{ + addRemoveFavourite() } - binding.rateStar4.setOnClickListener { - //Toast.makeText(this,"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show() - binding.rateStar1.setImageResource(fullStar) - binding.rateStar2.setImageResource(fullStar) - binding.rateStar3.setImageResource(fullStar) - binding.rateStar4.setImageResource(fullStar) - binding.rateStar5.setImageResource(emptyStar) - starNumber=4 +*/ + binding.btnActivitySinglePostDescription.setOnClickListener { + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + val fragment = FragmentSinglePostDescription() + val b = Bundle() + b.putString("post", Gson().toJson(post)) + fragment.arguments = b + fm.replace(R.id.flSinglePostFragmentContainer, fragment) + fm.commit() } - binding.rateStar5.setOnClickListener { - //Toast.makeText(this,"kliknuta peta zvezdica",Toast.LENGTH_SHORT).show() - binding.rateStar1.setImageResource(fullStar) - binding.rateStar2.setImageResource(fullStar) - binding.rateStar3.setImageResource(fullStar) - binding.rateStar4.setImageResource(fullStar) - binding.rateStar5.setImageResource(fullStar) - starNumber=5 + binding.btnActivitySinglePostComments.setOnClickListener{ + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + val fragment = FragmentSinglePostComments() + val b = Bundle() + b.putString("post", Gson().toJson(post)) + fragment.arguments = b + fm.replace(R.id.flSinglePostFragmentContainer, fragment) + fm.commit() } - binding.submitRating.setOnClickListener{ - if(starNumber.toInt()>0){ - val rating= RatingReceive(starNumber.toInt(),post._id) - requestAddRating(rating) - Toast.makeText(this,"poslato",Toast.LENGTH_SHORT).show() - } - } - binding.btnPostComment.setOnClickListener { - if(binding.NewComment.text.isNotEmpty()){ - val comment=CommentReceive(binding.NewComment.text.toString(),"") - requestAddComment(comment) - } - else{ - Toast.makeText(this@ActivitySinglePost,"Unesite tekst komentara.",Toast.LENGTH_LONG).show() - } - } - addView() - } + /* + fun loadFavourite(){ + if(post.favourites!=null){ + var jwtString=SharedPreferencesHelper.getValue("jwt",this) + var jwt: JWT = JWT(jwtString!!) + var userId=jwt.getClaim("id").asString() + if(post.favourites!!.contains(userId)) + { + favouriteImage!!.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_baseline_favorite_24)) + }else{ + favouriteImage!!.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_baseline_favorite_border_24)); - fun requestAddComment(comment:CommentReceive){ - 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<CommentSend?> { - override fun onResponse(call: Call<CommentSend?>, response: Response<CommentSend?>) { - if(response.isSuccessful){ - - var newComment=response.body()!! - requestGetComments(newComment) - binding.NewComment.text.clear() - }else{ - if(response.errorBody()!=null) - Log.d("main1",response.message().toString()) - } - + } + } + } + fun addRemoveFavourite(){ + var token= SharedPreferencesHelper.getValue("jwt", this).toString() + val Api= RetrofitHelper.getInstance() + val request=Api.addRemoveFavourite("Bearer "+token,post._id) + request.enqueue(object : retrofit2.Callback<Boolean?> { + override fun onResponse(call: Call<Boolean?>, response: Response<Boolean?>) { + if(response.isSuccessful && response.body() == true) + favouriteImage!!.setImageDrawable(ContextCompat.getDrawable(this@ActivitySinglePost, R.drawable.ic_baseline_favorite_24)) + else + favouriteImage!!.setImageDrawable(ContextCompat.getDrawable(this@ActivitySinglePost, R.drawable.ic_baseline_favorite_border_24)); } - override fun onFailure(call: Call<CommentSend?>, t: Throwable) { - Log.d("main2",t.message.toString()) + override fun onFailure(call: Call<Boolean?>, t: Throwable) { + } }) - } - 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()) - } - - } - 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<RatingData?> { - override fun onResponse(call: Call<RatingData?>, response: Response<RatingData?>) { - if(response.isSuccessful){ - 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()) - } + fun getMap(){ + var map: MapView? = null + Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this)); + map=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) - } - override fun onFailure(call: Call<RatingData?>, t: Throwable) { - Log.d("main2",t.message.toString()) - } - }) } private fun loadTextComponents() { binding.apply { tvTitle.text= post.location.name tvTitle.invalidate() - tvLocationType.text="Otvorite Mapu" - tvLocationType.setTextColor(Color.BLUE) + tvLocationType.text=post.location.country.toString() tvLocationType.invalidate() - tvLocationParent.text="TODO" + tvLocationParent.text=post.location.city.toString() tvLocationParent.invalidate() tvRating.text=post.ratings.toString() tvRating.invalidate() tvNumberOfRatings.text=post.ratingscount.toString() tvNumberOfRatings.invalidate() - tvDescription.text=post.description - tvDescription.invalidate() + //tvRating.text=String.format("%.2f",data.ratings) + //tvNumberOfRatings.text=String.format("%d",data.ratingscount) + } } + fun addView() { var token= SharedPreferencesHelper.getValue("jwt", this).toString() val Api= RetrofitHelper.getInstance() @@ -354,12 +279,12 @@ class ActivitySinglePost : AppCompatActivity() { val request= api.getProfileFromId("Bearer " + token, id) request.enqueue(object : retrofit2.Callback<UserReceive> { override fun onResponse(call: Call<UserReceive>, - response: Response<UserReceive>) { + response: Response<UserReceive> + ) { if (response.body() == null) { return } userData = response.body()!! - binding.tvUser.text= userData!!.username.toString() } @@ -368,4 +293,5 @@ 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 61a5db1..4962006 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 @@ -57,6 +57,7 @@ class ActivityUserProfile : AppCompatActivity() { showFollowing=findViewById(id.tvActivityUserProfileFollow) showFollowers=findViewById(R.id.tvActivityUserProfileFollowers) + val jsonMyObject: String val extras = intent.extras if (extras != null) { @@ -141,24 +142,27 @@ class ActivityUserProfile : AppCompatActivity() { } }) } - 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) - } + showFollowers.setOnClickListener { + val bundle = Bundle() + bundle.putString("userId", userObject._id.toString()) + bundle.putString("show","followers") + bundle.putString("showMy","no") + 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) - } + } + + showFollowing.setOnClickListener { + val bundle = Bundle() + bundle.putString("userId", userObject._id.toString()) + bundle.putString("show","following") + bundle.putString("showMy","no") + val intent = Intent(this@ActivityUserProfile,ActivityShowFollowersAndFollowing::class.java) + intent.putExtras(bundle) + startActivity(intent) + } 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 951cbb4..efbfd7a 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 @@ -1,10 +1,17 @@ package com.example.brzodolokacije.Activities +import android.Manifest +import android.app.AlertDialog import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build import android.os.Bundle import android.widget.ImageButton import android.widget.Toast +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -20,11 +27,14 @@ import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.chat.SignalRListener import com.example.brzodolokacije.databinding.ActivityChatBinding import retrofit2.Call +import retrofit2.Callback import retrofit2.Response import java.util.* + class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { + private lateinit var permissionLauncher: ActivityResultLauncher<String> private var dbConnection:DBHelper?=null lateinit var binding: ActivityChatBinding var ws:SignalRListener?=null @@ -38,6 +48,41 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding= ActivityChatBinding.inflate(layoutInflater) + permissionLauncher=registerForActivityResult( + ActivityResultContracts.RequestPermission() + ) { isGranted: Boolean -> + if (!isGranted) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (Build.VERSION.SDK_INT >= 33) { + //ako je upravo odbijena dozvola na uredjaju na kome je ona neophodna + binding.btnNotifications.setImageResource(R.drawable.bell_off) + } + else{ + //ako je upravo odbijena dozvola na uredjaju na kome nije ona neophodna + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + } + else{ + //ako je upravo odbijena dozvola na uredjaju na kome nije ona neophodna + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + } + else{ + //ako je upravo prihvacena dozvola na uredjaju na kome nije ona neophodna + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + } + //provera da li je dozvoljeno + when { + ContextCompat.checkSelfPermission(this,Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED -> { + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + else -> { + binding.btnNotifications.setImageResource(R.drawable.bell_off) + } + } + + setContentView(binding.root) dbConnection= DBHelper(this@ChatActivity,null) ws=SignalRListener.getInstance(this@ChatActivity) @@ -58,12 +103,43 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { }) } + + fun launchNotificationPermissionPrompt(){ + permissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS) + } + + fun launchInfoDialog(){ + val alertDialog: AlertDialog = AlertDialog.Builder(this@ChatActivity).create() + alertDialog.setTitle("Obaveštenje") + alertDialog.setMessage("Potrebno je restartovati aplikaciju da bi se sačuvale promene.") + alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK" + ) { dialog, _ -> dialog.dismiss() } + alertDialog.show() + } + + fun setListeners(){ findViewById<ImageButton>(R.id.addNewMessage).setOnClickListener { val intent: Intent = Intent(this@ChatActivity,ChatActivityConversation::class.java) intent.putExtra("receiverId","") startActivity(intent) } + findViewById<ImageButton>(R.id.btnBack).setOnClickListener { + finish() + } + findViewById<ImageButton>(R.id.btnNotifications).setOnClickListener { + when { + ContextCompat.checkSelfPermission(this,Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + revokeSelfPermissionOnKill(Manifest.permission.POST_NOTIFICATIONS) + } + launchInfoDialog() + } + else -> { + launchNotificationPermissionPrompt() + } + } + } } fun requestForChats(){ @@ -77,7 +153,7 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { val api=RetrofitHelper.getInstance() val token=SharedPreferencesHelper.getValue("jwt",this@ChatActivity) val request2=api?.getNewMessages("Bearer "+token) - request2?.enqueue(object : retrofit2.Callback<MutableList<MessageReceive>?> { + request2?.enqueue(object : Callback<MutableList<MessageReceive>?> { override fun onResponse(call: Call<MutableList<MessageReceive>?>, response: Response<MutableList<MessageReceive>?>) { if(response.isSuccessful()){ var messages=response.body() 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 19fd836..985735f 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 @@ -1,5 +1,6 @@ package com.example.brzodolokacije.Activities +import android.graphics.Bitmap import android.os.Bundle import android.util.Log import android.view.View @@ -37,6 +38,7 @@ class ChatActivityConversation : AppCompatActivity() { var dbConnection: DBHelper?=null var webSocketConnection:SignalRListener?=null var items:MutableList<Message>?=mutableListOf() + var userImage:Bitmap?=null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -44,6 +46,7 @@ class ChatActivityConversation : AppCompatActivity() { setContentView(binding.root) userId=intent.extras?.get("userId").toString() receiverUsername=intent.extras?.get("username").toString() + userImage=intent.extras?.get("pfp") as Bitmap? dbConnection=DBHelper.getInstance(this@ChatActivityConversation) setHeader() setRecyclerView() @@ -56,85 +59,89 @@ class ChatActivityConversation : AppCompatActivity() { private fun setListeners() { findViewById<ImageButton>(R.id.btnSendMessage).setOnClickListener { var token=SharedPreferencesHelper.getValue("jwt",this@ChatActivityConversation) - var messageContent=findViewById<EditText>(R.id.etNewMessage).text.toString() + var messageContent=findViewById<EditText>(R.id.etNewMessage).text.trim().toString() val Api= RetrofitHelper.getInstance() - if(userId.isNullOrEmpty() || userId.equals("null")){ - //zahtev sa username=om - receiverUsername=findViewById<EditText>(R.id.etReceiverUsername).text.toString() - val request=Api.getProfile("Bearer "+token, - receiverUsername!! - ) - request.enqueue(object : retrofit2.Callback<UserReceive?> { - override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { - if(response.isSuccessful()){ - //zahtev da se posalje poruka - userId=response.body()?._id - setHeader() - var message= MessageSend(userId!!,messageContent) - val request2=Api.sendMessage("Bearer "+token, - message - ) - request2.enqueue(object : retrofit2.Callback<Message?> { - override fun onResponse(call: Call<Message?>, response: Response<Message?>) { - 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() + if(!messageContent.isNullOrEmpty()){ + if(userId.isNullOrEmpty() || userId.equals("null")){ + //zahtev sa username=om + receiverUsername=findViewById<EditText>(R.id.etReceiverUsername).text.toString() + val request=Api.getProfile("Bearer "+token, + receiverUsername!! + ) + request.enqueue(object : retrofit2.Callback<UserReceive?> { + override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { + if(response.isSuccessful()){ + //zahtev da se posalje poruka + var user:UserReceive=response.body()!! + userId=user._id + setHeader() + var message= MessageSend(userId!!,messageContent) + val request2=Api.sendMessage("Bearer "+token, + message + ) + request2.enqueue(object : retrofit2.Callback<Message?> { + override fun onResponse(call: Call<Message?>, response: Response<Message?>) { + 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!!,username=user.username) + requestMessages() + binding.etNewMessage.text?.clear() + } + else{ + Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime1.",Toast.LENGTH_LONG).show() + } } - else{ - Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime1.",Toast.LENGTH_LONG).show() + + override fun onFailure(call: Call<Message?>, t: Throwable) { + Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime2.",Toast.LENGTH_LONG).show() } - } + }) + } + else{ + Log.d("main",response.message()) + //Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime3.",Toast.LENGTH_LONG).show() + } + } - override fun onFailure(call: Call<Message?>, t: Throwable) { - Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime2.",Toast.LENGTH_LONG).show() - } - }) + override fun onFailure(call: Call<UserReceive?>, t: Throwable) { + Toast.makeText(this@ChatActivityConversation,"fail.",Toast.LENGTH_LONG).show() } - else{ - Log.d("main",response.message()) - //Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime3.",Toast.LENGTH_LONG).show() + }) + } + else{ + //zahtev da se posalje poruka + var message= MessageSend(userId!!,messageContent) + val request2=Api.sendMessage("Bearer "+token, + message + ) + request2.enqueue(object : retrofit2.Callback<Message?> { + override fun onResponse(call: Call<Message?>, response: Response<Message?>) { + 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!!,username=receiverUsername) + requestMessages() + binding.etNewMessage.text?.clear() + } + else{ + Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime.",Toast.LENGTH_LONG).show() + } } - } - override fun onFailure(call: Call<UserReceive?>, t: Throwable) { - Toast.makeText(this@ChatActivityConversation,"fail.",Toast.LENGTH_LONG).show() - } - }) - } - else{ - //zahtev da se posalje poruka - var message= MessageSend(userId!!,messageContent) - val request2=Api.sendMessage("Bearer "+token, - message - ) - request2.enqueue(object : retrofit2.Callback<Message?> { - override fun onResponse(call: Call<Message?>, response: Response<Message?>) { - 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() - } - else{ + override fun onFailure(call: Call<Message?>, t: Throwable) { Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime.",Toast.LENGTH_LONG).show() } - } + }) + } - override fun onFailure(call: Call<Message?>, t: Throwable) { - Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime.",Toast.LENGTH_LONG).show() - } - }) } } @@ -144,19 +151,24 @@ class ChatActivityConversation : AppCompatActivity() { if(userId.isNullOrEmpty() || userId.equals("null")){ binding.cvParentUsername.visibility= View.VISIBLE binding.cvParentUsername.forceLayout() - binding.tvFragmentTitle.visibility= View.GONE - binding.tvFragmentTitle.invalidate() - binding.tvFragmentTitle.forceLayout() + binding.llHeader.visibility= View.GONE + binding.llHeader.invalidate() + binding.llHeader.forceLayout() } else{ - binding.tvFragmentTitle.visibility= View.VISIBLE - binding.tvFragmentTitle.invalidate() - binding.tvFragmentTitle.forceLayout() + binding.llHeader.visibility= View.VISIBLE + binding.llHeader.invalidate() + binding.llHeader.forceLayout() binding.tvFragmentTitle.text=receiverUsername binding.tvFragmentTitle.invalidate() binding.cvParentUsername.visibility= View.GONE binding.cvParentUsername.forceLayout() } + binding.btnBack.setOnClickListener { + finish() + } + if(userImage!=null) + binding.ivUserImage.setImageBitmap(userImage) } fun setRecyclerView(setParams:Boolean=true){ MainScope().launch { @@ -173,6 +185,7 @@ class ChatActivityConversation : AppCompatActivity() { } catch (e: Exception) { Log.d("error", e.message!!) } + recyclerView?.addOnLayoutChangeListener { _, i, i2, i3, i4, i5, i6, i7, i8 -> recyclerView?.scrollToPosition(items?.size?.minus(1) ?: 0) } recyclerView?.scrollToPosition(items?.size?.minus(1) ?: 0) } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/NavigationActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/NavigationActivity.kt index 180b59d..23cbca6 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/NavigationActivity.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/NavigationActivity.kt @@ -18,19 +18,20 @@ class NavigationActivity : AppCompatActivity() { //lateinit var openAddPost:Button //lateinit var capturePost:Button - + public lateinit var bottomNav:BottomNavigationView + public lateinit var searchQuery:String + public lateinit var searchId:String override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_navigation) - Toast.makeText( - applicationContext, "Open ", Toast.LENGTH_LONG - ).show(); + searchQuery="" + searchId="" val fragmentHomePage=FragmentHomePage() val fragmentShowPosts=FragmentShowPosts() val browseFragment=FragmentBrowse() val addPostFragment= FragmentAddNew() val profileFragment=FragmentProfile() - val bottomNav=findViewById<View>(R.id.bottomNavigationView) as BottomNavigationView + bottomNav=findViewById<View>(R.id.bottomNavigationView) as BottomNavigationView setCurrentFragment(fragmentHomePage) bottomNav.setOnNavigationItemSelectedListener { when(it.itemId){ @@ -46,6 +47,7 @@ class NavigationActivity : AppCompatActivity() { } + } private fun setCurrentFragment(fragment: Fragment)= supportFragmentManager.beginTransaction().apply { 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 6e62180..be564f4 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 @@ -5,6 +5,8 @@ import android.graphics.Typeface import android.view.LayoutInflater import android.view.ViewGroup import android.widget.Toast +import androidx.core.content.ContextCompat +import androidx.core.graphics.drawable.toBitmap import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.exam.DBHelper @@ -13,12 +15,14 @@ import com.example.brzodolokacije.Activities.ChatActivityConversation import com.example.brzodolokacije.Interfaces.IBackendApi import com.example.brzodolokacije.Models.ChatPreview 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.example.brzodolokacije.databinding.ChatPreviewBinding import kotlinx.android.synthetic.main.chat_preview.view.* import retrofit2.Call import retrofit2.Response +import java.util.* class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:ChatActivity) : RecyclerView.Adapter<ChatPreviewsAdapter.ViewHolder>(){ @@ -42,6 +46,7 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha val intent: Intent = Intent(activity, ChatActivityConversation::class.java) intent.putExtra("userId",items[position].userId) intent.putExtra("username",holder.itemView.tvUsername.text) + intent.putExtra("pfp",holder.itemView.ivUserImage.drawable.toBitmap(200,200)) db.readContact(items[position].userId) items[position].read=true holder.itemView.tvUsername.typeface= Typeface.DEFAULT @@ -61,11 +66,12 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha //zahtev da se posalje poruka var user=response.body()!! if(!item.read) - tvUsername.typeface= Typeface.DEFAULT_BOLD + setUnread() tvUsername.text=user.username if(user.pfp!=null) { Glide.with(activity) .load(RetrofitHelper.baseUrl + "/api/post/image/" + user.pfp!!._id) + .circleCrop() .into(ivUserImage) } } @@ -81,7 +87,41 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha Toast.LENGTH_LONG).show() } }) + var lastMessage=db.getLastMessage(item.userId) + tvUsername.text=item.username + if(lastMessage!=null){ + tvLastMessage.text=lastMessage.messagge + if(layoutPosition==0 || isDifferentDays(lastMessage.usableTimeStamp,Calendar.getInstance())){ + tvLastMessageDate.text=lastMessage.usableTimeStamp.get(Calendar.HOUR_OF_DAY).toString() + ":" + lastMessage.usableTimeStamp.get( + Calendar.MINUTE).toString() + } + else{ + tvLastMessageDate.text=lastMessage.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+ + (lastMessage.usableTimeStamp.get(Calendar.MONTH)+1).toString()+"/"+ + lastMessage.usableTimeStamp.get(Calendar.YEAR).toString() + } + + } } } + 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 + } + fun setUnread(){ + itemView.tvUsername.typeface= Typeface.DEFAULT_BOLD + itemView.tvUsername.invalidate() + itemView.tvLastMessage.typeface= Typeface.DEFAULT_BOLD + itemView.tvLastMessage.invalidate() + itemView.tvLastMessageDate.typeface= Typeface.DEFAULT_BOLD + itemView.tvLastMessageDate.invalidate() + itemView.readIndicator.background= ContextCompat.getDrawable(activity,R.color.dark_blue_transparent) + itemView.readIndicator.invalidate() + } } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/CommentsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/CommentsAdapter.kt index d43057f..8f737a3 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/CommentsAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/CommentsAdapter.kt @@ -1,19 +1,41 @@ package com.example.brzodolokacije.Adapters +import android.app.Activity +import android.content.Context +import android.util.Log import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager +import android.widget.EditText +import android.widget.Toast +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import com.bumptech.glide.Glide +import com.example.brzodolokacije.Activities.ActivitySinglePost +import com.example.brzodolokacije.Interfaces.IBackendApi +import com.example.brzodolokacije.Models.CommentReceive import com.example.brzodolokacije.Models.CommentSend +import com.example.brzodolokacije.Models.UserReceive +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.databinding.SingleCommentBinding +import kotlinx.android.synthetic.main.single_comment.view.* +import retrofit2.Call +import retrofit2.Response -class CommentsAdapter (val items : MutableList<CommentSend>) +class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activity) : RecyclerView.Adapter<CommentsAdapter.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: SingleCommentBinding override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val inflater = LayoutInflater.from(parent.context) binding=SingleCommentBinding.inflate(inflater,parent,false) + api=RetrofitHelper.getInstance() + token=SharedPreferencesHelper.getValue("jwt",activity) return ViewHolder(binding) } override fun onBindViewHolder(holder: ViewHolder, position: Int){ @@ -32,7 +54,131 @@ class CommentsAdapter (val items : MutableList<CommentSend>) binding.apply { tvCommentAuthor.text=item.username tvCommentText.text=item.comment + Log.d("info",tvCommentText.text.toString()+binding.toString()) + requestProfilePic(item) + llReply.visibility=View.GONE + llReply.forceLayout() + if(item.parentId!=""){ + btnReply.visibility=View.GONE + btnReply.forceLayout() + } + else{ + btnReply.setOnClickListener { + llReply.visibility=View.VISIBLE + llReply.forceLayout() + etReply.requestFocus() + } + } + etReply.showSoftInputOnFocus=true + etReply.setOnFocusChangeListener { _, focused -> + if(!focused){ + llReply.visibility= View.GONE + llReply.forceLayout() + //btnReply.setImageResource(R.drawable.) + hideKeyboard(etReply) + } + else{ + showKeyboard(etReply) + btnPostReply.setOnClickListener{ + if(etReply.text.isNotEmpty()){ + val postId=(activity as ActivitySinglePost).post._id + Log.d("main",binding.toString()) + val comment= CommentReceive(etReply.text.toString(),item._id) + requestAddComment(comment,postId) + } + else{ + Log.d("komentari","greska") + } + } + } + } + + + var rv: RecyclerView = rvReplies + rv.setHasFixedSize(true) + rv.layoutManager=LinearLayoutManager(activity,LinearLayoutManager.VERTICAL,false) + if(item.replies!=null) + rv.adapter=CommentsAdapter(item.replies as MutableList<CommentSend>,activity) + else + rv.adapter=CommentsAdapter(mutableListOf(),activity) } } + fun showKeyboard(item:EditText){ + var imm:InputMethodManager=activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.showSoftInput(item,InputMethodManager.SHOW_IMPLICIT) + } + + fun hideKeyboard(item: EditText){ + var imm:InputMethodManager=activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(item.windowToken,InputMethodManager.HIDE_NOT_ALWAYS) + } + fun requestAddComment(comment:CommentReceive,postId:String){ + val postApi= RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt", activity) + val request=postApi.addComment("Bearer "+token,postId,comment) + request.enqueue(object : retrofit2.Callback<CommentSend?> { + override fun onResponse(call: Call<CommentSend?>, response: Response<CommentSend?>) { + if(response.isSuccessful){ + var newComment=response.body()!! + requestGetComments(newComment) + itemView.etReply.text.clear() + hideKeyboard(itemView.etReply) + itemView.etReply.clearFocus() + }else{ + if(response.errorBody()!=null) + Log.d("main1",response.message().toString()) + } + + + } + + override fun onFailure(call: Call<CommentSend?>, t: Throwable) { + Log.d("main2",t.message.toString()) + } + }) + } + + private fun requestGetComments(newComment: CommentSend) { + var rv: RecyclerView = itemView.rvReplies + var adapter:CommentsAdapter=rv.adapter as CommentsAdapter + adapter.items.add(0,newComment) + rv.adapter=adapter + //(activity as ActivitySinglePost).addedComment() + } + + private fun requestProfilePic(item:CommentSend){ + val request2=api?.getProfileFromId("Bearer "+token, + item.userId + ) + request2?.enqueue(object : retrofit2.Callback<UserReceive?> { + override fun onResponse( + call: Call<UserReceive?>, + response: Response<UserReceive?> + ) { + if (response.isSuccessful) { + var user = response.body()!! + if (user.pfp != null) { + Glide.with(activity) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + user.pfp!!._id) + .circleCrop() + .into(itemView.ivPfp) + } + } else { + Toast.makeText( + activity, "los id", + Toast.LENGTH_LONG + ).show() + itemView.tvCommentAuthor.text = "nije nadjen korisnik" + } + } + + override fun onFailure(call: Call<UserReceive?>, t: Throwable) { + Toast.makeText( + activity, "neuspesan zahtev", + Toast.LENGTH_LONG + ).show() + } + }) + } } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentSinglePostComments.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentSinglePostComments.kt new file mode 100644 index 0000000..f2b11ab --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentSinglePostComments.kt @@ -0,0 +1,59 @@ +package com.example.brzodolokacije + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentSinglePostComments.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentSinglePostComments : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_single_post_comments, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment FragmentSinglePostComments. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + FragmentSinglePostComments().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +}
\ 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 57e1833..a0d6146 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 @@ -197,7 +197,6 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) { } } private fun getMarkers(){ - val startMarker = Marker(map) var api=RetrofitHelper.getInstance() var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity()) var data=api.getPosts("Bearer "+jwtString) 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 cb48d3e..a26aaba 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 @@ -2,27 +2,31 @@ package com.example.brzodolokacije.Fragments import android.content.Intent import android.os.Bundle +import android.util.Log +import android.view.KeyEvent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button -import android.widget.ImageButton -import android.widget.ImageView -import android.widget.ScrollView -import android.widget.Toast +import android.widget.* import androidx.core.view.isVisible +import androidx.core.widget.addTextChangedListener 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.Activities.NavigationActivity import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter import com.example.brzodolokacije.Interfaces.IBackendApi +import com.example.brzodolokacije.Models.Location import com.example.brzodolokacije.Models.LocationType import com.example.brzodolokacije.Models.PostPreview +import com.example.brzodolokacije.Models.SearchParams import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.RetrofitHelper.baseUrl import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.android.material.button.MaterialButton import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -34,6 +38,9 @@ class FragmentHomePage : Fragment() { private lateinit var btnChat:ImageView private lateinit var btnBack:ImageView + private lateinit var searchBar:AutoCompleteTextView + private lateinit var searchButton: MaterialButton + var responseLocations:MutableList<com.example.brzodolokacije.Models.Location>?=null /* override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -47,8 +54,10 @@ class FragmentHomePage : 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) + searchBar=view.findViewById(R.id.etFragmentHomePageSearch) + searchButton=view.findViewById(R.id.mbFragmentHomePageSearchButton) setBtnBackInvisible() - + setUpSpinner() var fm: FragmentTransaction =childFragmentManager.beginTransaction() fm.replace(R.id.flFragmentHomePageMainContent, FragmentHomePageMainScroll()) fm.commit() @@ -62,9 +71,36 @@ class FragmentHomePage : Fragment() { val intent: Intent = Intent(activity, ChatActivity::class.java) requireActivity().startActivity(intent) } + searchButton.setOnClickListener{ + searchText() + } + searchBar.addTextChangedListener{ + onTextEnter() + } + 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 && + keyCode == KeyEvent.KEYCODE_ENTER + ) { + // Perform action on key press + searchText() + return@OnKeyListener true + } + false + }) return view } + + + fun searchText(){ + if(searchBar.text==null || searchBar.text.toString().trim()=="") + return + + var act=requireActivity() as NavigationActivity + act.searchQuery=searchBar.text.toString() + act.searchId="" + act.bottomNav.selectedItemId=R.id.navAllPosts + } fun changeScrollVIewToLocationView(){ var fm: FragmentTransaction =childFragmentManager.beginTransaction() fm.replace(R.id.flFragmentHomePageMainContent, FragmentShowPostsByLocation()) @@ -81,4 +117,59 @@ class FragmentHomePage : Fragment() { fun setBtnBackVisible(){ btnBack.isVisible=true } + fun onTextEnter(){ + var api= RetrofitHelper.getInstance() + var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity()) + var text=searchBar.text + Log.d("test",text.toString()) + 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<Location>?>, response: Response<MutableList<Location>>) { + if(response.isSuccessful){ + var existingLocation=responseLocations + responseLocations=response.body()!! + 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<Location>>, t: Throwable) { + + } + }) + + + } + var arraySpinner :MutableList<String>?=null + var spinnerAdapter: ArrayAdapter<String>?=null + + fun setUpSpinner() { + arraySpinner=mutableListOf<String>() + spinnerAdapter= ArrayAdapter<String>( + requireContext(), + android.R.layout.simple_list_item_1, arraySpinner!!) + searchBar.threshold=1 + searchBar.setAdapter(spinnerAdapter) + searchBar.setOnItemClickListener(AdapterView.OnItemClickListener { parent, view, position, id -> + val selected = parent.getItemAtPosition(position) as String + var selectedLocation = responseLocations!!.find { location -> location.name == selected } + + var act=requireActivity() as NavigationActivity + act.searchQuery=selectedLocation!!.name + act.searchId=selectedLocation!!._id + act.bottomNav.selectedItemId=R.id.navAllPosts + + + }) + + + } } 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 46904d4..82c78a1 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 @@ -239,9 +239,6 @@ private lateinit var change:Button // Toast.makeText( // activity, "get all mv ", Toast.LENGTH_LONG // ).show(); - 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) 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 9cce17f..d6e345b 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 @@ -6,36 +6,19 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button +import androidx.core.content.ContextCompat.startActivity import androidx.fragment.app.Fragment import com.exam.DBHelper +import com.example.brzodolokacije.Activities.ActivityChangeUserData +import com.example.brzodolokacije.Activities.ActivityForgottenPassword import com.example.brzodolokacije.Activities.ActivityLoginRegister import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.SharedPreferencesHelper -// TODO: Rename parameter arguments, choose names that match -// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER -private const val ARG_PARAM1 = "param1" -private const val ARG_PARAM2 = "param2" -/** - * A simple [Fragment] subclass. - * Use the [FragmentMyProfileInfo.newInstance] factory method to - * create an instance of this fragment. - */ class FragmentMyProfileInfo : Fragment() { private lateinit var logout:Button - // TODO: Rename and change types of parameters - private var param1: String? = null - private var param2: String? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - arguments?.let { - param1 = it.getString(ARG_PARAM1) - param2 = it.getString(ARG_PARAM2) - } - - } + private lateinit var changeAccount:Button override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -45,9 +28,15 @@ class FragmentMyProfileInfo : Fragment() { var view=inflater.inflate(R.layout.fragment_my_profile_info, container, false) logout=view.findViewById<View>(R.id.buttonLogOut) as Button + changeAccount=view.findViewById(R.id.changeAccountData) + logout.setOnClickListener{ logOut() + } + changeAccount.setOnClickListener { + val intent = Intent (getActivity(), ActivityChangeUserData::class.java) + getActivity()?.startActivity(intent) } return view 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 669b978..6fe4678 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 @@ -4,6 +4,7 @@ package com.example.brzodolokacije.Fragments import android.content.Intent import android.net.Uri import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -15,6 +16,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentTransaction import com.bumptech.glide.Glide +import com.example.brzodolokacije.Activities.ActivityShowFollowersAndFollowing import com.example.brzodolokacije.Models.UserReceive import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper @@ -44,8 +46,8 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr private lateinit var username: TextView private lateinit var name: TextView private lateinit var postsCount: TextView - private lateinit var followersCount: TextView - private lateinit var followingCount:TextView + private lateinit var followersNumber: TextView + private lateinit var followingNumber:TextView private lateinit var usernameString: String private lateinit var nameString: String private lateinit var postsCountString: String @@ -59,8 +61,6 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr private lateinit var showFollowers: TextView private lateinit var showFollowing: TextView - var userId:String = "1" - override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -74,8 +74,8 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr name = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileName) as TextView username = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileUserName) as TextView postsCount = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfilePostsNo) as TextView - followersCount = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileFollowersNo) as TextView - followingCount = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileFollowNo) as TextView + followersNumber = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileFollowersNo) as TextView + followingNumber = view.findViewById<View>(com.example.brzodolokacije.R.id.tvFragmentProfileFollowNo) as TextView showMyPosts=view.findViewById<View>(com.example.brzodolokacije.R.id.btnFragmentProfileShowMyPosts) as Button showMyData=view.findViewById<View>(com.example.brzodolokacije.R.id.btnFragmentProfileShowMyData) as Button showMyRecensions=view.findViewById<View>(com.example.brzodolokacije.R.id.btnFragmentProfileShowMyRecensions) as Button @@ -114,26 +114,22 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr showFollowers.setOnClickListener { val bundle = Bundle() - bundle.putString("userId",userId ) - val fragmentFollowers = FragmentFollowers() - fragmentFollowers.setArguments(bundle) - - fragmentManager - ?.beginTransaction() - ?.replace(com.example.brzodolokacije.R.id.flNavigationFragment,fragmentFollowers) - ?.commit() + bundle.putString("userId","error") + bundle.putString("show","followers") + bundle.putString("showMy","yes") + val intent = Intent(activity, ActivityShowFollowersAndFollowing::class.java) + intent.putExtras(bundle) + startActivity(intent) } showFollowing.setOnClickListener { val bundle = Bundle() - bundle.putString("userId",userId) - val fragmentFollowing = FragmentFollowing() - fragmentFollowing.setArguments(bundle) - - fragmentManager - ?.beginTransaction() - ?.replace(com.example.brzodolokacije.R.id.flNavigationFragment,fragmentFollowing) - ?.commit() + bundle.putString("userId","error") + bundle.putString("show","following") + bundle.putString("showMy","yes") + val intent = Intent(activity,ActivityShowFollowersAndFollowing::class.java) + intent.putExtras(bundle) + startActivity(intent) } getProfileInfo() openMyPosts() @@ -213,11 +209,11 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr name.setText(user.name) username.setText("@"+user.username) postsCount.setText(user.postcount.toString()) + Log.d("follno",user.followersCount.toString()) + Log.d("follno","helllllllllllllllllllllppppppppppppppppppppppppppppppp") + followersNumber.text=user.followersCount.toString() + followingNumber.text=user.followingCount.toString() - followersCount.setText(user.followersCount.toString()) - followingCount.setText(user.followingCount.toString()) - - userId=user._id //Add Profile image if(user.pfp!=null) { diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPosts.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPosts.kt index a840d6b..76fa4e0 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPosts.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPosts.kt @@ -3,13 +3,13 @@ package com.example.brzodolokacije.Fragments import android.content.Intent import android.os.Bundle import android.util.Log +import android.view.KeyEvent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button -import android.widget.EditText -import android.widget.ImageButton -import android.widget.Toast +import android.widget.* +import androidx.core.content.ContextCompat +import androidx.core.widget.addTextChangedListener import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope @@ -19,18 +19,27 @@ import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.example.brzodolokacije.Activities.ActivityAddPost import com.example.brzodolokacije.Activities.ChatActivity +import com.example.brzodolokacije.Activities.NavigationActivity import com.example.brzodolokacije.Adapters.ShowPostsAdapter +import com.example.brzodolokacije.Models.Location import com.example.brzodolokacije.Models.SearchParams import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.databinding.FragmentShowPostsBinding import com.example.brzodolokacije.paging.SearchPostsViewModel import com.example.brzodolokacije.paging.SearchPostsViewModelFactory import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.button.MaterialButton import kotlinx.android.synthetic.main.fragment_show_posts.* import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch +import org.osmdroid.util.GeoPoint +import org.osmdroid.views.overlay.ItemizedIconOverlay +import org.osmdroid.views.overlay.OverlayItem +import retrofit2.Call +import retrofit2.Response class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { @@ -41,10 +50,14 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { private var recyclerView: RecyclerView?=null private var gridManagerVar: RecyclerView.LayoutManager?=null private var swipeRefreshLayout:SwipeRefreshLayout?=null + private lateinit var searchButton: MaterialButton private lateinit var searchPostsViewModel:SearchPostsViewModel - private var searchParams:SearchParams?= SearchParams("6375784fe84e2d53df32bf03",1,1) + private var searchParams:SearchParams?= SearchParams("Kragujevac",1,1) private lateinit var btnFilter:ImageButton private lateinit var btnSort:ImageButton + private lateinit var searchBar: AutoCompleteTextView + var responseLocations:MutableList<com.example.brzodolokacije.Models.Location>?=null + var selectedLocation:com.example.brzodolokacije.Models.Location?=null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -55,7 +68,69 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { linearManagerVar= LinearLayoutManager(activity) gridManagerVar=GridLayoutManager(activity,2) } + fun searchText(){ + if(searchBar.text==null || searchBar.text.toString().trim()=="") + return + var act=requireActivity() as NavigationActivity + act.searchQuery=searchBar.text.toString() + act.searchId="" + searchParams=SearchParams(searchBar.text.toString(),1,1) + requestToBack(searchParams!!) + } + fun onTextEnter(){ + var api=RetrofitHelper.getInstance() + var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity()) + var text=searchBar.text + Log.d("test",text.toString()) + 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<Location>?>, response: Response<MutableList<Location>>) { + if(response.isSuccessful){ + var existingLocation=responseLocations + responseLocations=response.body()!! + 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<Location>>, t: Throwable) { + + } + }) + + + } + var arraySpinner :MutableList<String>?=null + var spinnerAdapter: ArrayAdapter<String>?=null + + fun setUpSpinner() { + arraySpinner=mutableListOf<String>() + spinnerAdapter= ArrayAdapter<String>( + requireContext(), + android.R.layout.simple_list_item_1, arraySpinner!!) + searchBar.threshold=1 + searchBar.setAdapter(spinnerAdapter) + searchBar.setOnItemClickListener(AdapterView.OnItemClickListener { parent, view, position, id -> + val selected = parent.getItemAtPosition(position) as String + selectedLocation = responseLocations!!.find { location -> location.name == selected } + var act=requireActivity() as NavigationActivity + act.searchQuery=selectedLocation!!.name + act.searchId=selectedLocation!!._id + searchParams=SearchParams(selectedLocation!!._id,1,1)//to do sort type + requestToBack(searchParams!!) + + }) + + } private fun setUpViewModel() { val factory=SearchPostsViewModelFactory(RetrofitHelper.getInstance(),requireActivity()) searchPostsViewModel=ViewModelProvider(this@FragmentShowPosts,factory).get(SearchPostsViewModel::class.java) @@ -126,11 +201,55 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { btnSort.setOnClickListener{ showBottomSheetSort() } + searchBar=rootView.findViewById(R.id.etFragmentShowPostsSearch) as AutoCompleteTextView + searchButton=rootView.findViewById<View>(R.id.mbFragmentHomePageSearch) as MaterialButton + setUpSpinner() + searchButton.setOnClickListener{ + searchText() + } + searchBar.addTextChangedListener{ + onTextEnter() + } + 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 && + keyCode == KeyEvent.KEYCODE_ENTER + ) { + // Perform action on key press + searchText() + return@OnKeyListener true + } + false + }) + refreshSearch() + + return rootView } override fun onRefresh() { requestToBack(searchParams!!) + refreshSearch() + } + override fun onResume() { + super.onResume() + refreshSearch() + + } + private fun refreshSearch(){ + var act=requireActivity() as NavigationActivity + Log.d("TEST","USAO") + if(act.searchId!=null && act.searchId.trim()!="") + { + searchBar.setText(act.searchQuery,TextView.BufferType.EDITABLE) + searchParams= SearchParams(act.searchId,1,1) + requestToBack(searchParams!!) + }else + if(act.searchQuery!=null && act.searchQuery.trim()!="") + { + searchBar.setText(act.searchQuery,TextView.BufferType.EDITABLE) + searchParams= SearchParams(act.searchQuery,1,1) + requestToBack(searchParams!!) + } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostComments.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostComments.kt new file mode 100644 index 0000000..45fbcba --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostComments.kt @@ -0,0 +1,168 @@ +package com.example.brzodolokacije.Fragments + +import android.content.Context +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 android.view.inputmethod.InputMethodManager +import android.widget.EditText +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.brzodolokacije.Adapters.CommentsAdapter +import com.example.brzodolokacije.Adapters.PostImageAdapter +import com.example.brzodolokacije.Models.CommentReceive +import com.example.brzodolokacije.Models.CommentSend +import com.example.brzodolokacije.Models.PostPreview +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.android.material.internal.ViewUtils.hideKeyboard +import com.google.gson.Gson +import org.w3c.dom.Text +import retrofit2.Call +import retrofit2.Response + +class FragmentSinglePostComments : Fragment() { + + private lateinit var commentsContainer:RecyclerView + private lateinit var commentsCount: TextView + private lateinit var newComment: EditText + private lateinit var postComment: ImageView + private lateinit var post:PostPreview + + private var layoutManagerComments: RecyclerView.LayoutManager? = null + private var adapterComments: RecyclerView.Adapter<CommentsAdapter.ViewHolder>? = null + private var recyclerViewComments: RecyclerView?=null + private var comments:MutableList<CommentSend>?=mutableListOf() + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + var view= inflater.inflate(R.layout.fragment_single_post_comments, container, false) + + var args = arguments + var jsonPostObject = args!!.getString("post") + post= Gson().fromJson(jsonPostObject, PostPreview::class.java) + + commentsContainer=view.findViewById(R.id.rvComments) + commentsCount=view.findViewById(R.id.tvCommentCount) + newComment=view.findViewById(R.id.NewComment) + postComment=view.findViewById(R.id.btnPostComment) + + buildRecyclerViewComments() + requestGetComments() + + postComment.setOnClickListener { + if(newComment.text.isNotEmpty()){ + val comment=CommentReceive(newComment.text.toString(),"") + requestAddComment(comment) + + + } + else{ + Toast.makeText(requireActivity(),"Unesite tekst komentara.",Toast.LENGTH_LONG).show() + } + } + + return view + } + + fun requestAddComment(comment: CommentReceive){ + val postApi= RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) + val request=postApi.addComment("Bearer "+token,post._id,comment) + request.enqueue(object : retrofit2.Callback<CommentSend?> { + override fun onResponse(call: Call<CommentSend?>, response: Response<CommentSend?>) { + if(response.isSuccessful){ + + var newComment1=response.body()!! + requestGetComments(newComment1) + newComment.text.clear() + hideKeyboard(newComment) + + }else{ + if(response.errorBody()!=null) + Log.d("main1",response.message().toString()) + } + + + } + + override fun onFailure(call: Call<CommentSend?>, t: Throwable) { + Log.d("main2",t.message.toString()) + } + }) + } + fun requestGetComments(newComment:CommentSend?=null){ + if(newComment==null){ + val postApi= RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) + 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) + commentsCount.text=countComments(comments!!).toString() + else + commentsCount.text="12" + } + }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()) + } + }) + } + else{ + (adapterComments as CommentsAdapter).items.add(0,newComment) + recyclerViewComments?.adapter=adapterComments + addedComment() + } + } + + fun buildRecyclerViewComments(){ + recyclerViewComments=commentsContainer + adapterComments=CommentsAdapter(comments as MutableList<CommentSend>,requireActivity()) + layoutManagerComments= LinearLayoutManager(requireActivity(),LinearLayoutManager.VERTICAL,false) + recyclerViewComments!!.setHasFixedSize(false) + recyclerViewComments!!.layoutManager=layoutManagerComments + recyclerViewComments!!.adapter= adapterComments + } + fun hideKeyboard(item: EditText){ + var imm: InputMethodManager =activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(item.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) + } + + fun countComments(comments:List<CommentSend>):Int{ + var count:Int=0 + for(c in comments){ + if(c.replies!=null) + count=count+countComments(c.replies!!) + count=count+1 + } + return count + } + + fun addedComment(){ + commentsCount.text=(Integer.parseInt(commentsCount.text.toString())+1).toString() + commentsCount.invalidate() + } + +} diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostDescription.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostDescription.kt new file mode 100644 index 0000000..877fbc4 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentSinglePostDescription.kt @@ -0,0 +1,174 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageButton +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.fragment.app.Fragment +import com.example.brzodolokacije.Models.* +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.gson.Gson +import org.w3c.dom.Text +import retrofit2.Call +import retrofit2.Response + + +class FragmentSinglePostDescription : Fragment() { + + private lateinit var descriptionContainer:TextView + private lateinit var star1:ImageView + private lateinit var star2:ImageView + private lateinit var star3:ImageView + private lateinit var star4:ImageView + private lateinit var star5:ImageView + private var starNumber:Number=0 + private lateinit var post:PostPreview + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + + var view=inflater.inflate(R.layout.fragment_single_post_description, container, false) + + + + //uzmi post prosledjen iz single post + var args = arguments + var jsonPostObject = args!!.getString("post") + post= Gson().fromJson(jsonPostObject, PostPreview::class.java) + + //setuj opis + descriptionContainer=view.findViewById(R.id.tvDescription) + descriptionContainer.text=post.description.toString() + + //setuj zvezdice + star1=view.findViewById(R.id.rateStar1) + star2=view.findViewById(R.id.rateStar2) + star3=view.findViewById(R.id.rateStar3) + star4=view.findViewById(R.id.rateStar4) + star5=view.findViewById(R.id.rateStar5) + + setRatingListeners() + val alreadyrated= RatingReceive(starNumber.toInt(),post._id) + requestAddRating(alreadyrated) + + + return view + } + fun setRatingListeners() { + val emptyStar = R.drawable.ic_round_star_outline_24 + val fullStar = R.drawable.ic_baseline_star_rate_24 + + star1.setOnClickListener { + //Toast.makeText(this,"kliknuta prva zvezdica",Toast.LENGTH_SHORT).show() + star1.setImageResource(fullStar) + star2.setImageResource(emptyStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + starNumber=1 + rate(starNumber) + } + star1.setOnClickListener { + //Toast.makeText(this,"kliknuta druga zvezdica",Toast.LENGTH_SHORT).show() + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + starNumber=2 + rate(starNumber) + } + star1.setOnClickListener { + //Toast.makeText(this,"kliknuta treca zvezdica",Toast.LENGTH_SHORT).show() + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + starNumber=3 + rate(starNumber) + } + star1.setOnClickListener { + Toast.makeText(requireActivity(),"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show() + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(fullStar) + star5.setImageResource(emptyStar) + starNumber=4 + rate(starNumber) + } + star1.setOnClickListener { + //Toast.makeText(this,"kliknuta peta zvezdica",Toast.LENGTH_SHORT).show() + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(fullStar) + star5.setImageResource(fullStar) + starNumber=5 + rate(starNumber) + } + + + } + + fun rate(starNumber:Number){ + if(starNumber.toInt()>0){ + val rating= RatingReceive(starNumber.toInt(),post._id) + requestAddRating(rating) + } + } + + fun requestAddRating(rating:RatingReceive) { + val postApi = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", requireActivity()) + val request = postApi.addRating("Bearer " + token, post._id, rating) + request.enqueue(object : retrofit2.Callback<RatingData> { + override fun onResponse(call: Call<RatingData>, response: Response<RatingData>) { + if (response.isSuccessful) { + var data = response.body()!! + Log.d( + "--------------", + data.ratings.toString() + " " + data.ratingscount.toString() + ) + when (data.myrating) { + 1 -> star1.performClick() + 2 -> star1.performClick() + 3 -> star3.performClick() + 4 -> star4.performClick() + 5 -> star5.performClick() + else -> { + val emptyStar = R.drawable.empty_star + star1.setImageResource(emptyStar) + star2.setImageResource(emptyStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + } + } + /*Toast.makeText( + this@ActivitySinglePost, "prosao zahtev", Toast.LENGTH_LONG + ).show()*/ + } else { + if (response.errorBody() != null) + Log.d("main1", response.errorBody().toString()) + } + + + } + + override fun onFailure(call: Call<RatingData>, t: Throwable) { + Log.d("main2", t.message.toString()) + } + }) + } +}
\ 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 index 09920dc..376517c 100644 --- 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 @@ -24,6 +24,8 @@ class FragmentUserFollowers : Fragment() { private lateinit var followers:MutableList<UserReceive> private lateinit var rvFollowers:RecyclerView private lateinit var userId:String + private lateinit var showMy:String + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -33,12 +35,17 @@ class FragmentUserFollowers : Fragment() { val bundle = arguments userId = bundle!!.getString("userId").toString() - + showMy = bundle!!.getString("showMy").toString().trim() rvFollowers=view.findViewById(R.id.rvFragmentUserFollowers) - getFollowers() - + if(showMy=="yes"){ + getFollowersWithoutId() + } + else if(showMy=="no") { + getFollowers() + } return view + } fun getFollowers(){ @@ -68,4 +75,27 @@ class FragmentUserFollowers : Fragment() { } }) } + + fun getFollowersWithoutId(){ + val api = RetrofitHelper.getInstance() + 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>>, response: Response<MutableList<UserReceive>>) { + if (response.body() == null) { + return + } + Log.d("MyFollowers","Successsssssssssssssssssssssssssssss") + 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("MyFollowers","Faillllllllllllllllllllllllll") + } + }) + } }
\ 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 index 0f6323f..9a78b6e 100644 --- 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 @@ -23,6 +23,7 @@ class FragmentUserFollowing : Fragment() { private lateinit var following:MutableList<UserReceive> private lateinit var rvFollowing: RecyclerView private lateinit var userId:String + private lateinit var showMy:String override fun onCreateView( @@ -33,10 +34,15 @@ class FragmentUserFollowing : Fragment() { var view=inflater.inflate(R.layout.fragment_user_following, container, false) val bundle = arguments userId = bundle!!.getString("userId").toString() + showMy = bundle!!.getString("showMy").toString().trim() rvFollowing=view.findViewById(R.id.rvFragmentUserFollowing) - getFollowing() - + if(showMy=="yes"){ + getFollowingWithoutId() + } + else if(showMy=="no") { + getFollowing() + } return view } @@ -49,7 +55,7 @@ class FragmentUserFollowing : Fragment() { if (response.body() == null) { return } - Log.d("Following","Sucesssssssssssssssssssssssssssssss") + Log.d("Following","Successsssssssssssssssssssssssssssss") following = response.body()!!.toMutableList<UserReceive>() rvFollowing.apply { layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) @@ -62,4 +68,26 @@ class FragmentUserFollowing : Fragment() { }) } + fun getFollowingWithoutId(){ + val api = RetrofitHelper.getInstance() + 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>>, response: Response<MutableList<UserReceive>>) { + if (response.body() == null) { + return + } + Log.d("MyFollowings","Successsssssssssssssssssssssssssssss") + 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("MyFollowings","Faillllllllllllllllllllllllll") + } + }) + } + }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt index d69a40c..d6971c4 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt @@ -31,10 +31,13 @@ import retrofit2.converter.gson.GsonConverterFactory import android.widget.Button import android.widget.ImageButton import android.widget.TextView +import com.auth0.android.jwt.JWT import com.example.brzodolokacije.Activities.ActivityAddPost import com.example.brzodolokacije.Activities.ActivityCapturePost import com.example.brzodolokacije.Activities.ActivityForgottenPassword +import com.example.brzodolokacije.Activities.NavigationActivity import com.example.brzodolokacije.Adapters.MyPostsAdapter +import com.example.brzodolokacije.UserPostsMapFragment import com.google.android.material.bottomsheet.BottomSheetDialog @@ -56,27 +59,21 @@ class FragmentUserPosts : Fragment() { addNewPost=view.findViewById<View>(R.id.tvFragmentUserPostsAddPost) as TextView addNewPost.setOnClickListener { - var bottomSheetDialog2: BottomSheetDialog - bottomSheetDialog2= BottomSheetDialog(requireContext()) - bottomSheetDialog2.setContentView(R.layout.bottom_sheet_add_new_post) - bottomSheetDialog2.show() - - var close=bottomSheetDialog2.findViewById<View>(R.id.btnBottomSheetAddNewPostClose) as ImageButton - var openAddPost=bottomSheetDialog2.findViewById<View>(R.id.btnBottomSheetAddNewPostOpenAddPost) as ImageButton - var capturePost=bottomSheetDialog2.findViewById<View>(R.id.btnBottomSheetAddNewPostOpenCapturePost) as ImageButton - - openAddPost.setOnClickListener{ - val intent = Intent (getActivity(), ActivityAddPost::class.java) - getActivity()?.startActivity(intent) + val bundle = Bundle() + var jwtString=SharedPreferencesHelper.getValue("jwt",requireActivity()) + if(jwtString!=null) { + var jwt: JWT = JWT(jwtString!!) + var userId=jwt.getClaim("id").asString() + bundle.putString("id", userId) + val userMapFragment = UserPostsMapFragment() + userMapFragment.setArguments(bundle) + var act=requireActivity()as NavigationActivity + act.supportFragmentManager.beginTransaction().replace( + R.id.flNavigationFragment,userMapFragment + ) + .commit() } - capturePost.setOnClickListener{ - val intent = Intent (getActivity(), ActivityCapturePost::class.java) - getActivity()?.startActivity(intent) - } - close.setOnClickListener { - bottomSheetDialog2.dismiss() - } } rvPosts=view.findViewById(R.id.rvFragmentUserPostsPosts) as RecyclerView 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 676023f..19b1bb5 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 @@ -48,8 +48,10 @@ interface IBackendApi { @Multipart @POST("/api/user/profile/pfp") fun setPfp(@Header("Authorization") authHeader:String, @Part image: MultipartBody.Part):Call<ResponseBody> + @GET("/api/user/profile") fun selfProfile(@Header("Authorization") authHeader:String):Call<UserReceive> + @GET("/api/user/{username}/profile") fun getProfile(@Header("Authorization") authHeader:String,@Path("username") username:String):Call<UserReceive> @@ -110,4 +112,13 @@ interface IBackendApi { @GET("/api/user/{id}/myFollowers") fun getMyFollowers(@Header("Authorization") authHeader:String):Call <MutableList<UserReceive>> + @GET("/api/Post/favourite/{id}") + fun addRemoveFavourite(@Header("Authorization") authHeader:String,@Path("id") id:String):Call <Boolean> + + @GET("/api/user/{newUsername}/changeMyUsername") + fun changeMyUsername(@Header("Authorization") authHeader:String,@Path("newUsername") newUsername:String):Call<Int> + + @GET("/api/user/{newName}/changeMyName") + fun changeMyName(@Header("Authorization") authHeader:String,@Path("newName") newName:String):Call<Boolean> + }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/MainActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/MainActivity.kt index b3183b8..acce7b3 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/MainActivity.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/MainActivity.kt @@ -9,6 +9,7 @@ import com.example.brzodolokacije.Activities.ActivityLoginRegister import com.example.brzodolokacije.Activities.NavigationActivity import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.example.brzodolokacije.chat.Notifications import retrofit2.Call import retrofit2.Response @@ -22,6 +23,7 @@ class MainActivity : AppCompatActivity() { val intent:Intent if(checkLoggedIn()) { + Notifications.makeChannel(this) intent = Intent(this, NavigationActivity::class.java) } else 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 6725c15..f3af84c 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 @@ -24,5 +24,6 @@ data class Message( data class ChatPreview( var userId:String, - var read:Boolean + var read:Boolean, + var username:String )
\ No newline at end of file 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 f0f67a7..8f07bca 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 @@ -39,7 +39,8 @@ data class PostPreview ( var ratingscount:Int, var createdAt:Date, var lastViewed: Date?, //samo za istoriju pregleda - var tags:List<String>? + var tags:List<String>?, + var favourites:List<String>? //nedostaju datum i vreme kreiranja diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/UserPostsMapFragment.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/UserPostsMapFragment.kt new file mode 100644 index 0000000..882a1ae --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/UserPostsMapFragment.kt @@ -0,0 +1,127 @@ +package com.example.brzodolokacije + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.preference.PreferenceManager +import android.util.Log +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import com.example.brzodolokacije.Activities.ActivitySinglePost +import com.example.brzodolokacije.Fragments.FragmentProfile +import com.example.brzodolokacije.Models.PostPreview +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +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 + + +class UserPostsMapFragment : Fragment() { + + var map: MapView? = null + var id:String?=null + var backButton:ImageView?=null + 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_map, container, false) + val ctx: Context = requireContext() + Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx)); + map=view.findViewById(R.id.FragmentUserPostsMapMapView) as MapView + backButton=view.findViewById(R.id.btnFragmentUserPostsBack) as ImageView + map!!.setTileSource(TileSourceFactory.MAPNIK); + id=this.requireArguments().getString("id");//https://stackoverflow.com/questions/17436298/how-to-pass-a-variable-from-activity-to-fragment-and-pass-it-back + setUpMap() + backButton!!.setOnClickListener{ + //SUBJECT TO CHANGE + val fragmentProfile = FragmentProfile() + fragmentManager?.beginTransaction() + ?.replace(com.example.brzodolokacije.R.id.flNavigationFragment,fragmentProfile) + ?.commit() +//How to call fragment +// val bundle = Bundle() +// bundle.putString("id",userId ) +// val fragmentFollowers = UserPostsMapFragment() +// fragmentFollowers.setArguments(bundle) +// +// fragmentManager +// ?.beginTransaction() +// ?.replace(com.example.brzodolokacije.R.id.flNavigationFragment,fragmentFollowers) +// ?.commit() + } + return view + } + fun setUpMap(){ + map!!.setBuiltInZoomControls(true); + map!!.setMultiTouchControls(true); + val mapController = map!!.controller + mapController.setZoom(15) + var api= RetrofitHelper.getInstance() + var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity()) + if(id==null) + return + var data=api.getUsersPosts("Bearer "+jwtString,id!!) + + 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) { + var flag=true + 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) + if(flag){ + flag=false + map!!.controller.animateTo(GeoPoint(post.location.latitude,post.location.longitude)) + } + + startMarker.setOnMarkerClickListener(object: + Marker.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) { + } + }) + } + + +}
\ 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 a3d5a13..041eebb 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 @@ -9,6 +9,11 @@ import android.database.sqlite.SQLiteOpenHelper import android.util.Log import com.example.brzodolokacije.Models.ChatPreview import com.example.brzodolokacije.Models.Message +import com.example.brzodolokacije.Models.UserReceive +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import retrofit2.Call +import retrofit2.Response import java.util.* @@ -17,7 +22,7 @@ class DBHelper : var db:SQLiteDatabase?=null - constructor(context: Context, factory: SQLiteDatabase.CursorFactory?):super(context, DATABASE_NAME, factory,3){ + constructor(context: Context, factory: SQLiteDatabase.CursorFactory?):super(context, DATABASE_NAME, factory,5){ db=readableDatabase } @@ -28,8 +33,10 @@ class DBHelper : //database tables val CONTACTS_TABLE_NAME = "contacts" val MESSAGES_TABLE_NAME = "messages" + var activity:Activity?=null private var instance:DBHelper?=null fun getInstance(activity: Activity):DBHelper{ + this.activity =activity if(instance==null){ instance= DBHelper(activity,null) } @@ -41,7 +48,8 @@ class DBHelper : if(!doesTableExist(CONTACTS_TABLE_NAME,db)){ var sql:String="CREATE TABLE "+ CONTACTS_TABLE_NAME+" (" + "userId " +"TEXT PRIMARY KEY,"+ - "read " +"INTEGER"+ + "read " +"INTEGER,"+ + "username "+"TEXT"+ ")" db?.execSQL(sql) } @@ -77,7 +85,7 @@ class DBHelper : onCreate(db) } - fun addMessage(message: Message, sent:Boolean=true){ + fun addMessage(message: Message, sent:Boolean=true,username:String?=null){ onCreate(db) if(!message._id.isNullOrEmpty() && message.senderId==message.receiverId){ Log.d("main", "ne zapisuje se dupla poruka") @@ -101,9 +109,41 @@ class DBHelper : var id:String id = if(sent) message.receiverId else message.senderId var read:Int=if(sent) 1 else 0 - sql="INSERT INTO "+ CONTACTS_TABLE_NAME+"(userId,read) VALUES('"+id+"','"+ - read+"')" - db?.execSQL(sql) + if(username==null){ + //request + var api=RetrofitHelper.getInstance() + var token= activity?.let { SharedPreferencesHelper.getValue("jwt", it) } + val request2=api.getProfileFromId("Bearer "+token, + message.senderId + ) + request2?.enqueue(object : retrofit2.Callback<UserReceive?> { + override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { + if(response.isSuccessful()){ + var user=response.body()!! + sql="INSERT INTO "+ CONTACTS_TABLE_NAME+"(userId,read,username) VALUES('"+id+"','"+ + read+"','"+user.username+"')" + db?.execSQL(sql) + } + else{ + sql="INSERT INTO "+ CONTACTS_TABLE_NAME+"(userId,read) VALUES('"+id+"','"+ + read+"')" + db?.execSQL(sql) + } + } + + override fun onFailure(call: Call<UserReceive?>, t: Throwable) { + sql="INSERT INTO "+ CONTACTS_TABLE_NAME+"(userId,read) VALUES('"+id+"','"+ + read+"')" + db?.execSQL(sql) + } + }) + } + else{ + sql="INSERT INTO "+ CONTACTS_TABLE_NAME+"(userId,read,username) VALUES('"+id+"','"+ + read+"','"+username+"')" + db?.execSQL(sql) + } + } else{ if(!sent) @@ -111,7 +151,36 @@ class DBHelper : } } } - fun getMessages(userId:String, self:Boolean=false): MutableList<Message>? { + fun getLastMessage(userId:String): Message? { + onCreate(db) + var sql:String = "SELECT * FROM "+ MESSAGES_TABLE_NAME+" WHERE senderId='"+userId+"'"+" OR receiverId='"+userId+"'"+" ORDER BY timestamp DESC LIMIT 1" + var cursor=db?.rawQuery(sql,null) + if(cursor?.count!! >0){ + var msg:Message + var idIndex=cursor.getColumnIndexOrThrow("_id") + var senderIdIndex=cursor.getColumnIndexOrThrow("senderId") + var receiverIdIndex=cursor.getColumnIndexOrThrow("receiverId") + var messageIndex=cursor.getColumnIndexOrThrow("messagge") + var timestampIndex=cursor.getColumnIndexOrThrow("timestamp") + cursor.moveToNext() + var cal:Calendar= Calendar.getInstance() + cal.timeInMillis=cursor.getLong(timestampIndex) + msg=Message( + cursor.getString(idIndex), + cursor.getString(senderIdIndex), + cursor.getString(receiverIdIndex), + cursor.getString(messageIndex), + cal.time, + cal + ) + + Log.d("main",cal.time.toString()) + readContact(userId) + return msg + } + return null + } + fun getMessages(userId:String,self:Boolean=false): MutableList<Message>? { onCreate(db) var sql:String if(!self) @@ -137,8 +206,8 @@ class DBHelper : cursor.getString(messageIndex), cal.time, cal - ) ) + ) Log.d("main",cal.time.toString()) } readContact(userId) @@ -155,8 +224,9 @@ class DBHelper : var contactList:MutableList<ChatPreview> =mutableListOf() var userIdIndex=cursor.getColumnIndexOrThrow("userId") var readIndex=cursor.getColumnIndexOrThrow("read") + var usernameIndex=cursor.getColumnIndexOrThrow("username") while(cursor.moveToNext()){ - contactList.add(ChatPreview(cursor.getString(userIdIndex),cursor.getInt(readIndex)==1)) + contactList.add(ChatPreview(cursor.getString(userIdIndex),cursor.getInt(readIndex)==1,cursor.getString(usernameIndex))) } Log.d("main",contactList.size.toString()) return contactList diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/Notifications.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/Notifications.kt new file mode 100644 index 0000000..8a5add8 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/Notifications.kt @@ -0,0 +1,28 @@ +package com.example.brzodolokacije.chat + +import android.app.Activity +import android.app.NotificationChannel +import android.app.NotificationManager +import android.content.Context.NOTIFICATION_SERVICE +import android.os.Build +import com.example.brzodolokacije.R + +class Notifications { + companion object{ + val CHANNEL_ID="channel_1" + fun makeChannel(activity:Activity){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + // Create the NotificationChannel + val name = activity.getString(R.string.channel_name) + val descriptionText = activity.getString(R.string.channel_description) + val importance = NotificationManager.IMPORTANCE_DEFAULT + val mChannel = NotificationChannel(CHANNEL_ID, name, importance) + mChannel.description = descriptionText + // Register the channel with the system; you can't change the importance + // or other notification behaviors after this + val notificationManager = activity.getSystemService(NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannel(mChannel) + } + } + } +}
\ 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 39689c7..627d7c0 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 @@ -1,24 +1,35 @@ package com.example.brzodolokacije.chat +import android.Manifest import android.app.Activity +import android.content.pm.PackageManager +import android.graphics.Color import android.util.Log import android.widget.Toast +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat 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.Models.UserReceive +import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.microsoft.signalr.Action1 import com.microsoft.signalr.HubConnection import com.microsoft.signalr.HubConnectionBuilder import com.microsoft.signalr.HubConnectionState +import retrofit2.Call +import retrofit2.Response import java.util.* +import java.util.concurrent.atomic.AtomicInteger class SignalRListener private constructor(val activity: Activity){ - public var hubConnection:HubConnection + var hubConnection:HubConnection private var dbHelper:DBHelper init{ dbHelper= DBHelper.getInstance(activity) @@ -73,7 +84,71 @@ class SignalRListener private constructor(val activity: Activity){ } activity.requestNewMessages() } + when { + ContextCompat.checkSelfPermission(activity, + Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED -> { + //poslati notifikaciju + var api=RetrofitHelper.getInstance() + var token=SharedPreferencesHelper.getValue("jwt",activity) + val request2=api?.getProfileFromId("Bearer "+token, + message.senderId + ) + request2?.enqueue(object : retrofit2.Callback<UserReceive?> { + override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { + if(response.isSuccessful()){ + var user=response.body()!! + createNotification(message,user,activity) + } + } + + override fun onFailure(call: Call<UserReceive?>, t: Throwable) { + //TODO("Not yet implemented") + } + }) + } + } + + } + + fun createNotification(message: MessageReceive,user: UserReceive,activity: Activity){ + val notificationBuilder = NotificationCompat.Builder(activity, Notifications.CHANNEL_ID) + .setSmallIcon(R.drawable.ic_round_chat_24) + .setAutoCancel(true) + .setLights(Color.BLUE, 500, 500) + .setVibrate(longArrayOf(500, 500, 500)) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .setContentTitle(user.username) + .setContentText(message.messagge) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + val notificationManager = NotificationManagerCompat.from(activity) + val notification = notificationBuilder.build() + notificationManager.notify(NotificationID.iD, notification) +/* Log.d("main",RetrofitHelper.baseUrl + "/api/post/image/compress/" + user.pfp!!._id) + Glide.with(activity) + .asBitmap() + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + user.pfp!!._id) + .into(object : CustomTarget<Bitmap>() { + override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) { + notificationBuilder.setLargeIcon(resource) + val notification = notificationBuilder.build() + notificationManager.notify(NotificationID.iD, notification) + } + + override fun onLoadCleared(placeholder: Drawable?) { + Log.d("main","k") + } + + override fun onLoadFailed(errorDrawable: Drawable?) { + Log.d("main",errorDrawable.toString()) + } + + })*/ } + internal object NotificationID { + private val c = AtomicInteger(100) + val iD: Int + get() = c.incrementAndGet() + } fun log(){ Log.d("Debug infor siganlR ", hubConnection.connectionId) diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_off.png b/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_off.png Binary files differnew file mode 100644 index 0000000..20751a8 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_off.png diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_on.png b/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_on.png Binary files differnew file mode 100644 index 0000000..d655134 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/bell_on.png diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/expand.png b/Client/BrzoDoLokacije/app/src/main/res/drawable/expand.png Binary files differnew file mode 100644 index 0000000..2051733 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/expand.png diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient2.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient2.xml new file mode 100644 index 0000000..0d73580 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient2.xml @@ -0,0 +1,28 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="324dp" + android:height="43dp" + android:viewportWidth="324" + android:viewportHeight="43"> + <group> + <path + android:pathData="M0 0H324V43H0z"> + <aapt:attr name="android:fillColor"> + <gradient + android:type="linear" + android:startX="162" + android:startY="0" + android:endX="162" + android:endY="43"> + <item + android:color="#1A192124" + android:offset="0.2"/> + + <item + android:color="#FA192124" + android:offset="1"/> + </gradient> + </aapt:attr> + </path> + </group> +</vector>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml new file mode 100644 index 0000000..84df34b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#E52121" + 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,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_border_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_border_24.xml new file mode 100644 index 0000000..4c07189 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_border_24.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#3B3737" + 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="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_logout_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_logout_24.xml new file mode 100644 index 0000000..ac81ab8 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_logout_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="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_map_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_map_24.xml new file mode 100644 index 0000000..a89ac5c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_map_24.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#274352" + 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.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_24.xml new file mode 100644 index 0000000..bcba56a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_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="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_account_circle_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_account_circle_24.xml new file mode 100644 index 0000000..b5e6c8c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_account_circle_24.xml @@ -0,0 +1,6 @@ +<vector 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="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM7.35,18.5C8.66,17.56 10.26,17 12,17s3.34,0.56 4.65,1.5C15.34,19.44 13.74,20 12,20S8.66,19.44 7.35,18.5zM18.14,17.12L18.14,17.12C16.45,15.8 14.32,15 12,15s-4.45,0.8 -6.14,2.12l0,0C4.7,15.73 4,13.95 4,12c0,-4.42 3.58,-8 8,-8s8,3.58 8,8C20,13.95 19.3,15.73 18.14,17.12z"/> + <path android:fillColor="@android:color/white" android:pathData="M12,6c-1.93,0 -3.5,1.57 -3.5,3.5S10.07,13 12,13s3.5,-1.57 3.5,-3.5S13.93,6 12,6zM12,11c-0.83,0 -1.5,-0.67 -1.5,-1.5S11.17,8 12,8s1.5,0.67 1.5,1.5S12.83,11 12,11z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_change_circle_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_change_circle_24.xml new file mode 100644 index 0000000..1a36910 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_change_circle_24.xml @@ -0,0 +1,5 @@ +<vector 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="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8s8,3.59 8,8S16.41,20 12,20zM16.17,14.76l-1.1,-1.1c0.71,-1.33 0.53,-3.01 -0.59,-4.13C13.79,8.84 12.9,8.5 12,8.5c-0.03,0 -0.06,0.01 -0.09,0.01L13,9.6l-1.06,1.06L9.11,7.83L11.94,5L13,6.06l-0.96,0.96c1.27,0.01 2.53,0.48 3.5,1.44C17.24,10.17 17.45,12.82 16.17,14.76zM14.89,16.17L12.06,19L11,17.94l0.95,-0.95c-1.26,-0.01 -2.52,-0.5 -3.48,-1.46c-1.71,-1.71 -1.92,-4.35 -0.64,-6.29l1.1,1.1c-0.71,1.33 -0.53,3.01 0.59,4.13c0.7,0.7 1.63,1.04 2.56,1.01L11,14.4l1.06,-1.06L14.89,16.17z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_edit_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_edit_24.xml new file mode 100644 index 0000000..05e90d7 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_edit_24.xml @@ -0,0 +1,5 @@ +<vector 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="M14.06,9.02l0.92,0.92L5.92,19L5,19v-0.92l9.06,-9.06M17.66,3c-0.25,0 -0.51,0.1 -0.7,0.29l-1.83,1.83 3.75,3.75 1.83,-1.83c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.2,-0.2 -0.45,-0.29 -0.71,-0.29zM14.06,6.19L3,17.25L3,21h3.75L17.81,9.94l-3.75,-3.75z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_password_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_password_24.xml new file mode 100644 index 0000000..267f930 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_password_24.xml @@ -0,0 +1,5 @@ +<vector 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="M2,17h20v2H2V17zM3.15,12.95L4,11.47l0.85,1.48l1.3,-0.75L5.3,10.72H7v-1.5H5.3l0.85,-1.47L4.85,7L4,8.47L3.15,7l-1.3,0.75L2.7,9.22H1v1.5h1.7L1.85,12.2L3.15,12.95zM9.85,12.2l1.3,0.75L12,11.47l0.85,1.48l1.3,-0.75l-0.85,-1.48H15v-1.5h-1.7l0.85,-1.47L12.85,7L12,8.47L11.15,7l-1.3,0.75l0.85,1.47H9v1.5h1.7L9.85,12.2zM23,9.22h-1.7l0.85,-1.47L20.85,7L20,8.47L19.15,7l-1.3,0.75l0.85,1.47H17v1.5h1.7l-0.85,1.48l1.3,0.75L20,11.47l0.85,1.48l1.3,-0.75l-0.85,-1.48H23V9.22z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_share_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_share_24.xml new file mode 100644 index 0000000..e95b628 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_share_24.xml @@ -0,0 +1,5 @@ +<vector 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="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_stats_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_stats_24.xml new file mode 100644 index 0000000..05eb65f --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_stats_24.xml @@ -0,0 +1,5 @@ +<vector 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="M19.88,18.47c0.44,-0.7 0.7,-1.51 0.7,-2.39c0,-2.49 -2.01,-4.5 -4.5,-4.5s-4.5,2.01 -4.5,4.5s2.01,4.5 4.49,4.5c0.88,0 1.7,-0.26 2.39,-0.7L21.58,23L23,21.58L19.88,18.47zM16.08,18.58c-1.38,0 -2.5,-1.12 -2.5,-2.5c0,-1.38 1.12,-2.5 2.5,-2.5s2.5,1.12 2.5,2.5C18.58,17.46 17.46,18.58 16.08,18.58zM15.72,10.08c-0.74,0.02 -1.45,0.18 -2.1,0.45l-0.55,-0.83l-3.8,6.18l-3.01,-3.52l-3.63,5.81L1,17l5,-8l3,3.5L13,6C13,6 15.72,10.08 15.72,10.08zM18.31,10.58c-0.64,-0.28 -1.33,-0.45 -2.05,-0.49c0,0 5.12,-8.09 5.12,-8.09L23,3.18L18.31,10.58z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_check_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_check_24.xml new file mode 100644 index 0000000..a8e2c6e --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_check_24.xml @@ -0,0 +1,5 @@ +<vector 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="M9,16.17L5.53,12.7c-0.39,-0.39 -1.02,-0.39 -1.41,0 -0.39,0.39 -0.39,1.02 0,1.41l4.18,4.18c0.39,0.39 1.02,0.39 1.41,0L20.29,7.71c0.39,-0.39 0.39,-1.02 0,-1.41 -0.39,-0.39 -1.02,-0.39 -1.41,0L9,16.17z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_favorite_border_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_favorite_border_24.xml new file mode 100644 index 0000000..0444f34 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_favorite_border_24.xml @@ -0,0 +1,5 @@ +<vector 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="M19.66,3.99c-2.64,-1.8 -5.9,-0.96 -7.66,1.1 -1.76,-2.06 -5.02,-2.91 -7.66,-1.1 -1.4,0.96 -2.28,2.58 -2.34,4.29 -0.14,3.88 3.3,6.99 8.55,11.76l0.1,0.09c0.76,0.69 1.93,0.69 2.69,-0.01l0.11,-0.1c5.25,-4.76 8.68,-7.87 8.55,-11.75 -0.06,-1.7 -0.94,-3.32 -2.34,-4.28zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_down_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_down_24.xml new file mode 100644 index 0000000..ee6e4de --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_down_24.xml @@ -0,0 +1,5 @@ +<vector android:height="30dp" android:tint="#747474" + android:viewportHeight="24" android:viewportWidth="24" + android:width="30dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M8.12,9.29L12,13.17l3.88,-3.88c0.39,-0.39 1.02,-0.39 1.41,0 0.39,0.39 0.39,1.02 0,1.41l-4.59,4.59c-0.39,0.39 -1.02,0.39 -1.41,0L6.7,10.7c-0.39,-0.39 -0.39,-1.02 0,-1.41 0.39,-0.38 1.03,-0.39 1.42,0z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_up_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_up_24.xml new file mode 100644 index 0000000..0d6676b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_keyboard_arrow_up_24.xml @@ -0,0 +1,5 @@ +<vector android:height="30dp" android:tint="#747474" + android:viewportHeight="24" android:viewportWidth="24" + android:width="30dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M8.12,14.71L12,10.83l3.88,3.88c0.39,0.39 1.02,0.39 1.41,0 0.39,-0.39 0.39,-1.02 0,-1.41L12.7,8.71c-0.39,-0.39 -1.02,-0.39 -1.41,0L6.7,13.3c-0.39,0.39 -0.39,1.02 0,1.41 0.39,0.38 1.03,0.39 1.42,0z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_star_outline_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_star_outline_24.xml new file mode 100644 index 0000000..e97ab0a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_star_outline_24.xml @@ -0,0 +1,5 @@ +<vector 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="M19.65,9.04l-4.84,-0.42 -1.89,-4.45c-0.34,-0.81 -1.5,-0.81 -1.84,0L9.19,8.63l-4.83,0.41c-0.88,0.07 -1.24,1.17 -0.57,1.75l3.67,3.18 -1.1,4.72c-0.2,0.86 0.73,1.54 1.49,1.08l4.15,-2.5 4.15,2.51c0.76,0.46 1.69,-0.22 1.49,-1.08l-1.1,-4.73 3.67,-3.18c0.67,-0.58 0.32,-1.68 -0.56,-1.75zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/reply.png b/Client/BrzoDoLokacije/app/src/main/res/drawable/reply.png Binary files differnew file mode 100644 index 0000000..0c1071b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/reply.png diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/shrink.png b/Client/BrzoDoLokacije/app/src/main/res/drawable/shrink.png Binary files differnew file mode 100644 index 0000000..d4c07e1 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/shrink.png diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_user_data.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_user_data.xml new file mode 100644 index 0000000..2ade677 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_user_data.xml @@ -0,0 +1,200 @@ +<?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:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp" + tools:context=".Activities.ActivityChangeUserData"> + + <ImageView + android:id="@+id/btnBackToUser" + android:layout_width="35dp" + android:layout_height="35dp" + 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/tvActivityUserProfileName" + style="@style/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_column="1" + android:layout_gravity="center" + android:layout_marginStart="8dp" + + android:layout_marginTop="4dp" + android:text="Izmeni profil" + app:layout_constraintStart_toEndOf="@+id/btnBackToUser" + app:layout_constraintTop_toTopOf="parent" /> + + <androidx.cardview.widget.CardView + android:id="@+id/cvFragmentHomePageProfile" + android:layout_width="130dp" + android:layout_height="130dp" + android:layout_gravity="center" + android:layout_marginTop="24dp" + android:elevation="10dp" + app:cardCornerRadius="250dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityUserProfileName"> + + <ImageView + + android:id="@+id/tvActivityChangeUserDataProfilePicture" + 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> + + <androidx.cardview.widget.CardView + android:id="@+id/ChangeProfileEditImage" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="center" + android:layout_marginTop="90dp" + android:elevation="5dp" + app:cardCornerRadius="250dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@+id/cvFragmentHomePageProfile" + app:layout_constraintTop_toTopOf="@+id/cvFragmentHomePageProfile"> + + <ImageView + android:id="@+id/ChangeProfileEditImageEdit" + android:clickable="true" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="bottom|right" + android:background="@color/white" + android:elevation="20dp" + android:src="@drawable/ic_outline_edit_24" /> + </androidx.cardview.widget.CardView> + + <TextView + android:id="@+id/changeDataName" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="60dp" + android:layout_marginEnd="337dp" + android:text="Ime" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile" /> + + <EditText + android:id="@+id/tvActivityChangeUserDataName" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPersonName" + android:text="Name" + app:layout_constraintEnd_toStartOf="@+id/btnActivityChangeUserDataName" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataName" /> + + <TextView + android:id="@+id/changeDataUsername" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="40dp" + android:layout_marginEnd="333dp" + android:text="Korisničko ime" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangeUserDataName" /> + + <EditText + android:id="@+id/tvActivityChangeUserDataUsername" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPersonName" + android:text="Name" + app:layout_constraintEnd_toStartOf="@+id/btnActivityChangeUserDataUsername" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataUsername" /> + + <Button + android:id="@+id/button" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="140dp" + android:text="Izmeni lozinku" + app:layout_constraintBottom_toBottomOf="parent" + android:drawableLeft="@drawable/ic_outline_password_24" + android:drawableTint="@color/white" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangeUserDataUsername" + app:shapeAppearanceOverlay="@style/Circular" /> + + + <ImageView + android:clickable="true" + android:id="@+id/btnActivityChangeUserDataName" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataName" + app:srcCompat="@drawable/ic_outline_edit_24" /> + <ImageView + android:id="@+id/btnActivityChangeUserDataNameConfirm" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataName" + app:srcCompat="@drawable/ic_round_check_24" /> + + <ImageView + android:clickable="true" + android:id="@+id/btnActivityChangeUserDataUsername" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataUsername" + app:srcCompat="@drawable/ic_outline_edit_24" /> + <ImageView + android:id="@+id/btnActivityChangeUserDataUsernameConfirm" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_marginEnd="4dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataUsername" + app:srcCompat="@drawable/ic_round_check_24" /> + + <TextView + android:id="@+id/btnActivityChangeUserDataNameError" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangeUserDataName" /> + + <TextView + android:id="@+id/btnActivityChangeUserDataUsernameError" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextView" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangeUserDataUsername" /> + +</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 680bada..0b4a589 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml @@ -18,16 +18,20 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> +<androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:id="@+id/llHeader" + android:layout_height="50dp" + android:background="@color/unfollow"> - <ImageView - android:id="@+id/btnActivityShowFollowersAndFollowingBackToUser" - android:layout_width="35dp" - android:layout_height="35dp" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" + <ImageButton + android:id="@+id/btnBack" + android:layout_width="50dp" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" android:clickable="true" android:src="@drawable/ic_baseline_arrow_back" - android:textAllCaps="false" + android:background="@null" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" /> @@ -36,13 +40,23 @@ android:id="@+id/tvActivityShowFollowersOrFollowingShow" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:layout_marginEnd="268dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" android:text="Poruke" android:textSize="25dp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> + <ImageButton + android:id="@+id/btnNotifications" + android:layout_width="50dp" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" + android:scaleType="centerCrop" + android:backgroundTint="@color/unfollow" + android:src="@drawable/bell_off"/> + +</androidx.appcompat.widget.LinearLayoutCompat> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeContainer" @@ -50,7 +64,7 @@ android:layout_height="0dp" android:layout_marginTop="8dp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvActivityShowFollowersOrFollowingShow" + app:layout_constraintTop_toBottomOf="@+id/llHeader" app:layout_constraintVertical_bias="1.0" tools:layout_editor_absoluteX="-27dp"> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml index 72060f7..4dcab31 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml @@ -1,69 +1,94 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.LinearLayoutCompat 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:orientation="vertical" android:layout_height="match_parent" + android:fitsSystemWindows="true" tools:context=".Activities.ChatActivityConversation"> - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/topBanner" - android:layout_width="match_parent" - android:layout_height="50dp" - android:elevation="5dp" - android:background="@color/dark_blue_transparent" - android:clickable="true" - app:layout_constraintStart_toStartOf="parent"> - - <TextView - android:id="@+id/tvFragmentTitle" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:text="Chat" - android:textColor="@color/white" - android:textSize="40dp" /> - <androidx.cardview.widget.CardView - android:id="@+id/cvParentUsername" + <androidx.appcompat.widget.LinearLayoutCompat + android:id="@+id/topBanner" android:layout_width="match_parent" - android:layout_height="40dp" - android:layout_marginStart="16dp" - android:layout_marginTop="10dp" - android:layout_marginEnd="16dp" - android:elevation="0dp" - app:cardCornerRadius="20dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> - - - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/etReceiverUsername" - android:layout_width="match_parent" + android:elevation="5dp" + android:layout_height="50dp" + android:background="@color/unfollow"> + <ImageButton + android:id="@+id/btnBack" + android:layout_width="50dp" android:layout_height="match_parent" - android:background="@drawable/rounded_white_button_login" - android:hint=" kome slati poruku?" - android:inputType="textPersonName" - android:paddingLeft="15dp" /> + android:layout_gravity="center_vertical" + android:clickable="true" + android:src="@drawable/ic_baseline_arrow_back" + android:background="@null" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" /> + + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:id="@+id/llHeader" + android:layout_height="50dp"> + <ImageView + android:id="@+id/ivUserImage" + android:layout_width="50dp" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_nav_profile" + android:padding="5dp" + android:scaleType="centerCrop"/> + <TextView + android:id="@+id/tvFragmentTitle" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + android:text="Chat" + android:textSize="20dp" /> + </androidx.appcompat.widget.LinearLayoutCompat> + + <androidx.cardview.widget.CardView + android:id="@+id/cvParentUsername" + android:layout_width="wrap_content" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:elevation="0dp" + app:cardCornerRadius="20dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/etReceiverUsername" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/rounded_white_button_login" + android:hint=" kome slati poruku?" + android:inputType="textPersonName" + android:paddingLeft="15dp" /> + + + </androidx.cardview.widget.CardView> + </androidx.appcompat.widget.LinearLayoutCompat> - </androidx.cardview.widget.CardView> - </androidx.constraintlayout.widget.ConstraintLayout> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/messagesContainer" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintBottom_toTopOf="@id/cvParentMessageEdit" - app:layout_constrainedHeight="true"> + android:animateLayoutChanges="true" + android:layout_weight="1"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvMain" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintBottom_toBottomOf="parent" - > + app:layout_constraintBottom_toBottomOf="parent"> </androidx.recyclerview.widget.RecyclerView> </androidx.constraintlayout.widget.ConstraintLayout> @@ -72,14 +97,12 @@ android:id="@+id/cvParentMessageEdit" android:layout_width="match_parent" android:layout_height="40dp" + android:layout_marginBottom="5dp" android:layout_marginStart="16dp" android:layout_marginTop="10dp" android:layout_marginEnd="16dp" android:elevation="0dp" - app:cardCornerRadius="20dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent"> + app:cardCornerRadius="20dp"> <com.google.android.material.textfield.TextInputEditText @@ -89,16 +112,21 @@ android:background="@drawable/rounded_white_button_login" android:hint=" poruka" android:inputType="textPersonName" - android:paddingLeft="15dp" /> + android:paddingLeft="15dp" + tools:ignore="TouchTargetSizeCheck" + android:autofillHints="emailAddress"/> <ImageButton android:id="@+id/btnSendMessage" - android:layout_width="49dp" - android:layout_height="50dp" - android:layout_gravity="right" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_gravity="right|center_vertical" android:scaleType="centerCrop" + android:layout_marginEnd="10dp" + android:background="@null" android:src="@drawable/post_comment" - app:cornerRadius="16dp" /> + app:cornerRadius="16dp" + tools:ignore="SpeakableTextPresentCheck" /> </androidx.cardview.widget.CardView> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file +</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_single_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_single_post.xml index e3cabb5..cf5327a 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_single_post.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_single_post.xml @@ -1,310 +1,196 @@ <?xml version="1.0" encoding="utf-8"?> - <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" + xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="@dimen/component_padding" - xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".Activities.ActivitySinglePost"> - <ScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:fillViewport="true"> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="match_parent"> - <androidx.recyclerview.widget.RecyclerView + + <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvMain" android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_margin="0dp" android:paddingBottom="@dimen/component_padding" - android:layout_height="400dp" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> - </androidx.recyclerview.widget.RecyclerView> - - - -<androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="bottom" - app:layout_constraintTop_toBottomOf="@id/rvMain" - tools:layout_editor_absoluteX="0dp"> - - <TextView - android:id="@+id/tvLocationParent" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="top|start" - android:padding="@dimen/text_padding" - android:text="Drzava, grad" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvLocationType" /> - - <TextView - android:id="@+id/tvTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="top|start" - android:padding="@dimen/text_padding" - android:text="Naslov" - android:textSize="@dimen/header1_size" - android:textStyle="bold" - app:layout_constraintStart_toStartOf="parent" /> - - <TextView - android:id="@+id/tvLocationType" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="top|start" - android:padding="@dimen/text_padding" - android:text="Tip lokacije" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> - - <TextView - android:id="@+id/tvUser" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:clickable="true" - android:gravity="top|start" - android:padding="@dimen/text_padding" - android:text="User" + app:layout_constraintBottom_toTopOf="@+id/linearLayout2" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvLocationParent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/constraintLayout" + android:id="@+id/linearLayout2" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="36dp" + android:layout_height="308dp" + android:background="@drawable/view_top_corner_radius" + android:elevation="30dp" + android:paddingHorizontal="16dp" + android:paddingTop="16dp" + android:paddingBottom="0dp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="1.0" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvLocationParent"> + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent"> + - <LinearLayout - android:id="@+id/linearLayout" + <TextView + android:id="@+id/tvTitle" + style="@style/title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal" + android:layout_marginTop="24dp" + android:gravity="top|start" + android:padding="@dimen/text_padding" + android:text="Naslov" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> + app:layout_constraintTop_toTopOf="parent" /> - <ImageView - android:id="@+id/star1" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:src="@android:drawable/btn_star_big_on" /> - - <ImageView - android:id="@+id/star2" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:src="@android:drawable/btn_star_big_on" /> + <ImageView + android:id="@+id/imageView12" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_location_on_24" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> - <ImageView - android:id="@+id/star3" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:src="@android:drawable/btn_star_big_on" /> + <TextView + android:id="@+id/tvLocationParent" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="top|start" + android:padding="@dimen/text_padding" + android:text="Drzava, grad" + app:layout_constraintStart_toEndOf="@+id/imageView12" + app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> - <ImageView - android:id="@+id/star4" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:src="@android:drawable/btn_star_big_on" /> + <TextView + android:id="@+id/tvLocationType" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:gravity="top|start" + android:padding="@dimen/text_padding" + android:text="Tip lokacije" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> - <ImageView - android:id="@+id/star5" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_weight="1" - android:src="@android:drawable/btn_star_big_on" /> - </LinearLayout> + <TextView + android:id="@+id/tvUser" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:clickable="true" + android:gravity="top|start" + android:padding="@dimen/text_padding" + android:text="User" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvLocationType" /> <TextView android:id="@+id/tvRating" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="24dp" + android:layout_marginEnd="4dp" android:padding="@dimen/text_padding" android:text="4.2" android:textStyle="bold" app:layout_constraintEnd_toStartOf="@+id/tvNumberOfRatings" - tools:layout_editor_absoluteY="4dp" /> + app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/tvNumberOfRatings" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="24dp" android:padding="@dimen/text_padding" android:text="(10,500)" app:layout_constraintEnd_toEndOf="parent" - tools:layout_editor_absoluteY="4dp" /> - - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/constraintLayout3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/rounded_picture_background" - android:elevation="5dp" - android:padding="@dimen/component_padding" - app:layout_constraintTop_toBottomOf="@+id/linearLayout" - tools:layout_editor_absoluteX="0dp"> - - <TextView - android:id="@+id/tvDescriptionLabel" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="top|start" - android:padding="@dimen/text_padding" - android:text="Opis" - android:textStyle="bold" /> - - <TextView - android:id="@+id/tvDescription" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="TextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextView" - app:layout_constraintTop_toBottomOf="@+id/tvDescriptionLabel" /> - - </androidx.constraintlayout.widget.ConstraintLayout> + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/activitySinglePostChangeHeightUp" + android:layout_width="100dp" + android:layout_height="30dp" + android:clickable="true" + android:src="@drawable/ic_round_keyboard_arrow_up_24" + android:text="Button" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/activitySinglePostChangeHeightDown" + android:layout_width="100dp" + android:layout_height="30dp" + android:clickable="true" + android:src="@drawable/ic_round_keyboard_arrow_down_24" + android:text="Button" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - <LinearLayout - android:id="@+id/linearLayout2" + <org.osmdroid.views.MapView + android:id="@+id/MapDialogueMapView" android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="1" - android:orientation="horizontal" - android:paddingVertical="@dimen/component_padding" - app:layout_constraintTop_toBottomOf="@id/constraintLayout3"> - - <ImageButton - android:id="@+id/rateStar1" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:scaleType="centerCrop" - android:src="@drawable/empty_star" /> - - <ImageButton - android:id="@+id/rateStar2" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:scaleType="centerCrop" - android:src="@drawable/empty_star" /> - - <ImageButton - android:id="@+id/rateStar3" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:scaleType="centerCrop" - android:src="@drawable/empty_star" /> - - <ImageButton - android:id="@+id/rateStar4" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:scaleType="centerCrop" - android:src="@drawable/empty_star" /> - - <ImageButton - android:id="@+id/rateStar5" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:scaleType="centerCrop" - android:src="@drawable/empty_star" /> - - <Button - android:id="@+id/submitRating" - android:layout_width="30dp" - android:layout_height="40dp" - android:layout_gravity="center_vertical" - android:layout_weight="1" - android:backgroundTint="@color/white" - android:text="ok" - android:textColor="@color/black" /> - </LinearLayout> + android:layout_height="150dp" + android:layout_marginTop="8dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvUser" /> <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/singlePostDetail" android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/linearLayout2"> + android:layout_height="0dp" + android:layout_marginTop="8dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/MapDialogueMapView"> - <LinearLayout - android:id="@+id/postCommentLayout" - android:layout_width="match_parent" + <Button + android:id="@+id/btnActivitySinglePostDescription" + android:layout_width="150dp" android:layout_height="wrap_content" - android:orientation="horizontal" - app:layout_constraintStart_toStartOf="parent"> - - <EditText - android:id="@+id/NewComment" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:hint="Unesite komentar ovde" /> + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:text="opis" + android:textColor="@color/cardview_dark_background" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - <ImageButton - android:id="@+id/btnPostComment" - android:layout_width="50dp" - android:layout_height="50dp" - android:backgroundTint="@color/white" - android:scaleType="fitCenter" - android:src="@drawable/post_comment" /> - </LinearLayout> - - - <TextView - android:id="@+id/tvCommentLabel" - android:layout_width="wrap_content" + <Button + android:id="@+id/btnActivitySinglePostComments" + android:layout_width="150dp" android:layout_height="wrap_content" - android:padding="@dimen/text_padding" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" android:text="Komentari" - android:textStyle="bold" - app:layout_constraintTop_toBottomOf="@id/postCommentLayout" /> - - <TextView - android:id="@+id/tvCommentCount" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="@dimen/text_padding" - android:text="0" - app:layout_constraintStart_toEndOf="@id/tvCommentLabel" - app:layout_constraintTop_toBottomOf="@id/postCommentLayout" /> + android:textColor="@color/cardview_dark_background" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/rvComments" + <FrameLayout + android:id="@+id/flSinglePostFragmentContainer" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:nestedScrollingEnabled="false" - app:layout_constraintTop_toBottomOf="@id/tvCommentLabel"> - - </androidx.recyclerview.widget.RecyclerView> + android:layout_height="0dp" + android:paddingHorizontal="16dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/btnActivitySinglePostComments" + app:layout_constraintVertical_bias="1.0"></FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> -</androidx.constraintlayout.widget.ConstraintLayout> -</androidx.constraintlayout.widget.ConstraintLayout> -</ScrollView> + </androidx.constraintlayout.widget.ConstraintLayout> 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 cbcafc5..5c0ceb8 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 @@ -12,10 +12,10 @@ android:layout_height="match_parent"> <ImageView - + android:scaleType="centerCrop" android:id="@+id/imageView3" android:layout_width="match_parent" - android:layout_height="250dp" + android:layout_height="180dp" android:foreground="@drawable/b3" android:foregroundGravity="center_vertical|center|center_horizontal|fill" android:src="@drawable/b3" @@ -28,15 +28,15 @@ android:id="@+id/tvFragmentProfileInfoContainer" android:layout_width="0dp" - android:layout_height="240dp" + android:layout_height="199dp" android:layout_marginStart="20dp" - android:layout_marginTop="120dp" + android:layout_marginTop="90dp" android:layout_marginEnd="20dp" android:adjustViewBounds="true" - android:background="@drawable/profile_view_background" - + android:background="#E8FFFFFF" android:elevation="1dp" android:scaleType="fitEnd" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" @@ -46,10 +46,10 @@ <androidx.cardview.widget.CardView android:id="@+id/cvFragmentHomePageProfile" - android:layout_width="130dp" - android:layout_height="130dp" + android:layout_width="120dp" + android:layout_height="120dp" android:layout_gravity="center" - android:layout_marginTop="60dp" + android:layout_marginTop="24dp" android:elevation="10dp" app:cardCornerRadius="250dp" app:layout_constraintEnd_toEndOf="parent" @@ -74,55 +74,54 @@ android:background="?android:attr/listDivider" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/btnActivityUserProfileShowPosts" /> + app:layout_constraintTop_toBottomOf="@+id/buttons" /> + + <LinearLayout + android:id="@+id/buttons" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:weightSum="3" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer"> <Button + android:layout_weight="1" android:id="@+id/btnActivityUserProfileShowPosts" - android:layout_width="wrap_content" + android:layout_width="120dp" 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:layout_weight="1" android:id="@+id/btnFragmentUserProfileShowData" - android:layout_width="wrap_content" + android:layout_width="110dp" android:layout_height="wrap_content" - android:layout_marginTop="4dp" - android:layout_marginEnd="20dp" android:backgroundTint="#FFFFFF" android:stateListAnimator="@null" - android:text="Podaci" - + android:text="Nalog" 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_width="120dp" 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/btnActivityUserProfileShowPosts" - app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> - + /> + </LinearLayout> <FrameLayout + android:layout_weight="1" android:id="@+id/flActivityProfileFragmentContainer" - android:layout_width="409dp" - android:layout_height="319dp" + android:layout_width="match_parent" + android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" @@ -132,135 +131,156 @@ <TableLayout - android:layout_width="363dp" - - android:layout_height="wrap_content" - android:layout_marginStart="30dp" - android:layout_marginTop="5dp" - android:layout_marginEnd="30dp" - android:layout_marginBottom="8dp" + android:layout_width="350dp" + android:layout_height="140dp" + android:layout_marginStart="35dp" + android:layout_marginEnd="35dp" android:elevation="1dp" 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" - app:layout_constraintVertical_bias="0.35000002"> + app:layout_constraintTop_toTopOf="@+id/tvFragmentProfileInfoContainer" + app:layout_constraintVertical_bias="0.88"> <TableRow - android:layout_width="match_parent" + android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_column="1"> + android:layout_column="1" + > <TextView android:id="@+id/tvActivityUserProfileName" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_column="1" android:layout_gravity="center" android:text="Petar Petrović" - android:textStyle="bold" - android:textSize="23sp" /> + android:textSize="23sp" + android:textStyle="bold" /> </TableRow> - <TableRow android:layout_marginTop="20dp"> - + <TableRow + android:gravity="center" + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:layout_marginTop="5dp"> + <LinearLayout + android:orientation="horizontal" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:weightSum="3" + > <TextView android:id="@+id/tvFragmentUserProfilePosts" - android:layout_width="105dp" + android:layout_weight="1" + android:backgroundTint="@color/white" android:gravity="center" - android:text="OBJAVE" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:textSize="14sp" android:stateListAnimator="@null" - android:backgroundTint="@color/white" - android:textColor="#757471"/> + android:text="OBJAVE" + + android:textColor="#757471" /> <Button android:id="@+id/tvActivityUserProfileFollowers" android:layout_width="110dp" - android:layout_height="28dp" + android:layout_height="27dp" android:layout_margin="0dp" android:backgroundTint="@color/white" android:clickable="true" + android:layout_weight="1" android:gravity="center" android:padding="0dp" android:stateListAnimator="@null" android:text="PRATIOCI" android:textColor="#757471" - + android:textSize="14sp" tools:ignore="TouchTargetSizeCheck" /> <Button + android:textSize="14sp" android:id="@+id/tvActivityUserProfileFollow" android:layout_width="110dp" - android:layout_height="28dp" + android:layout_height="27dp" android:layout_margin="0dp" android:backgroundTint="@color/white" android:clickable="true" + android:layout_weight="1" android:gravity="center" android:padding="0dp" android:stateListAnimator="@null" android:text="PRAĆENJA" android:textColor="#757471" tools:ignore="TouchTargetSizeCheck" /> + </LinearLayout> + </TableRow> <TableRow - android:layout_height="wrap_content" - > + android:layout_marginLeft="10dp" + android:layout_marginRight="10dp" + android:layout_gravity="center" + android:layout_height="wrap_content"> + <LinearLayout> <TextView android:id="@+id/tvActivityUserProfilePostsNo" android:layout_width="110dp" android:layout_height="wrap_content" android:gravity="center" android:text="156" + android:textSize="20dp" android:textStyle="bold" /> <TextView - android:id="@+id/tvActivityUserProfileFollowersNo" android:layout_width="110dp" + android:layout_height="wrap_content" + android:id="@+id/tvActivityUserProfileFollowersNo" android:gravity="center" android:text="50" android:textSize="20dp" - android:textStyle="bold"/> + android:textStyle="bold" /> <TextView android:id="@+id/tvActivityUserProfileFollowNo" android:layout_width="110dp" + android:layout_height="wrap_content" android:gravity="center" android:text="40" android:textSize="20dp" - android:textStyle="bold"/> - + android:textStyle="bold" /> + </LinearLayout> </TableRow> - <TableRow - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - > - <androidx.constraintlayout.widget.ConstraintLayout android:layout_span="3"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="10dp" + android:layout_marginStart="10dp" + android:layout_marginEnd="10dp" + android:layout_gravity="center"> <Button android:id="@+id/btnActivityUserProfileFollow" android:layout_width="280dp" - android:layout_height="30dp" - android:layout_marginStart="16dp" + android:layout_height="35dp" + android:backgroundTint="@color/button_main" 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:layout_constraintVertical_bias="0.0" app:shapeAppearanceOverlay="@style/Circular" tools:ignore="TouchTargetSizeCheck" /> @@ -268,29 +288,26 @@ android:id="@+id/btnActivityUserProfileUnFollow" android:layout_width="280dp" - android:layout_height="30dp" - android:layout_marginStart="16dp" + android:layout_height="35dp" + android:backgroundTint="@color/unfollow" 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" + android:text="NE PRATI više" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.13" + app:layout_constraintVertical_bias="0.0" app:shapeAppearanceOverlay="@style/Circular" tools:ignore="TouchTargetSizeCheck" /> - <ImageButton android:id="@+id/activityUserProfileOpenChat" android:layout_width="35dp" - android:layout_height="30dp" + android:layout_height="35dp" android:layout_gravity="center" - android:layout_marginEnd="16dp" android:height="40dp" android:background="@drawable/rounded_button" android:backgroundTint="@color/button_main" @@ -298,11 +315,10 @@ 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 7858e94..f7ef08c 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml @@ -1,42 +1,15 @@ <?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" - 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" /> + android:layout_width="match_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" @@ -45,23 +18,31 @@ android:textColor="#C0C0C0" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="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" + android:minWidth="40dp" + android:layout_height="30dp" + android:layout_marginBottom="10dp" + android:layout_marginLeft="10dp" + android:backgroundTint="@color/unfollow" + app:cardCornerRadius="15dp" + android:background="@drawable/view_corner_radius" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tvDate"> - - - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvDate"> + + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tvMessage" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:backgroundTint="@color/unfollow" + android:padding="5dp" + android:paddingHorizontal="15dp" + android:text="blabla" + app:layout_constraintEnd_toEndOf="parent" /> </androidx.cardview.widget.CardView> <TextView 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 aaabd86..b076cf8 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,78 +1,58 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" - - xmlns:tools="http://schemas.android.com/tools" android:id="@+id/clMessage" - android:layout_width="wrap_content" android:layout_height="wrap_content" - - android:layout_marginStart="8dp" - android:layout_marginTop="16dp"> + android:layout_width="match_parent"> <TextView android:id="@+id/tvDate" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="32dp" - android:elevation="10dp" - + 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_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent"/> <androidx.cardview.widget.CardView android:id="@+id/cvContainer" android:layout_width="wrap_content" + android:minWidth="40dp" android:layout_height="30dp" - android:layout_margin="5dp" - android:elevation="5dp" - app:cardCornerRadius="10dp" + android:layout_marginBottom="10dp" + android:layout_marginLeft="10dp" + android:backgroundTint="#eef1f6" + android:background="@drawable/view_corner_radius" + app:cardCornerRadius="15dp" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent"> - - + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvDate"> - <LinearLayout - android:id="@+id/llContainer" + <com.google.android.material.textview.MaterialTextView + android:id="@+id/tvMessage" 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> - + android:backgroundTint="#eef1f6" + android:padding="5dp" + android:paddingHorizontal="15dp" + android:text="blabla" + app:layout_constraintEnd_toEndOf="parent" /> </androidx.cardview.widget.CardView> - <TextView android:id="@+id/tvTimestamp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="4dp" - android:layout_marginTop="-5dp" - android:text="8:00" + android:text="10:00" android:textColor="#C0C0C0" android:textSize="10sp" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvDate" /> + app:layout_constraintBottom_toBottomOf="@+id/cvContainer" + app:layout_constraintStart_toEndOf="@+id/cvContainer" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml index 35431ff..c995b4b 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml @@ -1,19 +1,54 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="70dp" + android:padding="5dp" xmlns:app="http://schemas.android.com/apk/res-auto"> - <androidx.appcompat.widget.AppCompatImageView - android:layout_width="50dp" - android:layout_height="50dp" + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="5dp" + android:id="@+id/readIndicator" + android:layout_height="5dp" + android:layout_gravity="center_vertical"/> + <ImageView android:id="@+id/ivUserImage" - android:src="@drawable/ic_nav_profile"/> - <TextView + android:layout_width="70dp" + android:layout_height="match_parent" + android:layout_gravity="center_vertical" + android:src="@drawable/ic_nav_profile" + android:padding="5dp" + android:scaleType="centerCrop"/> + <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="wrap_content" android:layout_height="match_parent" - android:id="@+id/tvUsername" - android:textSize="@dimen/header1_size" - android:textColor="@color/black" - app:layout_constraintStart_toEndOf="@id/ivUserImage"/> - -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file + android:layout_weight="1" + android:orientation="vertical"> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/tvUsername" + android:layout_weight="1" + android:textSize="@dimen/header1_size" + android:textColor="@color/black"/> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/tvLastMessageDate" + android:text="1/1/1" + android:textSize="@dimen/header2_size" + android:textColor="@color/unfollow"/> + </androidx.appcompat.widget.LinearLayoutCompat> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/tvLastMessage" + android:text="hej, sta ima novo?" + android:layout_weight="1" + android:gravity="center_vertical" + android:textAlignment="gravity" + android:textSize="@dimen/header2_size" + android:textColor="@color/unfollow"/> + </androidx.appcompat.widget.LinearLayoutCompat> +</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file 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 f39acf2..12c37e8 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 @@ -82,7 +82,7 @@ app:layout_constraintTop_toBottomOf="@+id/brzodolokacije"> - <com.google.android.material.textfield.TextInputEditText + <AutoCompleteTextView android:id="@+id/etFragmentHomePageSearch" android:layout_width="match_parent" android:layout_height="match_parent" @@ -92,6 +92,7 @@ android:paddingLeft="15dp" /> <com.google.android.material.button.MaterialButton + android:id="@+id/mbFragmentHomePageSearchButton" android:layout_width="49dp" android:layout_height="match_parent" android:layout_gravity="right" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_profile_info.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_profile_info.xml index 4a91f49..eaf014d 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_profile_info.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_profile_info.xml @@ -4,27 +4,64 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:orientation="vertical" tools:context=".Fragments.FragmentMyProfileInfo"> - <!-- TODO: Update blank fragment layout --> - - <TextView - android:id="@+id/textView5" + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent" - android:text="Moji podaci" - tools:layout_editor_absoluteX="0dp" - tools:layout_editor_absoluteY="0dp" /> + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintBottom_toTopOf="@+id/buttonLogOut" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <Button + android:id="@+id/changeAccountData" + style="@style/clean_button_margin" + android:drawableLeft="@drawable/ic_outline_account_circle_24" + android:text="Izmena Naloga" /> + + <Button + android:id="@+id/ChangePassword" + style="@style/clean_button_margin" + android:drawableLeft="@drawable/ic_outline_change_circle_24" + android:text="Promena Lozinke" /> + + <Button + android:id="@+id/getAccoutStatistics" + style="@style/clean_button_margin" + android:drawableLeft="@drawable/ic_outline_stats_24" + android:text="Pregled statistike" /> + + <Button + android:id="@+id/getMyFavorite" + style="@style/clean_button_margin" + android:drawableLeft="@drawable/ic_round_favorite_border_24" + android:text="Objave koje vam se sviđaju" /> + + <Button + android:id="@+id/inviteFriends" + style="@style/clean_button_margin" + android:drawableLeft="@drawable/ic_outline_share_24" + android:text="Pozovite prijatelje" /> + </LinearLayout> <Button android:id="@+id/buttonLogOut" - android:layout_width="wrap_content" + style="@style/Circular" + android:layout_width="0dp" android:layout_height="wrap_content" - android:text="Log out" - app:layout_constraintBottom_toBottomOf="@+id/textView5" - app:layout_constraintEnd_toEndOf="@+id/textView5" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/textView5" /> + android:layout_gravity="bottom" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="16dp" + android:drawableLeft="@drawable/ic_baseline_logout_24" + android:text="Izlogujte se" + android:drawableTint="@color/white" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + 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/fragment_profile.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml index 7531cf5..8fe6ee6 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml @@ -15,7 +15,7 @@ android:id="@+id/imageView3" android:layout_width="match_parent" - android:layout_height="290dp" + android:layout_height="190dp" android:foreground="@drawable/b3" android:foregroundGravity="center_vertical|center|center_horizontal|fill" android:src="@drawable/b3" @@ -26,8 +26,8 @@ <ImageView android:id="@+id/imageView4" - android:layout_width="411dp" - android:layout_height="287dp" + android:layout_width="match_parent" + android:layout_height="190dp" app:layout_constraintBottom_toBottomOf="@+id/imageView3" app:layout_constraintEnd_toEndOf="@id/imageView3" app:layout_constraintHorizontal_bias="0.0" @@ -41,7 +41,7 @@ android:layout_width="0dp" android:layout_height="199dp" android:layout_marginStart="20dp" - android:layout_marginTop="156dp" + android:layout_marginTop="90dp" android:layout_marginEnd="20dp" android:adjustViewBounds="true" android:background="#E8FFFFFF" @@ -56,10 +56,9 @@ <androidx.cardview.widget.CardView android:id="@+id/cvFragmentHomePageProfile" - android:layout_width="140dp" - android:layout_height="140dp" + android:layout_width="120dp" + android:layout_height="120dp" android:layout_gravity="center" - android:layout_marginTop="24dp" android:elevation="10dp" app:cardCornerRadius="250dp" app:layout_constraintBottom_toTopOf="@+id/tableLayout" @@ -67,14 +66,14 @@ app:layout_constraintHorizontal_bias="0.498" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.887"> + app:layout_constraintVertical_bias="0.65999997"> <ImageView android:id="@+id/tvFragmentProfileProfilePicture" - android:layout_width="140dp" - android:layout_height="140dp" - android:elevation="10dp" + android:layout_width="120dp" + android:layout_height="120dp" + android:elevation="20dp" android:scaleType="centerCrop" android:src="@drawable/ic_baseline_person_24" tools:ignore="ContentDescription" /> @@ -99,7 +98,7 @@ <TableLayout android:id="@+id/tableLayout" - android:layout_width="323dp" + android:layout_width="0dp" android:layout_height="120dp" android:elevation="20dp" android:gravity="center" @@ -107,18 +106,23 @@ app:layout_constraintBottom_toBottomOf="@+id/tvFragmentProfileInfoContainer" app:layout_constraintEnd_toEndOf="@+id/tvFragmentProfileInfoContainer" app:layout_constraintHorizontal_bias="0.488" - app:layout_constraintStart_toStartOf="@+id/tvFragmentProfileInfoContainer"> + app:layout_constraintStart_toStartOf="@+id/tvFragmentProfileInfoContainer" + app:layout_constraintTop_toTopOf="@+id/tvFragmentProfileInfoContainer" + app:layout_constraintVertical_bias="0.87"> <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" - android:gravity="center"> <TextView android:id="@+id/tvFragmentProfileName" + android:textSize="23sp" + android:textStyle="bold" android:layout_width="match_parent" android:layout_height="match_parent" + android:gravity="center" + android:layout_marginBottom="10dp" android:text="Petar Petrović" /> </TableRow> @@ -133,119 +137,182 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" - android:text="#PetarP" /> + android:text="PetarP" + android:textSize="17sp" /> </TableRow> - <Space android:layout_height="20dp"></Space> - <TableRow android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center"> + android:layout_height="100dp"> - <TextView - android:id="@+id/tvFragmentProfilePosts" - android:gravity="center" - android:text="OBJAVE" /> + <Button + android:layout_height="8dp" + android:background="@drawable/rounded_transparent_button" + android:clickable="false" + android:visibility="invisible" /> + </TableRow> - <TextView - android:id="@+id/tvFragmentProfileFollowers" - android:gravity="center" - android:clickable="true" - android:text="PRATIOCI" /> - <TextView - android:id="@+id/tvFragmentProfileFollow" - android:gravity="center" - android:text="PRAĆENJA" /> + <TableRow + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:weightSum="1"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:weightSum="3"> + + <TextView + android:id="@+id/tvFragmentProfilePosts" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:width="100dp" + android:textSize="15dp" + android:textColor="#757471" + android:gravity="center" + android:text="OBJAVE" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowers" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:width="100dp" + android:textSize="15sp" + android:clickable="true" + android:textColor="#757471" + android:gravity="center" + android:text="PRATIOCI" /> + + <TextView + android:id="@+id/tvFragmentProfileFollow" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:width="100dp" + android:gravity="center" + android:textSize="15sp" + android:textColor="#757471" + android:text="PRAĆENJA" /> + </LinearLayout> </TableRow> <TableRow android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="center"> - - <TextView - android:id="@+id/tvFragmentProfilePostsNo" - android:gravity="center" - android:text="156" /> - - <TextView - android:id="@+id/tvFragmentProfileFollowersNo" - android:gravity="center" - android:text="50" /> - - <TextView - android:id="@+id/tvFragmentProfileFollowNo" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:text="40" /> + android:gravity="center" + android:weightSum="1"> + + <LinearLayout> + + <TextView + android:id="@+id/tvFragmentProfilePostsNo" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:text="156" + android:textSize="20dp" + android:textStyle="bold" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowersNo" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:text="50" + android:textSize="20dp" + android:textStyle="bold" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowNo" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:text="40" + android:textSize="20dp" + android:textStyle="bold" /> + </LinearLayout> </TableRow> </TableLayout> - <View - android:id="@+id/divider" - android:layout_width="409dp" - android:layout_height="40dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/btnFragmentProfileShowMyPosts" /> - - <Button - android:id="@+id/btnFragmentProfileShowMyPosts" - android:layout_width="wrap_content" + <LinearLayout + android:id="@+id/buttons" + android:layout_width="match_parent" 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" + android:weightSum="3" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer"> - <Button - android:id="@+id/btnFragmentProfileShowMyData" - 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" + <Button + android:id="@+id/btnFragmentProfileShowMyPosts" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + 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/btnFragmentProfileShowMyRecensions" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:layout_weight="1" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:text="Istorija" + android:textColor="@color/cardview_dark_background" + app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyPosts" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + + <Button + android:id="@+id/btnFragmentProfileShowMyData" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" - android:textColor="@color/cardview_dark_background" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="1.0" - app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyRecensions" - app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + android:text="Nalog" + android:textColor="@color/cardview_dark_background" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyRecensions" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> - <Button - android:id="@+id/btnFragmentProfileShowMyRecensions" - 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="Istorija" - android:textColor="@color/cardview_dark_background" - app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyPosts" - app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + </LinearLayout> <FrameLayout android:id="@+id/flFragmentProfileFragmentContainer" - android:layout_width="409dp" - android:layout_height="319dp" - android:layout_marginTop="40dp" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="4dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/divider"> - </FrameLayout> + app:layout_constraintTop_toBottomOf="@+id/divider6"></FrameLayout> + + <View + android:id="@+id/divider6" + android:layout_width="409dp" + android:layout_height="1dp" + android:layout_marginTop="4dp" + android:background="?android:attr/listDivider" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/buttons" /> </androidx.constraintlayout.widget.ConstraintLayout> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_posts.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_posts.xml index e1effc4..e3db4bc 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_posts.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_show_posts.xml @@ -21,8 +21,8 @@ app:layout_constraintTop_toBottomOf="@+id/tvFragmentHomePageSearch"> - <com.google.android.material.textfield.TextInputEditText - android:id="@+id/etFragmentHomePageSearch" + <AutoCompleteTextView + android:id="@+id/etFragmentShowPostsSearch" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/rounded_white_button_login" @@ -31,6 +31,7 @@ android:inputType="textPersonName" /> <com.google.android.material.button.MaterialButton + android:id="@+id/mbFragmentHomePageSearch" android:layout_width="49dp" android:layout_height="match_parent" android:layout_gravity="right" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_comments.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_comments.xml new file mode 100644 index 0000000..250f640 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_comments.xml @@ -0,0 +1,78 @@ +<?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:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".FragmentSinglePostComments"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/constraintLayout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent"> + + + <TextView + android:id="@+id/tvCommentLabel" + style="@style/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="@dimen/text_padding" + android:text="Komentari" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tvCommentCount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="@dimen/text_padding" + android:text="0" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/tvCommentLabel" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvComments" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:nestedScrollingEnabled="false" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/postCommentLayout"> + + </androidx.recyclerview.widget.RecyclerView> + + <LinearLayout + android:id="@+id/postCommentLayout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + app:layout_constraintTop_toBottomOf="@+id/constraintLayout"> + + <EditText + android:id="@+id/NewComment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:hint="Unesite komentar ovde" /> + + <ImageView + android:id="@+id/btnPostComment" + android:layout_width="30dp" + android:layout_height="30dp" + android:backgroundTint="@color/white" + android:scaleType="fitCenter" + android:src="@drawable/ic_baseline_send_24" /> + + </LinearLayout> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_description.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_description.xml new file mode 100644 index 0000000..5bbdb14 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_single_post_description.xml @@ -0,0 +1,177 @@ +<?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.FragmentSinglePostDescription"> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/constraintLayout3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/rounded_picture_background" + android:padding="@dimen/component_padding" + tools:layout_editor_absoluteX="0dp"> + + + <TextView + android:id="@+id/tvDescription" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="TextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextView" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.526" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="32dp" + android:text="Oceni" + android:textColor="@color/cardview_dark_background" + android:textSize="@dimen/header1_size" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.005" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvDescription" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:orientation="horizontal" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title"> + + <ImageView + android:clickable="true" + android:id="@+id/rateStar1" + android:layout_width="50dp" + android:layout_height="50dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24" /> + + <ImageView + android:clickable="true" + android:id="@+id/rateStar2" + android:layout_width="50dp" + android:layout_height="50dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24" /> + + <ImageView + android:clickable="true" + android:id="@+id/rateStar3" + android:layout_width="50dp" + android:layout_height="50dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24" /> + + <ImageView + android:clickable="true" + android:id="@+id/rateStar4" + android:layout_width="50dp" + android:layout_height="50dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24" /> + + <ImageView + android:clickable="true" + android:id="@+id/rateStar5" + android:layout_width="50dp" + android:layout_height="50dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24" /> + + + </LinearLayout> + <!--<LinearLayout + android:id="@+id/linearLayout2" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="24dp" + + + android:paddingVertical="@dimen/component_padding" + app:layout_constraintTop_toBottomOf="@id/constraintLayout3" + tools:layout_editor_absoluteX="10dp"> + + + <TextView + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Oceni" + style="@style/title" + android:textColor="@color/cardview_dark_background" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvDescriptionLabel" /> + + <ImageButton + android:id="@+id/rateStar1" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:scaleType="centerCrop" + android:src="@drawable/empty_star" /> + + <ImageButton + android:id="@+id/rateStar2" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:scaleType="centerCrop" + android:src="@drawable/empty_star" /> + + <ImageButton + android:id="@+id/rateStar3" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:scaleType="centerCrop" + android:src="@drawable/empty_star" /> + + <ImageButton + android:id="@+id/rateStar4" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:scaleType="centerCrop" + android:src="@drawable/empty_star" /> + + <ImageButton + android:id="@+id/rateStar5" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:scaleType="centerCrop" + android:src="@drawable/ic_round_star_outline_24"> + + <Button + android:id="@+id/submitRating" + android:layout_width="30dp" + android:layout_height="40dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" + + android:text="ok"/> + </LinearLayout>--> + + </androidx.constraintlayout.widget.ConstraintLayout> + + +</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 a396416..aa8bf99 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 @@ -18,7 +18,7 @@ android:orientation="vertical" android:layout_height="wrap_content" android:layout_gravity="end" android:layout_marginEnd="110dp" - android:src="@drawable/ic_baseline_post_add_24" + android:src="@drawable/ic_baseline_map_24" /> <TextView @@ -28,7 +28,7 @@ android:orientation="vertical" android:layout_gravity="end" android:layout_marginEnd="20dp" android:clickable="true" - android:text="@string/dodaj_objavu" + android:text="Mapa objava" android:textSize="15sp" android:focusable="true" /> </androidx.cardview.widget.CardView> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_map.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_map.xml new file mode 100644 index 0000000..5ea5c93 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts_map.xml @@ -0,0 +1,29 @@ +<?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:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".UserPostsMapFragment"> + + <org.osmdroid.views.MapView + android:id="@+id/FragmentUserPostsMapMapView" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/btnFragmentUserPostsBack" + android:layout_width="30dp" + android:layout_height="30dp" + android:clickable="true" + android:layout_marginTop="5dp" + android:layout_marginLeft="5dp" + android:src="@drawable/ic_baseline_arrow_back_24" + app:layout_constraintStart_toStartOf="parent" + 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/post_image.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_image.xml index c2a999d..fb8a035 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/post_image.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_image.xml @@ -1,17 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="380dp" - android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_margin="10dp" - android:background="@drawable/rounded_picture_background" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + + android:clickable="true" android:clipToOutline="true" - android:clickable="true"> + android:padding="5dp"> <ImageView android:id="@+id/locationImage" android:layout_width="match_parent" - android:layout_height="420dp" + android:layout_height="512dp" android:outlineProvider="background" android:scaleType="centerCrop" android:src="@drawable/b1" @@ -23,5 +24,4 @@ app:layout_constraintVertical_bias="0.0" /> - </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml index f219ea2..5e0dc03 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml @@ -1,22 +1,87 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:orientation="vertical" android:padding="@dimen/component_padding" xmlns:app="http://schemas.android.com/apk/res-auto"> - <TextView - android:id="@+id/tvCommentAuthor" - android:layout_width="wrap_content" + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="autor" - android:textStyle="bold" - android:padding="@dimen/text_padding"/> - <TextView - android:id="@+id/tvCommentText" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/ivPfp" + android:layout_width="50dp" + android:layout_height="50dp" + android:src="@drawable/ic_nav_profile" + app:layout_constraintEnd_toStartOf="@+id/tvCommentText" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + android:scaleType="centerCrop" + tools:layout_editor_absoluteY="27dp" /> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_weight="1"> + + <TextView + android:id="@+id/tvCommentAuthor" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="autor" + android:textStyle="bold" + android:padding="@dimen/text_padding"/> + + <TextView + android:id="@+id/tvCommentText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="@dimen/text_padding" + app:layout_constraintTop_toBottomOf="@id/tvCommentAuthor" + tools:layout_editor_absoluteX="54dp" /> + + </androidx.appcompat.widget.LinearLayoutCompat> + <ImageButton + android:id="@+id/btnReply" + android:layout_width="50dp" + android:layout_height="50dp" + android:layout_gravity="end" + android:layout_weight="0" + android:backgroundTint="@color/white" + android:scaleType="centerCrop" + android:src="@drawable/reply" /> + + + + </androidx.appcompat.widget.LinearLayoutCompat> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:id="@+id/llReply"> + + <EditText + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:id="@+id/etReply" + android:hint="odgovor na komentar"/> + <ImageButton + android:id="@+id/btnPostReply" + android:layout_width="50dp" + android:layout_height="50dp" + android:layout_gravity="end" + android:layout_weight="0" + android:backgroundTint="@color/white" + android:scaleType="centerCrop" + android:src="@drawable/post_comment" /> + </androidx.appcompat.widget.LinearLayoutCompat> + <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="autor" - android:padding="@dimen/text_padding" - app:layout_constraintTop_toBottomOf="@id/tvCommentAuthor"/> + android:id="@+id/rvReplies"/> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file +</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/dimens.xml b/Client/BrzoDoLokacije/app/src/main/res/values/dimens.xml index 181591b..5f0b4e1 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/dimens.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/dimens.xml @@ -2,6 +2,7 @@ <dimen name="fab_margin">16dp</dimen> <dimen name="text_padding">5dp</dimen> <dimen name="header1_size">20dp</dimen> + <dimen name="header2_size">18dp</dimen> <dimen name="component_padding">10dp</dimen> <dimen name="list_item_spacing">16dp</dimen> <dimen name="list_item_spacing_half">8dp</dimen> diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml b/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml index b180869..419c2e0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml @@ -6,6 +6,8 @@ <string name="title_activity_maps">MapsActivity</string> <string name="dodaj_objavu">Dodaj objavu</string> <string name="todo">TODO</string> + <string name="channel_name">Ćaskanja</string> + <string name="channel_description">Notifikacije o dostavljenim porukama</string> <string name="datum">Datum</string> <string name="od">Od</string> diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml index ca3ca44..0e53f9e 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml @@ -23,4 +23,26 @@ <item name="cornerSizeTopLeft">10dp</item> <item name="cornerSizeTopRight">10dp</item> </style> + + <style name="title"> + <item name="android:textSize">@dimen/header1_size</item> + <item name="android:textStyle">bold</item> + </style> + + <style name="clean_button"> + <item name="android:backgroundTint">@color/white</item> + <item name="android:textColor">#757471</item> + <item name="android:stateListAnimator">@null</item> + <item name="android:layout_height">50dp</item> + <item name="android:layout_width">wrap_content</item> + </style> + + <style name="clean_button_margin"> + <item name="android:backgroundTint">@color/white</item> + <item name="android:textColor">#757471</item> + <item name="android:stateListAnimator">@null</item> + <item name="android:layout_height">50dp</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_marginTop">7dp</item> + </style> </resources>
\ No newline at end of file |