diff options
146 files changed, 5489 insertions, 2091 deletions
diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 6b61141..83e7019 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -1,6 +1,8 @@ { "ExpandedNodes": [ - "" + "", + "\\Backend", + "\\Backend\\Api" ], "PreviewInSolutionExplorer": false }
\ No newline at end of file diff --git a/.vs/brzodolokacije/v17/.suo b/.vs/brzodolokacije/v17/.suo Binary files differindex 49a5729..3475e6c 100644 --- a/.vs/brzodolokacije/v17/.suo +++ b/.vs/brzodolokacije/v17/.suo diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite Binary files differindex 41e2574..d4967c0 100644 --- a/.vs/slnx.sqlite +++ b/.vs/slnx.sqlite diff --git a/Backend/Api/Api/Controllers/AuthController.cs b/Backend/Api/Api/Controllers/AuthController.cs index abb7adc..b63665b 100644 --- a/Backend/Api/Api/Controllers/AuthController.cs +++ b/Backend/Api/Api/Controllers/AuthController.cs @@ -120,5 +120,15 @@ namespace Api.Controllers return base.Content(html, "text/html"); } } + [HttpGet("jwttoid")] + [Authorize(Roles = "User")] + public async Task<ActionResult<string>> JwtToUserId() + { + var userid = await _userService.UserIdFromJwt(); + if (userid != null) + return Ok(userid); + return BadRequest(); + } + } } diff --git a/Backend/Api/Api/Controllers/PostController.cs b/Backend/Api/Api/Controllers/PostController.cs index 61a4f48..97646c2 100644 --- a/Backend/Api/Api/Controllers/PostController.cs +++ b/Backend/Api/Api/Controllers/PostController.cs @@ -56,7 +56,7 @@ namespace Api.Controllers } return BadRequest(); } - [HttpGet("posts/delete/{id}")] + [HttpDelete("posts/delete/{id}")] [Authorize(Roles = "User")] public async Task<ActionResult<string>> deletePost(string id) { @@ -140,9 +140,9 @@ namespace Api.Controllers } [HttpGet("locations/{id}/posts")] [Authorize(Roles = "User")] - public async Task<ActionResult<List<PostSend>>> searchPosts(string id,int page=0,int sorttype=1,int filterdate=1) + public async Task<ActionResult<List<PostSend>>> searchPosts(string id,bool filter,int page=0,int sorttype=1,int filterdate=1,int ratingFrom=-1, int ratingTo=-1,int viewsFrom=-1,int viewsTo=-1) { - var res = await _postService.SearchPosts(id,page,sorttype,filterdate); + var res = await _postService.SearchPosts(id,filter,page,sorttype,filterdate,ratingFrom,ratingTo,viewsFrom,viewsTo); if (res != null) { return Ok(res); @@ -199,5 +199,20 @@ namespace Api.Controllers { return Ok(await _postService.TrendingTags()); } - } + + [HttpGet("userFavouritePosts")] + [Authorize(Roles = "User")] + public async Task<ActionResult<List<PostSend>>> getUserFavouritePosts() + { + return Ok(await _postService.userFavouritePosts()); + } + + [HttpGet("posts/getAllPostsFilterSort")] + [Authorize(Roles = "User")] + public async Task<ActionResult<List<PostSend>>> GetAllPostsFilterSort([FromBody] FilterSort fs) + { + return Ok(await _postService.GetAllPostsFilterSort(fs)); + } + + } } diff --git a/Backend/Api/Api/Controllers/UserController.cs b/Backend/Api/Api/Controllers/UserController.cs index 73d32ea..abdf685 100644 --- a/Backend/Api/Api/Controllers/UserController.cs +++ b/Backend/Api/Api/Controllers/UserController.cs @@ -162,6 +162,12 @@ namespace Api.Controllers return Ok(await _userService.ChangeMyProfileName(newName)); } + [HttpPost("changePass")] + [Authorize(Roles = "User")] + public async Task<ActionResult<int>> ChangePass([FromBody] ChangePass cp) + { + return Ok(await _userService.ChangePass(cp.currentPass,cp.newPass)); + } } diff --git a/Backend/Api/Api/Interfaces/IPostService.cs b/Backend/Api/Api/Interfaces/IPostService.cs index c854601..f554df6 100644 --- a/Backend/Api/Api/Interfaces/IPostService.cs +++ b/Backend/Api/Api/Interfaces/IPostService.cs @@ -16,7 +16,7 @@ namespace Api.Interfaces Task<List<CommentSend>> CascadeComments(string parentid, Post p); Task<Boolean> DeleteComments(string postid, string cmntid,string userid); Task CascadeDeleteComments(string cmntid, Post p); - Task<PostSendPage> SearchPosts(string locid, int page = 0, int sorttype = 1, int filterdate = 1); + Task<PostSendPage> SearchPosts(string locid,bool filter, int page = 0, int sorttype = 1, int filterdate = 1, int ratingFrom = -1, int ratingTo = -1, int viewsFrom = -1, int viewsTo = -1); int DateEnumToDays(int filterdate); Task<List<PostSend>> GetUsersPosts(string id); Task<List<PostSend>> UserHistory(string userid); @@ -31,5 +31,7 @@ namespace Api.Interfaces Task<List<Trending>> TrendingTags(); Task<List<PostSend>> BestPostForAllLocationsInRadius(Coords coords, double radius); Task<UserStats> UserStats(string userid); + Task<List<PostSend>> userFavouritePosts(); + Task<List<PostSend>> GetAllPostsFilterSort(FilterSort fs); } }
\ No newline at end of file diff --git a/Backend/Api/Api/Interfaces/IUserService.cs b/Backend/Api/Api/Interfaces/IUserService.cs index f4954e0..855272f 100644 --- a/Backend/Api/Api/Interfaces/IUserService.cs +++ b/Backend/Api/Api/Interfaces/IUserService.cs @@ -40,6 +40,8 @@ namespace Api.Interfaces Task<int> ChangeMyProfileUsername(String newUsername); Task<bool> ChangeMyProfileName(String newUsername); + Task<int> ChangePass(string currentPass, string newPass); + } } diff --git a/Backend/Api/Api/Models/Post.cs b/Backend/Api/Api/Models/Post.cs index 9c0c429..9f7e937 100644 --- a/Backend/Api/Api/Models/Post.cs +++ b/Backend/Api/Api/Models/Post.cs @@ -92,7 +92,9 @@ namespace Api.Models { VIEWS_DESC=1, RATING_DESC=2, - DATE =3 + DATE =3, + DATE_ASC=4, + } public enum FilterDate { @@ -123,4 +125,31 @@ namespace Api.Models public TagR tagr { get; set; } public PostSendPage page { get; set; } } + + public class FilterSort + { + public List<PostSend> posts { get; set; } + public bool sort { get; set; } + public bool filter { get; set; } + public bool filterDate { get; set; } + public bool filterRating { get; set; } + public bool filterViews{ get; set; } + public DateTime filterDateFrom { get; set; } + public DateTime filterDateTo { get; set; } + public int filterRatingFrom { get; set; } + public int filterRatingTo { get; set; } + public int filterViewsFrom { get; set; } + public int filterViewsTo { get; set; } + + public bool sortLatest { get; set; } + public bool sortOldest { get; set; } + public bool sortBest{ get; set; } + public bool sortMostViews{ get; set; } + + + + + + + } } diff --git a/Backend/Api/Api/Models/User.cs b/Backend/Api/Api/Models/User.cs index cf16dbe..f789ffe 100644 --- a/Backend/Api/Api/Models/User.cs +++ b/Backend/Api/Api/Models/User.cs @@ -21,6 +21,7 @@ namespace Api.Models public List<string> following { get; set; } public int followersCount { get; set; } public int followingCount { get; set; } + public List<string>? favourites { get; set; } } public class Login @@ -64,11 +65,12 @@ namespace Api.Models public File? pfp { get; set; } public int postcount { get; set; } - public List<String> followers{ get; set; } + public List<String> followers { get; set; } public List<String> following { get; set; } public int followersCount { get; set; } - public int followingCount { get; set; } + public int followingCount { get; set; } + public List<string>? favourites { get; set; } } @@ -78,8 +80,9 @@ namespace Api.Models public int totalViews { get; set; } public int numberOfPosts { get; set; } public int numberOfRatingsOnPosts { get; set; } - public double averagePostRatingOnPosts {get; set; } + public double averagePostRatingOnPosts { get; set; } public List<MonthlyViews> monthlyViews { get; set; } + public int numberOfFavouritePosts { get; set; } } public class MonthlyViews @@ -87,4 +90,9 @@ namespace Api.Models public int month { get; set; } public int views { get; set; } } + public class ChangePass + { + public string currentPass { get; set; } + public string newPass { get; set; } + } } diff --git a/Backend/Api/Api/Services/MessageService.cs b/Backend/Api/Api/Services/MessageService.cs index 9cc818b..71df70c 100644 --- a/Backend/Api/Api/Services/MessageService.cs +++ b/Backend/Api/Api/Services/MessageService.cs @@ -10,13 +10,15 @@ namespace Api.Services { private readonly IHttpContextAccessor _httpContext; private readonly IMongoCollection<Message> _messages; + private readonly IUserService _userService; private readonly IJwtService _jwtService; private IConfiguration _configuration; private readonly IHubContext<ChatHub> _chatHub; - public MessageService(IDatabaseConnection settings, IMongoClient mongoClient, IJwtService jwtService, IHttpContextAccessor httpContextAccessor, IConfiguration configuration,IHubContext<ChatHub> chatHub) + public MessageService(IDatabaseConnection settings, IMongoClient mongoClient, IUserService userService, IJwtService jwtService, IHttpContextAccessor httpContextAccessor, IConfiguration configuration,IHubContext<ChatHub> chatHub) { var database = mongoClient.GetDatabase(settings.DatabaseName); _messages = database.GetCollection<Message>(settings.MessageCollectionname); + _userService = userService; _jwtService = jwtService; _httpContext = httpContextAccessor; _configuration = configuration; @@ -29,6 +31,9 @@ namespace Api.Services var senderId = _httpContext.HttpContext.User.FindFirstValue("id").ToString(); if (senderId == null) return null; + var receiverCheck =await _userService.GetSelfUserData(msg.receiverId); + if (receiverCheck == null) + return null; var tempMsg = new Message(); tempMsg._id = ""; tempMsg.receiverId = msg.receiverId; diff --git a/Backend/Api/Api/Services/PostService.cs b/Backend/Api/Api/Services/PostService.cs index 6d28206..5a285e5 100644 --- a/Backend/Api/Api/Services/PostService.cs +++ b/Backend/Api/Api/Services/PostService.cs @@ -4,6 +4,7 @@ using Api.Models; using MongoDB.Driver; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson; +using System.Diagnostics; namespace Api.Services { @@ -16,7 +17,7 @@ namespace Api.Services private readonly ILocationService _locationService; private readonly IMongoCollection<User> _users; private readonly IMongoCollection<Location> _locations; - public PostService(IDatabaseConnection settings, IMongoClient mongoClient, IHttpContextAccessor httpContext, IFileService fileService,ILocationService locationService) + public PostService(IDatabaseConnection settings, IMongoClient mongoClient, IHttpContextAccessor httpContext, IFileService fileService, ILocationService locationService) { var database = mongoClient.GetDatabase(settings.DatabaseName); _posts = database.GetCollection<Post>(settings.PostCollectionName); @@ -43,7 +44,7 @@ namespace Api.Services p.createdAt = DateTime.Now.ToUniversalTime(); List<String> tags; if (post.tags != "none") - tags = post.tags.Remove(post.tags.Length-1,1).Split("|").ToList(); + tags = post.tags.Remove(post.tags.Length - 1, 1).Split("|").ToList(); else tags = null; p.tags = tags; var folderPath = Path.Combine(Directory.GetCurrentDirectory(), "Files", p.ownerId); @@ -52,28 +53,28 @@ namespace Api.Services Directory.CreateDirectory(folderPath); } - foreach (var image in post.images) + foreach (var image in post.images) { var filename = image.FileName; - var ext=Path.GetExtension(filename).ToLowerInvariant(); + var ext = Path.GetExtension(filename).ToLowerInvariant(); var name = Path.GetFileNameWithoutExtension(filename).ToLowerInvariant(); - var fullPath=Path.Combine(folderPath, name); + var fullPath = Path.Combine(folderPath, name); int i = 0; while (System.IO.File.Exists(fullPath)) { i++; - fullPath=Path.Combine(folderPath, name+i.ToString()+ext); + fullPath = Path.Combine(folderPath, name + i.ToString() + ext); } - using(var stream=new FileStream(fullPath, FileMode.Create)) + using (var stream = new FileStream(fullPath, FileMode.Create)) { await image.CopyToAsync(stream); } var f = new Models.File(); f.path = fullPath; f._id = ""; - f=await _fileService.add(f); + f = await _fileService.add(f); p.images.Add(f); - + } await _posts.InsertOneAsync(p); return await postToPostSend(p); @@ -107,15 +108,17 @@ namespace Api.Services return p; } - public async Task<Boolean> deletePost(string postid,string userid) + public async Task<Boolean> deletePost(string postid, string userid) { var p = await _posts.Find(x => x._id == postid).FirstOrDefaultAsync(); - if (p == null || p.ownerId != userid) + var u = await _users.Find(x => x._id == userid).FirstOrDefaultAsync(); + if (p == null || p.ownerId != userid ||u==null) return false; foreach (var image in p.images) System.IO.File.Delete(image.path); - - await _posts.DeleteOneAsync(postid); + if (u.favourites != null) + u.favourites.Remove(postid); + await _posts.FindOneAndDeleteAsync(x => x._id == postid); return true; } @@ -130,12 +133,12 @@ namespace Api.Services return temp; } - public async Task<PostSend> getPostById(string id,string userid) + public async Task<PostSend> getPostById(string id, string userid) { Post p = await _posts.Find(post => post._id == id).FirstOrDefaultAsync(); if (p != null) { - if (!p.views.Any(x => x.Split("|")[0] == userid)) + if (!p.views.Any(x => x.Split("|")[0] == userid)) { p.views.Add(userid + "|" + DateTime.Now.ToUniversalTime().ToString()); await _posts.ReplaceOneAsync(x => x._id == id, p); @@ -150,8 +153,8 @@ namespace Api.Services } return await postToPostSend(p); } - - public async Task<RatingSend> AddOrReplaceRating(RatingReceive rating,string userid) //0 return existing flag , -1 rating failed flag + + public async Task<RatingSend> AddOrReplaceRating(RatingReceive rating, string userid) //0 return existing flag , -1 rating failed flag { Post p = await _posts.Find(post => post._id == rating.postId).FirstOrDefaultAsync(); if (p != null) @@ -162,13 +165,17 @@ namespace Api.Services tosend.ratingscount = ps.ratingscount; if (p.ownerId == userid) - return null; - if(rating.rating == 0)// ako nema rating staviti 0 + { + tosend.myrating = -1; + return tosend; + } + + if (rating.rating == 0)// ako nema rating staviti 0 { var r = p.ratings.Find(x => x.userId == userid); - if(r != null) + if (r != null) { - tosend.myrating=r.rating; + tosend.myrating = r.rating; return tosend; } else @@ -177,16 +184,16 @@ namespace Api.Services return tosend; } } - if(rating.rating<1 || rating.rating>5) + if (rating.rating < 1 || rating.rating > 5) return null; - if(!p.ratings.Any(x => x.userId == userid)) + if (!p.ratings.Any(x => x.userId == userid)) { Rating r = new Rating(); r.rating = rating.rating; r.userId = userid; p.ratings.Add(r); await _posts.ReplaceOneAsync(x => x._id == p._id, p); - tosend.myrating=rating.rating; + tosend.myrating = rating.rating; } else { @@ -220,13 +227,13 @@ namespace Api.Services } return false; } - public async Task<CommentSend> AddComment(CommentReceive cmnt,string userid,string postid) + public async Task<CommentSend> AddComment(CommentReceive cmnt, string userid, string postid) { Post p = await _posts.Find(post => post._id == postid).FirstOrDefaultAsync(); if (p != null) { Comment c = new Comment(); - CommentSend c1= new CommentSend(); + CommentSend c1 = new CommentSend(); c.parentId = cmnt.parentId; c1.parentId = cmnt.parentId; c.userId = userid; @@ -255,10 +262,10 @@ namespace Api.Services { List<Comment> lista = new List<Comment>(); lista = p.comments.FindAll(x => x.parentId == null || x.parentId == ""); - if (lista.Count() > 0) + if (lista.Count() > 0) { List<CommentSend> tosend = new List<CommentSend>(); - foreach(var comment in lista) + foreach (var comment in lista) { CommentSend c = new CommentSend(); c.userId = comment.userId; @@ -281,11 +288,11 @@ namespace Api.Services } return null; } - public async Task<List<CommentSend>> CascadeComments(string parentid,Post p) + public async Task<List<CommentSend>> CascadeComments(string parentid, Post p) { List<Comment> lista = new List<Comment>(); lista = p.comments.FindAll(x => x.parentId == parentid); - if (lista.Count()>0) + if (lista.Count() > 0) { List<CommentSend> replies = new List<CommentSend>(); foreach (var comment in lista) @@ -297,7 +304,7 @@ namespace Api.Services c.comment = comment.comment; c.timestamp = comment.timestamp; - var user= await _users.Find(x => x._id == comment.userId).FirstOrDefaultAsync(); + var user = await _users.Find(x => x._id == comment.userId).FirstOrDefaultAsync(); if (user != null) c.username = user.username; else c.username = "Deleted user"; @@ -310,7 +317,7 @@ namespace Api.Services } return null; } - public async Task<Boolean> DeleteComments(string postid,string cmntid,string userid) + public async Task<Boolean> DeleteComments(string postid, string cmntid, string userid) { Post p = await _posts.Find(post => post._id == postid).FirstOrDefaultAsync(); if (p != null) @@ -325,23 +332,23 @@ namespace Api.Services return true; } } - return false; + return false; } - public async Task CascadeDeleteComments(string cmntid,Post p) + public async Task CascadeDeleteComments(string cmntid, Post p) { List<Comment> lista = new List<Comment>(); lista = p.comments.FindAll(x => x.parentId == cmntid); if (lista.Count() > 0) { - foreach (var comment in lista) + foreach (var comment in lista) { p.comments.Remove(comment); await _posts.ReplaceOneAsync(x => x._id == p._id, p); await CascadeDeleteComments(comment._id, p); - } + } } } - public async Task<PostSendPage> SearchPosts(string locid,int page = 0,int sorttype = 1 ,int filterdate = 1) // for now sorting by number of ratings , not avg rating + public async Task<PostSendPage> SearchPosts(string locid,bool filter, int page = 0, int sorttype = 1, int filterdate = 1, int ratingFrom = -1, int ratingTo = -1, int viewsFrom = -1, int viewsTo = -1) { var days = DateEnumToDays(filterdate); var tosend = new PostSendPage(); @@ -349,25 +356,29 @@ namespace Api.Services var lista = new List<Post>(); var ls = new List<PostSend>(); var xd = new List<PostSend>(); - if(ObjectId.TryParse(locid, out _)) + if (ObjectId.TryParse(locid, out _)) lista = await _posts.Find(x => x.locationId == locid).ToListAsync(); else { - lista = await _posts.Find(x => x.tags != null && x.tags.Any(y => y.ToLower().Contains(locid.ToLower()))).ToListAsync(); - if (lista.Count==0) + lista = await _posts.Find(x => x.tags != null && x.tags.Any(y => y.ToLower().Contains(locid.ToLower()))).ToListAsync(); + if (lista.Count == 0) { var locs = await _locations.Find(x => x.city.ToLower().Contains(locid.ToLower()) || x.name.ToLower().Contains(locid.ToLower())).ToListAsync(); - foreach(var loc in locs) + foreach (var loc in locs) { - var posts =await _posts.Find(x => x.locationId == loc._id).ToListAsync(); - if(posts != null) + var posts = await _posts.Find(x => x.locationId == loc._id).ToListAsync(); + if (posts != null) { - foreach(var p in posts) + foreach (var p in posts) { lista.Add(p); } } } + if(lista.Count==0 && locid=="-1") + { + lista = await _posts.Find(_ => true).ToListAsync(); + } } } if (lista != null) @@ -377,7 +388,27 @@ namespace Api.Services if ((DateTime.Now - elem.createdAt).TotalDays < days) ls.Add(await postToPostSend(elem)); } - + + } + if (filter) + { + if (ratingFrom >= 0) + { + ls = ls.FindAll(post => Math.Floor(post.ratings) >= ratingFrom).ToList(); + } + if (ratingTo >= 0) + { + ls= ls.FindAll(post => Math.Ceiling(post.ratings) <= ratingTo).ToList(); + } + if (viewsFrom >= 0) + { + ls = ls.FindAll(post => post.views >=viewsFrom).ToList(); + } + if (viewsTo >= 0) + { + ls = ls.FindAll(post => post.views <= viewsTo).ToList(); + } + } switch (sorttype) { @@ -390,11 +421,14 @@ namespace Api.Services case 3: xd = ls.OrderByDescending(x => x.createdAt).ToList(); break; + case 4: + xd = ls.OrderBy(x => x.createdAt).ToList(); + break; default: xd = ls.OrderByDescending(x => x.views).ToList(); break; } - if(xd != null) + if (xd != null) { tosend.page = page; tosend.index = page * 20; @@ -402,7 +436,7 @@ namespace Api.Services double pgs = xd.Count / 20; tosend.totalpages = (int)Math.Ceiling(pgs); var selected = ls.Skip(20 * page).Take(20); - foreach(var post in selected) + foreach (var post in selected) { pslista.Add(post); } @@ -412,7 +446,7 @@ namespace Api.Services } public int DateEnumToDays(int filterdate) { - switch(filterdate) + switch (filterdate) { case 1: return 365 * 10; case 2: return 365; @@ -521,7 +555,7 @@ namespace Api.Services } } var top5tags = tags.OrderByDescending(x => x.counter).Take(5).ToList(); - + var all = await _posts.Find(_ => true).ToListAsync(); var recent30 = new List<PostSend>(); var fiveoftop5tags = new List<PostSend>(); @@ -531,7 +565,7 @@ namespace Api.Services recent30.Add(await postToPostSend(elem)); } recent30 = recent30.OrderByDescending(x => x.createdAt).ToList(); - foreach (var tag in top5tags) + foreach (var tag in top5tags) { var five = new List<PostSend>(); foreach (var elem in recent30) @@ -543,7 +577,7 @@ namespace Api.Services } } five = five.Take(5).ToList(); - foreach(var elem in five) + foreach (var elem in five) { fiveoftop5tags.Add(elem); } @@ -557,22 +591,28 @@ namespace Api.Services { string userId = _httpContext.HttpContext.User.FindFirstValue("id"); var result = false; + var user = await _users.Find(x => x._id == userId).FirstOrDefaultAsync(); Post post = await _posts.Find(x => x._id == postId).FirstOrDefaultAsync(); - if (userId == null || post==null) + if (userId == null || post == null) return result; if (post.favourites == null) post.favourites = new List<string>(); + if (user.favourites == null) + user.favourites = new List<string>(); if (post.favourites.Contains(userId)) { post.favourites.Remove(userId); + user.favourites.Remove(post._id); result = false; } else { post.favourites.Add(userId); + user.favourites.Add(post._id); result = true; } + await _users.ReplaceOneAsync(x => x._id == user._id, user); await _posts.ReplaceOneAsync(x => x._id == postId, post); return result; @@ -616,11 +656,11 @@ namespace Api.Services var top10tags = tags.OrderByDescending(x => x.views).Take(10).ToList(); var tosend = new List<Trending>(); - foreach(var trending in top10tags) + foreach (var trending in top10tags) { var novi = new Trending(); novi.tagr = trending; - novi.page = await SearchPosts(trending.tag, 0, 1, 5); + novi.page = await SearchPosts(trending.tag, false,0, 1, 5,-1,-1,-1,-1); tosend.Add(novi); } @@ -643,9 +683,9 @@ namespace Api.Services } foreach (var elem in inradius) { - var locposts = await SearchPosts(elem._id, 0, 1, 1); + var locposts = await SearchPosts(elem._id, false,0, 1, 1,-1,-1,-1,-1); var best = locposts.posts.Take(1).FirstOrDefault(); - if(best != null) + if (best != null) tosend.Add(best); } } @@ -662,18 +702,19 @@ namespace Api.Services stats.numberOfPosts = 0; stats.totalViews = 0; stats.monthlyViews = new List<MonthlyViews>(); + stats.numberOfFavouritePosts = 0; + - - if(posts != null) + if (posts != null) { - for(int i = 1; i <= 12; i++) + for (int i = 1; i <= 12; i++) { var novi = new MonthlyViews(); novi.month = i; novi.views = 0; stats.monthlyViews.Add(novi); } - + foreach (var post in posts) { var month = post.createdAt.Month; @@ -681,13 +722,106 @@ namespace Api.Services stats.totalViews += post.views; stats.numberOfRatingsOnPosts += post.ratingscount; stats.numberOfPosts++; + if (post.favourites != null) + stats.numberOfFavouritePosts += post.favourites.Count; ratingsum += post.ratings * post.ratingscount; } - if(stats.numberOfRatingsOnPosts > 0) //don't forget to check div by 0 jesus + if (stats.numberOfRatingsOnPosts > 0) //don't forget to check div by 0 jesus stats.averagePostRatingOnPosts = ratingsum / stats.numberOfRatingsOnPosts; } return stats; } + + public async Task<List<PostSend>> userFavouritePosts() + { + List<PostSend> posts = new List<PostSend>(); + string userId = _httpContext.HttpContext.User.FindFirstValue("id"); + var user = await _users.Find(x => x._id == userId).FirstOrDefaultAsync(); + if (user == null) + return null; + //Post post = await _posts.Find(x => x._id == postId).FirstOrDefaultAsync(); + if (user.favourites != null) + foreach (var postId in user.favourites) + { + Post post = await _posts.Find(x => x._id == postId).FirstOrDefaultAsync(); + posts.Add(await postToPostSend(post)); + + } + return posts; + } + + public async Task<List<PostSend>> GetAllPostsFilterSort(FilterSort fs) + { + List<PostSend> allPosts = fs.posts; + List<PostSend> filteredPosts = allPosts; + List<PostSend> fsPosts=allPosts; + + if (fs.filter) + { + if (fs.filterRatingFrom>=0) + { + filteredPosts =filteredPosts.FindAll(post => post.ratings >fs.filterRatingFrom); + } + if (fs.filterRatingTo >= 0) + { + filteredPosts = filteredPosts.FindAll(post => post.ratings < fs.filterRatingTo); + } + if(fs.filterViewsFrom >= 0) + { + filteredPosts = filteredPosts.FindAll(post => post.views > fs.filterViewsFrom); + } + if(fs.filterViewsTo >= 0) + { + filteredPosts = filteredPosts.FindAll(post => post.views < fs.filterViewsTo); + } + if(fs.filterDateFrom!=null) + { + filteredPosts = filteredPosts.FindAll(post => post.createdAt > fs.filterDateFrom); + } + if(fs.filterDateTo!=null) + { + filteredPosts = filteredPosts.FindAll(post => post.createdAt < fs.filterDateTo); + } + } + + if (fs.sort) + { + if (fs.sortBest) + { + fsPosts = filteredPosts.OrderByDescending(o => o.ratings).ToList(); + } + if (fs.sortLatest) + { + fsPosts = filteredPosts.OrderByDescending(o => o.createdAt).ToList(); + } + if (fs.sortMostViews) + { + fsPosts = filteredPosts.OrderByDescending(o => o.views).ToList(); + } + if (fs.sortOldest) + { + fsPosts = filteredPosts.OrderBy(p => p.createdAt).ToList(); + } + } + + if(!fs.filter && !fs.sort) + { + return allPosts; + } + else if(!fs.filter && fs.sort) + { + return fsPosts; + } + else if(fs.filter && !fs.sort) + { + return filteredPosts; + } + else + { + return filteredPosts; + } + + + } } - } diff --git a/Backend/Api/Api/Services/UserService.cs b/Backend/Api/Api/Services/UserService.cs index 781afa8..d8ec4a2 100644 --- a/Backend/Api/Api/Services/UserService.cs +++ b/Backend/Api/Api/Services/UserService.cs @@ -17,9 +17,7 @@ namespace Api.Services private readonly IMongoCollection<Post> _posts; private readonly IJwtService _jwtService; private IConfiguration _configuration; - private readonly IFileService _fileService; - - private readonly IMongoCollection<UserSend> _usersSend; + private readonly IFileService _fileService; public UserService(IDatabaseConnection settings, IMongoClient mongoClient, IJwtService jwtService, IHttpContextAccessor httpContextAccessor, IConfiguration configuration, IFileService fileService) { var database = mongoClient.GetDatabase(settings.DatabaseName); @@ -364,6 +362,7 @@ namespace Api.Services tosend.followingCount = user.followingCount; tosend.followers = user.followers; tosend.following = user.following; + tosend.favourites = user.favourites; var userposts = await _posts.Find(x => x.ownerId == user._id).ToListAsync(); tosend.postcount = userposts.Count(); return tosend; @@ -384,6 +383,7 @@ namespace Api.Services tosend.followingCount = user.followingCount; tosend.followers = user.followers; tosend.following = user.following; + tosend.favourites = user.favourites; var userposts = await _posts.Find(x => x.ownerId == user._id).ToListAsync(); tosend.postcount = userposts.Count(); return tosend; @@ -416,7 +416,9 @@ namespace Api.Services } User f = await _users.Find(user => user._id == followerId).FirstOrDefaultAsync(); User u = await _users.Find(user => user._id == id).FirstOrDefaultAsync(); - + if(await CheckIfAlreadyFollow(followerId)) + return false; + if (id != null && followerId!=null) { if (f.followers == null) @@ -476,6 +478,7 @@ namespace Api.Services follower.followers = utemp.followers; follower.followersCount = utemp.followersCount; follower.followingCount = utemp.followingCount; + follower.favourites = utemp.favourites; follower._id = utemp._id; @@ -515,6 +518,7 @@ namespace Api.Services follower._id = utemp._id; follower.followersCount = utemp.followersCount; follower.followingCount = utemp.followingCount; + follower.favourites = utemp.favourites; following.Add((UserSend)follower); } @@ -558,6 +562,7 @@ namespace Api.Services following._id = utemp._id; following.followersCount = utemp.followersCount; following.followingCount = utemp.followingCount; + following.favourites=utemp.favourites; myFollowings.Add((UserSend)following); } @@ -614,27 +619,33 @@ namespace Api.Services User u = await _users.Find(user => user._id == myId).FirstOrDefaultAsync(); User f = await _users.Find(user => user._id == id).FirstOrDefaultAsync(); - + if(await CheckIfAlreadyFollow(id)) if (u != null) { - if (u.following != null && f.followers!=null) - { u.following.Remove(f._id); + if (u.following == null) + u.following = new List<string>(); u.followingCount=u.following.Count(); + if (u.followers == null) + u.followers = new List<string>(); u.followersCount = u.followers.Count(); f.followers.Remove(u._id); + if (f.followers == null) + f.followers = new List<string>(); f.followersCount =f.followers.Count(); + if (f.following == null) + f.following = new List<string>(); f.followingCount =f.following.Count(); - _users.ReplaceOne(user => user._id == myId, u); - _users.ReplaceOne(user => user._id == id, f); + await _users.ReplaceOneAsync(user => user._id == myId, u); + await _users.ReplaceOneAsync(user => user._id == id, f); //updateUserFollowerFollowingCount(u.followers, u.following, u._id); //updateUserFollowerFollowingCount(f.followers, f.following, f._id); return true; - } + } return false; @@ -672,6 +683,7 @@ namespace Api.Services follower.followersCount = utemp.followersCount; follower.followingCount = utemp.followingCount; follower._id = utemp._id; + follower.favourites = utemp.favourites; myfollowers.Add((UserSend)follower); } return myfollowers; @@ -729,6 +741,30 @@ namespace Api.Services return false; } + public async Task<int> ChangePass(string currentPass,string newPass) + { + + string myId = null; + if (_httpContext.HttpContext.User.FindFirstValue("id") != null) + { + myId = _httpContext.HttpContext.User.FindFirstValue("id").ToString(); + } + + User u = await _users.Find(user => user._id == myId).FirstOrDefaultAsync(); + + if (u != null) + { + if (checkPassword(currentPass, u.password)) + { + u.password = hashPassword(newPass); + await _users.ReplaceOneAsync(x => x._id == u._id, u); + return 1; + } + return -1; + } + return -2; + } + } diff --git a/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml index 0d90ad1..59f1e26 100644 --- a/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml +++ b/Client/BrzoDoLokacije/.idea/deploymentTargetDropDown.xml @@ -7,15 +7,11 @@ <deviceKey> <Key> <type value="VIRTUAL_DEVICE_PATH" /> - <value value="C:\Users\PC\.android\avd\Pixel_6_API_33.avd" /> + <value value="C:\Users\PC\.android\avd\Pixel_4a_API_33.avd" /> </Key> </deviceKey> </Target> </targetSelectedWithDropDown> -<<<<<<< HEAD - <timeTargetWasSelectedWithDropDown value="2022-12-05T15:17:54.592850800Z" /> -======= - <timeTargetWasSelectedWithDropDown value="2022-12-06T03:10:09.596363200Z" /> ->>>>>>> 8e563f959c168a9778658c5fa2a2b143730d44fa + <timeTargetWasSelectedWithDropDown value="2022-12-07T19:39:34.164319600Z" /> </component> </project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/build.gradle b/Client/BrzoDoLokacije/app/build.gradle index cae3d80..2db362d 100644 --- a/Client/BrzoDoLokacije/app/build.gradle +++ b/Client/BrzoDoLokacije/app/build.gradle @@ -24,6 +24,7 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + signingConfig signingConfigs.debug } } compileOptions { @@ -73,4 +74,10 @@ dependencies { //OSMDROID implementation 'org.osmdroid:osmdroid-android:6.1.14' implementation 'com.github.MKergall:osmbonuspack:6.9.0' + + //KeyboardVisibilityEvents + implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC3' + + //zoom + implementation 'com.github.piasy:GlideImageLoader:1.8.1' }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/add_post_red_image.xml b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/add_post_red_image.xml new file mode 100644 index 0000000..a7524a9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/add_post_red_image.xml @@ -0,0 +1,16 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="#FC3636" + android:alpha="0.8"> + <group android:scaleX="1.2" + android:scaleY="1.2" + android:translateX="-2.4" + android:translateY="-2.4"> + <path + android:fillColor="@android:color/white" + android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/> + </group> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/add_post_red_image.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/add_post_red_image.png Binary files differnew file mode 100644 index 0000000..b4fd600 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/add_post_red_image.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/add_post_red_image.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/add_post_red_image.png Binary files differnew file mode 100644 index 0000000..5cc1ebf --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/add_post_red_image.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/add_post_red_image.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/add_post_red_image.png Binary files differnew file mode 100644 index 0000000..8c33142 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/add_post_red_image.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/add_post_red_image.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/add_post_red_image.png Binary files differnew file mode 100644 index 0000000..0745c58 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/add_post_red_image.png diff --git a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml index 49e17d8..8c796e2 100644 --- a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml +++ b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml @@ -10,7 +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.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.CAMERA" android:required="true" @@ -38,6 +38,21 @@ android:usesCleartextTraffic="true" tools:targetApi="31"> <activity + android:name=".Activities.ActivityOpenedImages" + android:screenOrientation="portrait" + android:exported="false"> + <meta-data + android:name="android.app.lib_name" + android:value="" /> + </activity> + <activity + android:name=".Activities.ActivityChangePassword" + android:exported="false"> + <meta-data + android:name="android.app.lib_name" + android:value="" /> + </activity> + <activity android:name=".Activities.ActivityChangeUserData" android:exported="false" android:screenOrientation="portrait"> @@ -85,17 +100,19 @@ <activity android:name=".Activities.MapsActivity" - android:screenOrientation="portrait" /> + android:screenOrientation="portrait" + android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> <activity android:name=".Activities.ActivityCapturePost" android:screenOrientation="portrait" /> <activity android:name=".Activities.ActivitySinglePost" - android:windowSoftInputMode="stateAlwaysHidden|adjustPan" - android:screenOrientation="portrait" /> + android:screenOrientation="portrait" + android:windowSoftInputMode="stateAlwaysHidden|adjustPan" /> <activity android:name=".Activities.ActivityAddPost" - android:screenOrientation="portrait" /> + android:screenOrientation="portrait" + android:windowSoftInputMode="stateAlwaysHidden|adjustPan"/> <activity android:name=".Activities.SplashPage" android:exported="true" @@ -121,7 +138,8 @@ android:screenOrientation="portrait" /> <activity android:name=".Activities.NavigationActivity" - android:screenOrientation="portrait" /> + android:screenOrientation="portrait" + android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> <activity android:name=".MainActivity" android:screenOrientation="portrait" /> diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt index 746d8b0..aaa2733 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityAddPost.kt @@ -2,6 +2,7 @@ package com.example.brzodolokacije.Activities import android.Manifest import android.app.ProgressDialog +import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.graphics.Color @@ -11,19 +12,16 @@ import android.util.Log import android.util.TypedValue import android.view.KeyEvent import android.view.View +import android.view.inputmethod.InputMethodManager import android.widget.* import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.AppCompatImageView import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.core.view.setMargins -import com.example.brzodolokacije.Models.Location -import com.example.brzodolokacije.Models.LocationType import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.R -import com.example.brzodolokacije.Services.GeocoderHelper import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import okhttp3.MediaType.Companion.toMediaTypeOrNull @@ -39,7 +37,7 @@ class ActivityAddPost : AppCompatActivity() { private lateinit var takePhoto: Button private lateinit var showNextImage:Button private lateinit var showPreviousImage:Button - private lateinit var switcher: ImageSwitcher + private lateinit var switcher: ImageView private var uploadedImages:ArrayList<Uri?>?=null private lateinit var location:EditText @@ -75,7 +73,7 @@ class ActivityAddPost : AppCompatActivity() { uploadFromGallery=findViewById<View>(R.id.btnActivityAddPostUploadFromGalleryVisible) as Button showNextImage=findViewById<View>(R.id.nextImage) as Button showPreviousImage=findViewById<View>(R.id.previousImage) as Button - switcher=findViewById<View>(R.id.isActivityAddPostSwitcher) as ImageSwitcher + switcher=findViewById<View>(R.id.isActivityAddPostSwitcher) as ImageView description=findViewById<View>(R.id.etActivityAddPostDescription) as EditText post=findViewById<View>(R.id.btnActivityAddPostPost) as Button addLocation=findViewById<View>(R.id.btnActivityAddPostAddLocation) as Button @@ -97,11 +95,6 @@ class ActivityAddPost : AppCompatActivity() { progressDialog!!.setCanceledOnTouchOutside(false) - switcher?.setFactory{ - val imgView = ImageView(applicationContext) - imgView.scaleType = ImageView.ScaleType.CENTER_CROP - imgView.setPadding(8, 8, 8, 8) - imgView} addLocation.setOnClickListener { val myIntent = Intent(this, MapsActivity::class.java) startActivityForResult(myIntent,LOCATIONREQCODE) @@ -109,17 +102,23 @@ class ActivityAddPost : AppCompatActivity() { addDescription.setOnClickListener { description.isGone=false description.isVisible=true + description.requestFocus() + showKeyboard(description) } //dodavanje i brisanje tagova tagButtonAdd.setOnClickListener { addTag() + tagText.requestFocus() + showKeyboard(tagText) } tagText.setOnKeyListener(View.OnKeyListener { v1, keyCode, event -> // If the event is a key-down event on the "enter" button - if (event.action === KeyEvent.ACTION_DOWN && + if (event.action === KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_ENTER ) { // Perform action on key press addTag() + tagText.requestFocus() + showKeyboard(tagText) return@OnKeyListener true } false @@ -180,7 +179,11 @@ class ActivityAddPost : AppCompatActivity() { description.setHintTextColor(Color.RED) } if(locationId==null || locationId!!.trim()==""){ - Toast.makeText(this,"Unesite lokaciju klikom na dugme",Toast.LENGTH_LONG) + Toast.makeText(this@ActivityAddPost,"Unesite lokaciju klikom na dugme",Toast.LENGTH_LONG).show() + } + if(uploadedImages==null ||uploadedImages!!.size<=0) + { + Toast.makeText(this@ActivityAddPost,"Unesite fotografije",Toast.LENGTH_LONG).show() } if(!descriptionString.isEmpty() && uploadedImages!!.size>0){ @@ -188,6 +191,17 @@ class ActivityAddPost : AppCompatActivity() { } } } + + fun showKeyboard(item:EditText){ + var imm: InputMethodManager =this.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.showSoftInput(item, InputMethodManager.SHOW_IMPLICIT) + } + + fun hideKeyboard(item: EditText){ + var imm: InputMethodManager =this.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(item.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) + } + fun addTag(){ tagText.isGone=false tagText.isVisible=true diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt index 79062c9..ccccc0e 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityCapturePost.kt @@ -18,6 +18,7 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import androidx.core.net.toUri import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.core.view.setMargins @@ -28,6 +29,7 @@ import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.GeocoderHelper import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.android.material.button.MaterialButton import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody @@ -37,6 +39,8 @@ import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.File import java.io.InputStream +import java.util.* +import kotlin.collections.ArrayList class ActivityCapturePost : AppCompatActivity() { @@ -51,12 +55,14 @@ class ActivityCapturePost : AppCompatActivity() { private lateinit var tagButtons:MutableList<Button> private lateinit var tagText: EditText private lateinit var tagButtonAdd:Button + private lateinit var addImage:MaterialButton private lateinit var tagList: MutableList<String> private var tagidcounter:Int = 0 private lateinit var addDescription:Button private lateinit var locText: EditText - - + private lateinit var showNextImage:Button + private lateinit var showPreviousImage:Button + private var place=0; val LOCATIONREQCODE=123 var locationId:String?=null @@ -77,7 +83,9 @@ class ActivityCapturePost : AppCompatActivity() { tagText =findViewById<View>(R.id.acTagsCap) as EditText tagButtonAdd = findViewById<View>(R.id.btnActivityAddPostAddTagCap) as Button tagLayout = findViewById<View>(R.id.llTagsCap) as LinearLayout - + addImage=findViewById<View>(R.id.btnActivityCapturePostCaptureVisible1) as MaterialButton + showNextImage=findViewById<View>(R.id.nextImage) as Button + showPreviousImage=findViewById<View>(R.id.previousImage) as Button addDescription=findViewById<View>(R.id.tvActivityCapturePostDescriptiontext)as Button locText=findViewById<View>(R.id.etActivityAddPostLocationText) as EditText @@ -110,6 +118,21 @@ class ActivityCapturePost : AppCompatActivity() { } false }) + showPreviousImage.setOnClickListener{ + if(fileList!=null && fileList!!.size>0) + if(place>0){ + place=place-1 + showImage.setImageURI(fileList!![place].toUri()) + } + } + showNextImage.setOnClickListener{ + if(fileList!=null && fileList!!.size>0) + if(place<fileList!!.size-1){ + place=place+1 + showImage.setImageURI(fileList!![place].toUri()) + } + + } //dodavanje sa kamere @@ -168,34 +191,32 @@ class ActivityCapturePost : AppCompatActivity() { val APP_TAG = "BrzoDoLokacije" val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) - /* val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date()) - //val storageDir: File? = getExternalFilesDir(Environment.DIRECTORY_PICTURES) - //val photo= File(storageDir,"JPEG_${timeStamp}.jpg") - - val mediaStorageDir = File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), APP_TAG) - if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()) { - Log.d(APP_TAG, "failed to create directory") - } - var photoFile = File(mediaStorageDir.path + File.separator + "${APP_TAG}_${timeStamp}.jpg") - - if (photoFile != null) { - val fileProvider: Uri = - FileProvider.getUriForFile(this, "com.codepath.fileprovider", photoFile!!) - intent.putExtra(MediaStore.EXTRA_OUTPUT, fileProvider) - } - -*/ + cameraActivityResultLauncher.launch(takePictureIntent) + } + addImage.setOnClickListener { + val APP_TAG = "BrzoDoLokacije" + val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) cameraActivityResultLauncher.launch(takePictureIntent) } post.setOnClickListener { + Log.d("tsdadasdsa","dsadasdas") // locationString = location.text.toString().trim() descriptionString = description.text.toString().trim() //prazan unos? if (descriptionString.isEmpty()) { description.hint = "Unesite opis" description.setHintTextColor(Color.RED) - }else if(f!=null && locationId!=null && locationId!!.trim()!=""){ + } + if(f==null) + { + Toast.makeText(this@ActivityCapturePost,"Unesite fotografije",Toast.LENGTH_LONG).show() + } + if(locationId==null || locationId!!.trim()=="") + { + Toast.makeText(this@ActivityCapturePost,"Unesite lokaciju klikom na dugme",Toast.LENGTH_LONG).show() + } + if(f!=null && locationId!=null && locationId!!.trim()!="" &&!descriptionString.isEmpty()){ uploadLocation() } @@ -251,6 +272,7 @@ class ActivityCapturePost : AppCompatActivity() { locText.setText(name,TextView.BufferType.EDITABLE) } } + var fileList:ArrayList<File>?=null var f:File?=null private val cameraActivityResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> @@ -261,13 +283,21 @@ class ActivityCapturePost : AppCompatActivity() { bitmap!!.compress(Bitmap.CompressFormat.PNG,100,outputStream) val bitmapdata = outputStream.toByteArray() val inputstream: InputStream = ByteArrayInputStream(bitmapdata) - f=File.createTempFile("temp","12345") - f!!.writeBytes(inputstream!!.readBytes()) - + if(fileList==null) + fileList=ArrayList<File>() + var r= Random().nextInt(100000) + f=File.createTempFile("temp","12345"+r.toString()) + f!!.writeBytes(inputstream!!.readBytes()) + fileList!!.add(f!!) showImage.setImageBitmap(bitmap) + takePhoto.isVisible=false + if(!addImage.isVisible) + addImage.isVisible=true + place=fileList!!.size-1 + } @@ -296,11 +326,15 @@ class ActivityCapturePost : AppCompatActivity() { var tagReq=RequestBody.create("text/plain".toMediaTypeOrNull(),tagliststring) val imagesParts = arrayOfNulls<MultipartBody.Part>( - 1 + fileList!!.size ) - var imageBody= RequestBody.create("image/*".toMediaTypeOrNull(),f!!) - imagesParts[0]= MultipartBody.Part.createFormData("images",f!!.name,imageBody) + + for (i in 0 until fileList!!.size) { + var imageBody= RequestBody.create("image/*".toMediaTypeOrNull(),fileList!![i]) + imagesParts[i]= MultipartBody.Part.createFormData("images",fileList!![i].name,imageBody) + + } var jwtString= SharedPreferencesHelper.getValue("jwt",this) var data=api.addPost("Bearer "+jwtString,imagesParts,idReq,descReq,locReq,tagReq) diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangePassword.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangePassword.kt new file mode 100644 index 0000000..dc732ee --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityChangePassword.kt @@ -0,0 +1,131 @@ +package com.example.brzodolokacije.Activities + +import android.graphics.Color +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle + +import com.example.brzodolokacije.R +import android.widget.Button +import android.widget.EditText +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.core.view.isVisible +import com.exam.DBHelper.Companion.activity +import com.example.brzodolokacije.Models.Auth.ChangePass +import com.example.brzodolokacije.Models.UserReceive +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import kotlinx.android.synthetic.main.fragment_my_profile_info.* +import retrofit2.Call +import retrofit2.Response + + +class ActivityChangePassword : AppCompatActivity() { + + private lateinit var oldPass:EditText + private lateinit var oldPassError:TextView + private lateinit var newPass:EditText + private lateinit var newPassError:TextView + private lateinit var confirmPass:EditText + private lateinit var confirmPassError:TextView + private lateinit var forgotten:TextView + private lateinit var submit:Button + private lateinit var backButton:ImageView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_change_password) + + oldPass=findViewById(R.id.tvActivityChangePasswordCurrentPass) + oldPassError=findViewById(R.id.ActivityChangePasswordOldError) + newPass=findViewById(R.id.tvActivityChangePasswordNewPass) + newPassError=findViewById(R.id.btnActivityChangePasswordNewError) + confirmPass=findViewById(R.id.ActivityChangePasswordNewPasswordConfirm) + confirmPassError=findViewById(R.id.btnActivityChangePasswordConfirmError) + forgotten=findViewById(R.id.btnActivityChangePasswordForgottenPass) + submit=findViewById(R.id.ActivityChangePasswordChangePassword) + backButton=findViewById(R.id.btnBackToUser) + + oldPassError.isVisible=false + newPassError.isVisible=false + confirmPassError.isVisible=false + backButton.setOnClickListener{ + finish() + } + + submit.setOnClickListener{ + oldPassError.isVisible=false + newPassError.isVisible=false + confirmPassError.isVisible=false + if(oldPass.text.toString().trim().isEmpty()) + { + oldPassError.isVisible=true + oldPassError.text="Unesite trenutnu lozinku." + oldPassError.setTextColor(Color.RED) + } + if(newPass.text.toString().trim().isEmpty()) + { + newPassError.isVisible=true + newPassError.text="Unesite novu lozinku." + newPassError.setTextColor(Color.RED) + } + if(confirmPass.text.toString().trim().isEmpty()) + { + confirmPassError.isVisible=true + confirmPassError.text="Potvrdite novu lozinku." + confirmPassError.setTextColor(Color.RED) + } + + if(oldPass.text.toString().trim().isNotEmpty()&&newPass.text.toString().trim().isNotEmpty() + &&confirmPass.text.toString().trim().isNotEmpty()){ + + if(newPass.text.toString().trim() == confirmPass.text.toString().trim()){ + + //PROVERI DA LI JE TRENUTA LOZINKA ISTA KAO TRENUTNI UNOS + var cp= ChangePass(oldPass.text.toString(),newPass.text.toString()) + val authApi= RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt",this@ActivityChangePassword) + val request=authApi.changePass("Bearer "+token,cp) + + request.enqueue(object : retrofit2.Callback<Int> { + override fun onResponse(call: Call<Int>, response: Response<Int>) { + if(response.isSuccessful()){ + var done=response.body()!! + if(done==1){ + Toast.makeText(this@ActivityChangePassword, "Lozinka je uspešno promenjena.", Toast.LENGTH_LONG).show(); + } + else if(done==-1){ + oldPassError.isVisible=true + oldPassError.text="Uneta lozinka nije odgovarajuća, pokušajte ponovo." + oldPassError.setTextColor(Color.RED) + + } + else if(done==-2){ + Toast.makeText(this@ActivityChangePassword, "Lozinka nije promenjena. Pokušajte ponovo", Toast.LENGTH_LONG).show(); + } + }else{ + if(response.errorBody()!=null) + Toast.makeText(this@ActivityChangePassword, response.errorBody()!!.string(), Toast.LENGTH_LONG).show(); + } + } + override fun onFailure(call: Call<Int>, t: Throwable) { + Toast.makeText( + activity, t.toString(), Toast.LENGTH_LONG + ).show(); + } + }) + } + else{ + confirmPassError.isVisible=true + confirmPassError.text="Lozinke se ne podudaraju." + confirmPassError.setTextColor(Color.RED) + } + } + } + + + + + } +}
\ No newline at end of file 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 index d84b850..ab5d676 100644 --- 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 @@ -79,23 +79,10 @@ class ActivityChangeUserData : AppCompatActivity() { 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 + changeUsername() + getUser() - //dodati on change listener - confirmUsername.setOnClickListener { - changeUsername() - getUser() - - } } changeProfilePicture.setOnClickListener { @@ -103,20 +90,7 @@ class ActivityChangeUserData : AppCompatActivity() { } 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() - - } + changeName() } back.setOnClickListener { @@ -153,6 +127,11 @@ class ActivityChangeUserData : AppCompatActivity() { } fun changeUsername(){ + if(username.text==null || username.text.trim().toString()=="") + { + Toast.makeText(this@ActivityChangeUserData,"Unesite korisničko ime",Toast.LENGTH_SHORT).show() + return + } val api = RetrofitHelper.getInstance() val token = SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) var data = api.changeMyUsername("Bearer " + token,username.text.trim().toString()); @@ -200,6 +179,11 @@ class ActivityChangeUserData : AppCompatActivity() { } fun changeName(){ + if(name.text==null || name.text.trim().toString()=="") + { + Toast.makeText(this@ActivityChangeUserData,"Unesite ime",Toast.LENGTH_SHORT).show() + return + } val api = RetrofitHelper.getInstance() val token = SharedPreferencesHelper.getValue("jwt", this@ActivityChangeUserData) var data = api.changeMyName("Bearer " + token,name.text.trim().toString()); diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPassword.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPassword.kt index b0b7f5e..6dfbeb0 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPassword.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPassword.kt @@ -46,13 +46,19 @@ class ActivityForgottenPassword : AppCompatActivity() { val intent = Intent(cont, ActivityForgottenPasswordVerify::class.java) intent.putExtra("email", emailString) startActivity(intent) + }else{ + Toast.makeText(this@ActivityForgottenPassword,"Email ne postoji",Toast.LENGTH_LONG).show() } } override fun onFailure(call: Call<ResponseBody?>, t: Throwable) { + Toast.makeText(this@ActivityForgottenPassword,"Email ne postoji",Toast.LENGTH_LONG).show() } }) } + else{ + Toast.makeText(this@ActivityForgottenPassword,"Unesite validan email",Toast.LENGTH_LONG).show() + } } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPasswordVerify.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPasswordVerify.kt index a1db97f..a519a32 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPasswordVerify.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPasswordVerify.kt @@ -1,6 +1,7 @@ package com.example.brzodolokacije.Activities import android.content.Intent +import android.graphics.Color import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View @@ -36,6 +37,19 @@ class ActivityForgottenPasswordVerify : AppCompatActivity() { var pwstr=pw.text.toString().trim() var pwchkstr=pwchk.text.toString().trim() var kodstr=kod.text.toString().trim() + if(kodstr.isEmpty()) + { + kod.hint = "Unesite kod" + kod.setHintTextColor(Color.RED) + } + if(pwstr.isEmpty()){ + pw.hint = "Unesite novu lozinku" + pw.setHintTextColor(Color.RED) + } + if(pwchkstr.isEmpty()){ + pwchk.hint = "Potvrdite novu lozinku" + pwchk.setHintTextColor(Color.RED) + } if(!kodstr.isEmpty() && checkPassword(pwstr,pwchkstr)){ var resetData= ResetPass(email!!,kodstr,pwstr) @@ -47,6 +61,8 @@ class ActivityForgottenPasswordVerify : AppCompatActivity() { if(response.code()==200){ intent = Intent(cont, ActivityLoginRegister::class.java) startActivity(intent) + }else{ + Toast.makeText(this@ActivityForgottenPasswordVerify,"Nevalidan kod",Toast.LENGTH_LONG).show() } } override fun onFailure(call: Call<ResponseBody?>, t: Throwable) { diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityOpenedImages.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityOpenedImages.kt new file mode 100644 index 0000000..f1c704e --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityOpenedImages.kt @@ -0,0 +1,91 @@ +package com.example.brzodolokacije.Activities + +import LinePagerIndicatorDecoration +import android.graphics.Bitmap +import android.graphics.drawable.Drawable +import android.os.Build +import android.os.Bundle +import android.provider.MediaStore +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.PagerSnapHelper +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SnapHelper +import com.bumptech.glide.Glide +import com.bumptech.glide.request.target.CustomTarget +import com.bumptech.glide.request.transition.Transition +import com.example.brzodolokacije.Adapters.OpenedPostImageAdapter +import com.example.brzodolokacije.Models.PostImage +import com.example.brzodolokacije.Models.PostPreview +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.databinding.ActivityOpenedImagesBinding +import java.util.* + +class ActivityOpenedImages : AppCompatActivity() { + lateinit var binding:ActivityOpenedImagesBinding + var rvImages: RecyclerView?=null + var linearLayout:LinearLayoutManager?=null + var adapter:OpenedPostImageAdapter?=null + var images:List<PostImage>?=null + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding= ActivityOpenedImagesBinding.inflate(layoutInflater) + setContentView(binding.root) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + images=(intent.extras?.getParcelable("post",PostPreview::class.java) as PostPreview).images + } + else{ + images=(intent.extras?.getParcelable("post") as PostPreview?)?.images + } + + setRecyclerView() + setListeners() + } + + fun setListeners(){ + binding.btnBackToPost.setOnClickListener { + finish() + } + binding.btnDownload.setOnClickListener { + //uzmi id trenutne slike + var selected:PostImage?=null + linearLayout?.findFirstVisibleItemPosition()?.let { it1 -> selected=images?.get(it1) } + if(selected!=null){ + //sacuvaj na telefonu + var image=Glide.with(this) + .asBitmap() + .load(RetrofitHelper.baseUrl + "/api/post/image/" + selected!!._id) + .into(object : CustomTarget<Bitmap>(){ + override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) { + Toast.makeText(this@ActivityOpenedImages,"Slika se preuzima...",Toast.LENGTH_LONG).show() + MediaStore.Images.Media.insertImage(contentResolver, resource, "odyssey_"+ Calendar.getInstance().timeInMillis , ""); + Toast.makeText(this@ActivityOpenedImages,"Slika je sačuvana.",Toast.LENGTH_LONG).show() + } + override fun onLoadCleared(placeholder: Drawable?) { + } + }) + } + } + } + + fun setRecyclerView(){ + rvImages=binding.rvImages + linearLayout= LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false) + adapter= OpenedPostImageAdapter(images,this) + rvImages!!.setHasFixedSize(true) + var snap:SnapHelper=PagerSnapHelper() + snap.attachToRecyclerView(rvImages) + rvImages!!.layoutManager=linearLayout + rvImages!!.adapter=adapter + //tackice + var color = ContextCompat.getColor(this@ActivityOpenedImages, R.color.unfollow) + var color1 = ContextCompat.getColor(this@ActivityOpenedImages, R.color.button_main) + if(images!!.size>1) + rvImages!!.addItemDecoration(LinePagerIndicatorDecoration(10,10,100,color,color1)) + } + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt index 34a9e6b..d2a820f 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivitySinglePost.kt @@ -1,21 +1,32 @@ package com.example.brzodolokacije.Activities +import LinePagerIndicatorDecoration import android.content.Intent import android.graphics.Color import android.os.Bundle import android.preference.PreferenceManager +import android.util.Log +import android.util.TypedValue +import android.view.GestureDetector +import android.view.MotionEvent import android.view.ViewGroup -import android.widget.FrameLayout -import android.widget.ImageView -import android.widget.TextView +import android.view.ViewGroup.MarginLayoutParams +import android.widget.* import androidx.appcompat.app.AppCompatActivity import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.content.ContextCompat +import androidx.core.view.GestureDetectorCompat import androidx.core.view.isGone import androidx.core.view.isVisible +import androidx.core.view.setMargins import androidx.fragment.app.FragmentTransaction import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.PagerSnapHelper import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SnapHelper +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener +import com.auth0.android.jwt.JWT import com.example.brzodolokacije.Adapters.CommentsAdapter import com.example.brzodolokacije.Adapters.PostImageAdapter import com.example.brzodolokacije.Fragments.FragmentSinglePostComments @@ -29,7 +40,7 @@ import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.databinding.ActivitySinglePostBinding import com.google.gson.Gson -import kotlinx.android.synthetic.main.fragment_single_post_description.* +import kotlinx.android.synthetic.main.activity_single_post.* import org.osmdroid.config.Configuration import org.osmdroid.tileprovider.tilesource.TileSourceFactory import org.osmdroid.util.GeoPoint @@ -37,9 +48,11 @@ import org.osmdroid.views.MapView import org.osmdroid.views.overlay.Marker import retrofit2.Call import retrofit2.Response +import java.text.SimpleDateFormat -class ActivitySinglePost : AppCompatActivity() { +class ActivitySinglePost : AppCompatActivity(),OnRefreshListener { + private lateinit var swipeRefreshLayout: SwipeRefreshLayout private lateinit var binding: ActivitySinglePostBinding private var layoutManagerImages: RecyclerView.LayoutManager? = null private var layoutManagerComments: RecyclerView.LayoutManager? = null @@ -48,8 +61,12 @@ class ActivitySinglePost : AppCompatActivity() { private var recyclerViewImages: RecyclerView?=null private var recyclerViewComments: RecyclerView?=null private var favouriteImage: ImageView?=null + private lateinit var tagLayout: LinearLayout + private lateinit var createdAt:TextView public lateinit var post: PostPreview + public lateinit var ratings:TextView + public lateinit var ratingscount:TextView private var comments:MutableList<CommentSend>?=mutableListOf() private var starNumber:Number=0 @@ -59,7 +76,7 @@ class ActivitySinglePost : AppCompatActivity() { private lateinit var btnChangeHeightUp:ImageView private lateinit var btnChangeHeightDown:ImageView private lateinit var fragmentContainer: FrameLayout - + //private lateinit var detector: GestureDetectorCompat override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding=ActivitySinglePostBinding.inflate(layoutInflater) @@ -76,41 +93,44 @@ class ActivitySinglePost : AppCompatActivity() { btnChangeHeightUp.isVisible=true btnChangeHeightUp.isGone=false btnChangeHeightUp.isClickable=true - linearLayout2=findViewById(R.id.linearLayout2) + linearLayout2.setOnClickListener { linearLayout2.getLayoutParams().height= ViewGroup.LayoutParams.MATCH_PARENT; } - + //detector= GestureDetectorCompat(this,SwipeGestureListener()) //instantiate adapter and linearLayout adapterImages= PostImageAdapter(this@ActivitySinglePost, post.images as MutableList<PostImage>) layoutManagerImages= LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false) recyclerViewImages = binding.rvMain + //tackice image + var color = ContextCompat.getColor(this@ActivitySinglePost, R.color.unfollow) + var color1 = ContextCompat.getColor(this@ActivitySinglePost, R.color.button_main) + if(post.images.size>1) + recyclerViewImages!!.addItemDecoration(LinePagerIndicatorDecoration(10,10,100,color,color1)) //DODATI SLIKE recyclerViewImages?.setHasFixedSize(true) + var snap: SnapHelper = PagerSnapHelper() + snap.attachToRecyclerView(recyclerViewImages) recyclerViewImages?.layoutManager = layoutManagerImages recyclerViewImages?.adapter = adapterImages - loadTextComponents() - 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() + setUpFirstFragment() + - /* favouriteImage=binding.ivFavourite + tagLayout = binding.llTags + + // set recyclerView attributes - loadFavourite() - */ + + translateOwnerIdToName(post.ownerId) binding.tvUser.setOnClickListener { @@ -134,7 +154,6 @@ class ActivitySinglePost : AppCompatActivity() { recyclerViewImages?.setHasFixedSize(true) recyclerViewImages?.layoutManager = layoutManagerImages recyclerViewImages?.adapter = adapterImages - } btnChangeHeightDown.setOnClickListener { btnChangeHeightDown.isVisible=false @@ -152,10 +171,10 @@ class ActivitySinglePost : AppCompatActivity() { } - /*favouriteImage!!.setOnClickListener{ + favouriteImage!!.setOnClickListener{ addRemoveFavourite() } -*/ + binding.btnActivitySinglePostDescription.setOnClickListener { var fm: FragmentTransaction =supportFragmentManager.beginTransaction() val fragment = FragmentSinglePostDescription() @@ -175,9 +194,115 @@ class ActivitySinglePost : AppCompatActivity() { fm.commit() } + swipeRefreshLayout = binding.PostSwipeRefresh + swipeRefreshLayout.setOnRefreshListener(this@ActivitySinglePost) + swipeRefreshLayout.setColorSchemeResources( + R.color.purple_200, + R.color.teal_200, + R.color.dark_blue_transparent, + R.color.purple_700 + ) + + btnChangeHeightUp.performClick() + btnChangeHeightDown.performClick() + } + + /*override fun onTouchEvent(event: MotionEvent?): Boolean { + return if(event?.let { detector.onTouchEvent(it) } == true){ + Log.d("testing swipeup","------------------------") + true + } + else return super.onTouchEvent(event) + } + + inner class SwipeGestureListener : GestureDetector.SimpleOnGestureListener() { + private val SWIPE_THRESHOLD = 20 + private val SWIPE_VELOCITY_THRESHOLD = 20 + override fun onFling( + downEvent: MotionEvent, + moveEvent: MotionEvent, + velocityX: Float, + velocityY: Float + ): Boolean { + + Log.d("testing swipeup","------------------------") + var diffX = moveEvent?.x?.minus(downEvent!!.x) ?: 0.0F + var diffY = moveEvent?.y?.minus(downEvent!!.y) ?: 0.0F + + if (Math.abs(diffX) < Math.abs(diffY)) { + if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { + if (diffY > 0 ) { + //top to bot + + } + else { + //bot to top + btnChangeHeightUp.performClick() + } + + } + return true + }else{ + return super.onFling(downEvent, moveEvent, velocityX, velocityY) + } + return super.onFling(downEvent, moveEvent, velocityX, velocityY) + } + }*/ + + fun setUpFirstFragment(){ + 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() + } + override fun onRefresh(){ + onResume() } - /* + + override fun onResume(){ + super.onResume() + loadTextComponents() + loadTags() + loadFavourite() + setUpFirstFragment() + btnChangeHeightUp.performClick() + btnChangeHeightDown.performClick() + swipeRefreshLayout.isRefreshing=false + } + + fun loadTags(){ + + tagLayout.removeAllViews() + if(post.tags!=null) + for( item in post.tags!!){ + var newbtn = Button(this) + newbtn.text = item + var layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + 50 + ) + layoutParams.setMargins(3) + + newbtn.layoutParams = layoutParams + newbtn.setBackgroundColor(Color.parseColor("#1C789A")) + newbtn.setTextColor(Color.WHITE) + newbtn.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10F) + newbtn.setPadding(3, 1, 3, 1) + newbtn.isClickable = false + tagLayout.addView(newbtn) + } + } + + public fun updateratings(rc:Int,r:Double){ + binding.tvRating.text=r.toString() + binding.tvNumberOfRatings.text=rc.toString() + } + + fun loadFavourite(){ if(post.favourites!=null){ var jwtString=SharedPreferencesHelper.getValue("jwt",this) @@ -212,12 +337,12 @@ class ActivitySinglePost : AppCompatActivity() { } - */ + fun getMap(){ var map: MapView? = null Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this)); - map=findViewById(R.id.MapDialogueMapView) + map=findViewById(R.id.MapDialogueMap) //findViewById(R.id.MapDialogueMapView) as MapView map!!.setTileSource(TileSourceFactory.MAPNIK); map!!.setBuiltInZoomControls(true); @@ -251,7 +376,8 @@ class ActivitySinglePost : AppCompatActivity() { tvNumberOfRatings.invalidate() //tvRating.text=String.format("%.2f",data.ratings) //tvNumberOfRatings.text=String.format("%d",data.ratingscount) - + tvDatePosted.text=SimpleDateFormat("dd/MM/yyyy").format(post.createdAt) + tvDatePosted.invalidate() } 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 4962006..0bbcf79 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 @@ -4,25 +4,34 @@ import android.annotation.SuppressLint import android.content.Intent import android.os.Bundle import android.util.Log +import android.view.View import android.widget.* import androidx.appcompat.app.AppCompatActivity +import androidx.constraintlayout.widget.ConstraintLayout import androidx.core.view.isVisible -import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentTransaction +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener +import com.auth0.android.jwt.JWT import com.bumptech.glide.Glide +import com.exam.DBHelper +import com.example.brzodolokacije.FragmentProfileStatistics import com.example.brzodolokacije.Fragments.FragmentUserPostsProfileActivity import com.example.brzodolokacije.Models.UserReceive import com.example.brzodolokacije.R -import com.example.brzodolokacije.R.* +import com.example.brzodolokacije.R.id +import com.example.brzodolokacije.R.layout import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.example.brzodolokacije.UserPostsMapFragment import com.google.gson.Gson import retrofit2.Call import retrofit2.Callback import retrofit2.Response -class ActivityUserProfile : AppCompatActivity() { +class ActivityUserProfile : AppCompatActivity(),OnRefreshListener { + private lateinit var swipeRefreshLayout: SwipeRefreshLayout private lateinit var name:TextView private lateinit var postsNumber:TextView private lateinit var followersNumber:TextView @@ -34,6 +43,10 @@ class ActivityUserProfile : AppCompatActivity() { private lateinit var userObject:UserReceive private lateinit var openChat:ImageButton private lateinit var unfollowUser:Button + private lateinit var btnSendMessage:ImageButton + private lateinit var followChatRow:ConstraintLayout + private lateinit var mapButton:Button + private lateinit var statisticsButton:Button private lateinit var showFollowers:Button private lateinit var showFollowing:Button @@ -56,6 +69,10 @@ class ActivityUserProfile : AppCompatActivity() { openChat=findViewById(id.activityUserProfileOpenChat) showFollowing=findViewById(id.tvActivityUserProfileFollow) showFollowers=findViewById(R.id.tvActivityUserProfileFollowers) + btnSendMessage=findViewById(R.id.activityUserProfileOpenChat) + followChatRow=findViewById(R.id.clActivityUserProfileFollow_Chat_Row) + mapButton=findViewById(R.id.btnFragmentUserProfileShowData) + statisticsButton=findViewById(R.id.btnFragmentUserProfileShowRecensions) val jsonMyObject: String @@ -65,85 +82,68 @@ class ActivityUserProfile : AppCompatActivity() { //val myObject: UserReceive = Gson().fromJson(jsonMyObject, UserReceive::class.java) userObject= Gson().fromJson(jsonMyObject, UserReceive::class.java) + updateUserData() - name.text=userObject.name - postsNumber.text=userObject.postNumber.toString() - followersNumber.text=userObject?.followersCount.toString() - followingNumber.text=userObject?.followingCount.toString() - if(userObject.pfp!=null) { - Glide.with(this@ActivityUserProfile) - .load(RetrofitHelper.baseUrl + "/api/post/image/" + userObject.pfp!!._id) - .circleCrop()//Round image - .into(profilePicture) - } + } + else{ + finish() } - checkIfAlreadyFollow() - updateUserData() + 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) - followUser.setOnClickListener{ - val api = RetrofitHelper.getInstance() - val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) - var data = api.addFollower("Bearer " + token, userObject._id); - data.enqueue(object : Callback<Boolean> { - override fun onResponse( - call: Call<Boolean>, - response: Response<Boolean> - ) { - unfollowUser.isVisible=true - unfollowUser.isClickable=true - unfollowUser.isEnabled=true - followUser.isVisible=false - followUser.isClickable=false - followUser.isEnabled=false + } + mapButton.setOnClickListener { + val bundle = Bundle() - updateUserData() + bundle.putString("id", userObject._id) + bundle.putString("other","true") + val userMapFragment = UserPostsMapFragment() + userMapFragment.setArguments(bundle) + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + fm.replace(R.id.flActivityProfileFragmentContainer, userMapFragment) + fm.commit() - Toast.makeText( - this@ActivityUserProfile, "PRATITE KORISNIKA", Toast.LENGTH_LONG - ).show(); - } - override fun onFailure(call: Call<Boolean>, t: Throwable) { - Toast.makeText( - this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG - ).show(); - } - }) + } + statisticsButton.setOnClickListener{ + + + var fragment: FragmentProfileStatistics = FragmentProfileStatistics() + val bundle = Bundle() + bundle.putString("username", userObject.username) + fragment.arguments=bundle + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + fm.replace(R.id.flActivityProfileFragmentContainer, fragment) + fm.commit() } - unfollowUser.setOnClickListener { - val api = RetrofitHelper.getInstance() - val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) - var data = api.unfollow("Bearer " + token, userObject._id); - data.enqueue(object : Callback<Boolean> { - override fun onResponse( - call: Call<Boolean>, - response: Response<Boolean> - ) { - unfollowUser.isVisible = false - unfollowUser.isClickable = false - unfollowUser.isEnabled = false - followUser.isVisible = true - followUser.isClickable = true - followUser.isEnabled = true - updateUserData() - Toast.makeText( - this@ActivityUserProfile, "VIŠE NE PRATITE KORISNIKA", Toast.LENGTH_LONG - ).show(); - } - override fun onFailure(call: Call<Boolean>, t: Throwable) { - Toast.makeText( - this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG - ).show(); - } - }) + 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) } - showFollowers.setOnClickListener { + setFollowerChatRow() + + showUserPosts.setOnClickListener { + showUserPostsFragment() + } + + followersNumber.setOnClickListener { val bundle = Bundle() bundle.putString("userId", userObject._id.toString()) bundle.putString("show","followers") @@ -154,7 +154,7 @@ class ActivityUserProfile : AppCompatActivity() { } - showFollowing.setOnClickListener { + followingNumber.setOnClickListener { val bundle = Bundle() bundle.putString("userId", userObject._id.toString()) bundle.putString("show","following") @@ -164,19 +164,112 @@ class ActivityUserProfile : AppCompatActivity() { startActivity(intent) } + swipeRefreshLayout = findViewById<View>(R.id.ProfileSwipeRefresh) as SwipeRefreshLayout + swipeRefreshLayout.setOnRefreshListener(this@ActivityUserProfile) + swipeRefreshLayout.setColorSchemeResources( + R.color.purple_200, + R.color.teal_200, + R.color.dark_blue_transparent, + R.color.purple_700 + ) + } + fun setFollowerChatRow(){ + if(userObject._id != SharedPreferencesHelper.getValue("jwt",this@ActivityUserProfile) + ?.let { it1 -> JWT(it1).claims["id"]?.asString() }){ + followChatRow.visibility=View.VISIBLE + followChatRow.forceLayout() + + + btnSendMessage.setOnClickListener{ + val intent: Intent = Intent(this@ActivityUserProfile, ChatActivityConversation::class.java) + intent.putExtra("userId",userObject._id) + intent.putExtra("username",userObject.username) + intent.putExtra("pfp",userObject.pfp?._id) + DBHelper.getInstance(this).readContact(userObject._id) + this.startActivity(intent) + } + + followUser.setOnClickListener{ + val api = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) + var data = api.addFollower("Bearer " + token, userObject._id); + data.enqueue(object : Callback<Boolean> { + override fun onResponse( + call: Call<Boolean>, + response: Response<Boolean> + ) { + if(response.body()==true) { + unfollowUser.isVisible = true + unfollowUser.isClickable = true + unfollowUser.isEnabled = true + followUser.isVisible = false + followUser.isClickable = false + followUser.isEnabled = false + + updateUserData() + } + } - showUserPosts.setOnClickListener { - var fm: FragmentTransaction =supportFragmentManager.beginTransaction() - val fragment = FragmentUserPostsProfileActivity() - val b = Bundle() - b.putString("userId", userObject._id.toString()) - fragment.arguments = b - fm.replace(R.id.flActivityProfileFragmentContainer, fragment) - fm.commit() + override fun onFailure(call: Call<Boolean>, t: Throwable) { + Toast.makeText( + this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG + ).show(); + } + }) + + } + unfollowUser.setOnClickListener { + val api = RetrofitHelper.getInstance() + val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) + var data = api.unfollow("Bearer " + token, userObject._id); + data.enqueue(object : Callback<Boolean> { + override fun onResponse( + call: Call<Boolean>, + response: Response<Boolean> + ) { + if(response.body()==true) { + unfollowUser.isVisible = false + unfollowUser.isClickable = false + unfollowUser.isEnabled = false + followUser.isVisible = true + followUser.isClickable = true + followUser.isEnabled = true + updateUserData() + } + } + + override fun onFailure(call: Call<Boolean>, t: Throwable) { + Toast.makeText( + this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG + ).show(); + } + }) + } } } + override fun onRefresh() { + onResume() + } + + override fun onResume(){ + super.onResume() + checkIfAlreadyFollow() + updateUserData() + showUserPostsFragment() + } + fun showUserPostsFragment(){ + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + val fragment = FragmentUserPostsProfileActivity() + val b = Bundle() + b.putString("userId", userObject._id.toString()) + fragment.arguments = b + fm.replace(R.id.flActivityProfileFragmentContainer, fragment) + fm.commit() + swipeRefreshLayout.isRefreshing=false + } + fun checkIfAlreadyFollow(){ val api = RetrofitHelper.getInstance() val token= SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) @@ -186,6 +279,7 @@ class ActivityUserProfile : AppCompatActivity() { override fun onFailure(call: Call<Boolean>, t: Throwable) {; Log.d("fail","faillllllllllllllllllllllllllllllllllllllllllllllllllllllll") Log.d("fail",t.toString()) + swipeRefreshLayout.isRefreshing=false } @SuppressLint("ResourceAsColor") @@ -195,6 +289,7 @@ class ActivityUserProfile : AppCompatActivity() { return } var follow = response.body()!! + swipeRefreshLayout.isRefreshing=false if(follow){ Log.d("success","follow") @@ -234,7 +329,7 @@ class ActivityUserProfile : AppCompatActivity() { fun updateUserData(){ val api = RetrofitHelper.getInstance() val token = SharedPreferencesHelper.getValue("jwt", this@ActivityUserProfile) - var data = api.getProfileFromId("Bearer " + token, userObject._id); + var data = api.getProfile("Bearer " + token, userObject.username); data.enqueue(object : Callback<UserReceive> { override fun onResponse( call: Call<UserReceive>, @@ -243,15 +338,23 @@ class ActivityUserProfile : AppCompatActivity() { var userData=response.body()!! name.text=userData.name - postsNumber.text=userData.postNumber.toString() + postsNumber.text=userData.postcount.toString() followersNumber.text=userData.followersCount.toString() followingNumber.text=userData.followingCount.toString() + swipeRefreshLayout.isRefreshing=false + if(userData.pfp!=null) { + Glide.with(this@ActivityUserProfile) + .load(RetrofitHelper.baseUrl + "/api/post/image/" + userData.pfp!!._id) + .circleCrop()//Round image + .into(profilePicture) + } } override fun onFailure(call: Call<UserReceive>, t: Throwable) { Toast.makeText( this@ActivityUserProfile, t.toString(), Toast.LENGTH_LONG ).show(); + swipeRefreshLayout.isRefreshing=false } }) } 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 efbfd7a..18ff392 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,8 +1,6 @@ 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 @@ -11,6 +9,7 @@ import android.widget.Toast import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.ContextCompat import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -24,8 +23,12 @@ import com.example.brzodolokacije.Models.MessageReceive import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.example.brzodolokacije.chat.Notifications import com.example.brzodolokacije.chat.SignalRListener import com.example.brzodolokacije.databinding.ActivityChatBinding +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.launch import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -48,47 +51,14 @@ 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) - } - } - - + Notifications.makeChannel(this) + setPermissionLauncher() + checkPermissions() setContentView(binding.root) dbConnection= DBHelper(this@ChatActivity,null) ws=SignalRListener.getInstance(this@ChatActivity) setListeners() setRecyclerView() - requestNewMessages() swipeRefreshLayout = binding.swipeContainer swipeRefreshLayout?.setOnRefreshListener(this@ChatActivity) swipeRefreshLayout?.setColorSchemeResources( @@ -97,11 +67,52 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { R.color.dark_blue_transparent, R.color.purple_700 ) - swipeRefreshLayout?.post(kotlinx.coroutines.Runnable { - swipeRefreshLayout?.isRefreshing=true - requestNewMessages() - }) + } + + override fun onResume() { + super.onResume() + clickedChat=null + requestNewMessages() + } + + fun setPermissionLauncher(){ + permissionLauncher=registerForActivityResult( + ActivityResultContracts.RequestPermission() + ) { isGranted: Boolean -> + if (!isGranted) { + binding.btnNotifications.setImageResource(R.drawable.bell_off) + } + else{ + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + } + } + + fun checkPermissions(){ + when { + //treba proveriti permisije + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU-> { + if(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) + } + } + //treba proveriti preference + else-> { + if(SharedPreferencesHelper.getValue("notifications",this)==null){ + SharedPreferencesHelper.addValue("notifications","false",this@ChatActivity) + } + else if (SharedPreferencesHelper.getValue("notifications",this)=="true") { + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } + else{ + binding.btnNotifications.setImageResource(R.drawable.bell_off) + } + } + } } fun launchNotificationPermissionPrompt(){ @@ -109,44 +120,54 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { } 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" + var builder= MaterialAlertDialogBuilder(this) + builder.background = AppCompatResources.getDrawable(this,R.drawable.rounded_alert_background) + builder.setTitle("Obaveštenje") + builder.setMessage("Potrebno je restartovati aplikaciju da bi se sačuvale promene.") + builder.setPositiveButton("OK", ) { dialog, _ -> dialog.dismiss() } - alertDialog.show() + builder.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) { + //treba proveriti permisije + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU-> { + if(ContextCompat.checkSelfPermission(this,Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) { revokeSelfPermissionOnKill(Manifest.permission.POST_NOTIFICATIONS) + launchInfoDialog() + } + else{ + launchNotificationPermissionPrompt() } - launchInfoDialog() } - else -> { - launchNotificationPermissionPrompt() + //treba proveriti preference + else-> { + if (SharedPreferencesHelper.getValue("notifications",this)=="true") { + SharedPreferencesHelper.addValue("notifications","false",this@ChatActivity) + binding.btnNotifications.setImageResource(R.drawable.bell_off) + } + else{ + SharedPreferencesHelper.addValue("notifications","true",this@ChatActivity) + binding.btnNotifications.setImageResource(R.drawable.bell_on) + } } + } } } fun requestForChats(){ - var dbHelper= DBHelper.getInstance(this@ChatActivity) - items=dbHelper.getContacts() - adapterVar= items?.let { ChatPreviewsAdapter(it,this@ChatActivity) } - setRecyclerView(setParams = false) + MainScope().launch{ + var dbHelper= DBHelper.getInstance(this@ChatActivity) + items=dbHelper.getContacts() + setRecyclerView() + } } fun requestNewMessages(){ @@ -164,7 +185,8 @@ class ChatActivity : AppCompatActivity(), SwipeRefreshLayout.OnRefreshListener { cal.time=message.timestamp dbHelper.addMessage( Message(message.senderId+message.timestamp,message.senderId, - JWT(SharedPreferencesHelper.getValue("jwt",this@ChatActivity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp,cal),false) + JWT(SharedPreferencesHelper.getValue("jwt",this@ChatActivity)!!).claims["id"]?.asString()!!,message.messagge,message.timestamp,cal),false) + } } requestForChats() 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 985735f..723980b 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,9 +1,9 @@ package com.example.brzodolokacije.Activities +import android.content.Intent import android.graphics.Bitmap import android.os.Bundle import android.util.Log -import android.view.View import android.widget.EditText import android.widget.ImageButton import android.widget.Toast @@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.auth0.android.jwt.JWT +import com.bumptech.glide.Glide import com.exam.DBHelper import com.example.brzodolokacije.Adapters.ChatMessagesAdapter import com.example.brzodolokacije.Models.Message @@ -21,6 +22,7 @@ import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.chat.SignalRListener import com.example.brzodolokacije.databinding.ActivityChatConversationBinding +import com.google.gson.Gson import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch import retrofit2.Call @@ -39,6 +41,7 @@ class ChatActivityConversation : AppCompatActivity() { var webSocketConnection:SignalRListener?=null var items:MutableList<Message>?=mutableListOf() var userImage:Bitmap?=null + var userImageId:String?=null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -46,13 +49,19 @@ 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? + if(intent.extras?.get("pfp") is Bitmap){ + userImage=intent.extras?.get("pfp") as Bitmap? + } + else{ + userImageId=intent.extras?.get("pfp") as String? + } dbConnection=DBHelper.getInstance(this@ChatActivityConversation) setHeader() setRecyclerView() requestMessages() webSocketConnection=SignalRListener.getInstance(this@ChatActivityConversation) - (webSocketConnection!!.activity as ChatActivity).setClickedActivity(this@ChatActivityConversation) + if(webSocketConnection!!.activity is ChatActivity) + (webSocketConnection!!.activity as ChatActivity).setClickedActivity(this@ChatActivityConversation) setListeners() } @@ -62,58 +71,6 @@ class ChatActivityConversation : AppCompatActivity() { var messageContent=findViewById<EditText>(R.id.etNewMessage).text.trim().toString() val Api= RetrofitHelper.getInstance() 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() - } - } - - 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<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, @@ -140,35 +97,40 @@ class ChatActivityConversation : AppCompatActivity() { Toast.makeText(this@ChatActivityConversation,"Pogresno korisnicko ime.",Toast.LENGTH_LONG).show() } }) - } - } } + binding.llHeader.setOnClickListener { + val intent: Intent = Intent(this@ChatActivityConversation,ActivityUserProfile::class.java) + var b= Bundle() + intent.putExtra("user", Gson().toJson( + UserReceive(userId!!,"",receiverUsername!!,"",Date(),null,0, listOf(),0,listOf(),0,listOf(),0,null) + )) + this.startActivity(intent) + } } private fun setHeader(){ if(userId.isNullOrEmpty() || userId.equals("null")){ - binding.cvParentUsername.visibility= View.VISIBLE - binding.cvParentUsername.forceLayout() - binding.llHeader.visibility= View.GONE - binding.llHeader.invalidate() - binding.llHeader.forceLayout() + binding.tvFragmentTitle.text="Nije nađen korisnik" + binding.tvFragmentTitle.invalidate() } else{ - 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) + if(userImage!=null){ binding.ivUserImage.setImageBitmap(userImage) + } + else if(userImageId!=null){ + Glide.with(this) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + userImageId!!) + .circleCrop() + .into(binding.ivUserImage) + } } fun setRecyclerView(setParams:Boolean=true){ MainScope().launch { diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt index 238c7e8..82fd7a4 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/MapsActivity.kt @@ -1,11 +1,8 @@ package com.example.brzodolokacije.Activities import android.Manifest -import android.app.AlertDialog import android.content.Context -import android.content.DialogInterface import android.content.pm.PackageManager -import android.graphics.Color import android.location.Location import android.location.LocationManager import android.os.Build @@ -21,17 +18,18 @@ import android.view.View import android.widget.* import android.widget.AdapterView.OnItemClickListener import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.content.res.AppCompatResources import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import androidx.core.widget.addTextChangedListener import com.example.brzodolokacije.Models.LocationType -import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.GeocoderHelper import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.google.android.gms.location.* import com.google.android.material.button.MaterialButton +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.floatingactionbutton.FloatingActionButton import org.osmdroid.config.Configuration import org.osmdroid.tileprovider.tilesource.TileSourceFactory @@ -39,7 +37,6 @@ import org.osmdroid.util.GeoPoint import org.osmdroid.views.MapView import org.osmdroid.views.Projection import org.osmdroid.views.overlay.ItemizedIconOverlay -import org.osmdroid.views.overlay.Marker import org.osmdroid.views.overlay.Overlay import org.osmdroid.views.overlay.OverlayItem import org.osmdroid.views.overlay.ScaleBarOverlay @@ -50,8 +47,6 @@ import org.osmdroid.views.overlay.mylocation.GpsMyLocationProvider import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay import retrofit2.Call import retrofit2.Response -import java.util.* -import kotlin.collections.ArrayList class MapsActivity : AppCompatActivity() { @@ -126,18 +121,26 @@ class MapsActivity : AppCompatActivity() { } fun addLocation(){ var editText=EditText(this) - var dialog=AlertDialog.Builder(this).setTitle("Naziv").setMessage("Unesite naziv") - .setView(editText) - dialog.setPositiveButton("Dodaj") { dialog, which -> + var builder=MaterialAlertDialogBuilder(this) + builder.background = AppCompatResources.getDrawable(this,R.drawable.rounded_alert_background) + builder.setView(editText) + builder.setTitle("Unesite naziv lokacije") + if(searchBar.text!=null && searchBar.text.toString().trim()!="") + editText.setText(searchBar.text.toString()) + builder.setPositiveButton("Dodaj") { dialog, which -> uploadLocation(editText.text.toString()) } - dialog.setNegativeButton("Prekini") { dialog, which -> + builder.setNegativeButton("Prekini") { dialog, which -> } - dialog.show() + builder.show() } fun uploadLocation(locationName:String){ + if(locationName.isNullOrEmpty() ||locationName.toString().trim()=="") { + Toast.makeText(this@MapsActivity,"Morate uneti naziv lokacije",Toast.LENGTH_SHORT).show() + return + } val api =RetrofitHelper.getInstance() var geocoder=GeocoderHelper.getInstance() var loc1=geocoder!!.getFromLocation(locLatitude!!,locLongitude!!,1) @@ -399,16 +402,16 @@ class MapsActivity : AppCompatActivity() { //Log.d("Main",geocoder!!.getFromLocationName("Paris",1)[0].countryName) var locString=searchBar.text.toString().trim() if(locString==null || locString=="") - Toast.makeText(this,"Unesite naziv lokacije", Toast.LENGTH_LONG) + Toast.makeText(this@MapsActivity,"Unesite naziv lokacije", Toast.LENGTH_LONG) else{ var temp=geocoder!!.getFromLocationName(locString,1) if(temp.size<=0) { - Toast.makeText(this,"Nepostojeca lokacija",Toast.LENGTH_LONG) + Toast.makeText(this@MapsActivity,"Nepostojeca lokacija",Toast.LENGTH_LONG) return } var result=temp[0] if(result==null) - Toast.makeText(this,"Nepostojeca lokacija", Toast.LENGTH_LONG) + Toast.makeText(this@MapsActivity,"Nepostojeca lokacija", Toast.LENGTH_LONG) else{ //Move to spot val searchPoint = GeoPoint(result.latitude,result.longitude) 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 23cbca6..01c6993 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 @@ -1,18 +1,19 @@ package com.example.brzodolokacije.Activities import android.content.Intent -import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.Button import android.widget.ImageButton -import android.widget.Toast -import androidx.appcompat.app.AppCompatDelegate +import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import com.example.brzodolokacije.Fragments.* import com.example.brzodolokacije.R import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomsheet.BottomSheetDialog +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.launch +import net.yslibrary.android.keyboardvisibilityevent.KeyboardVisibilityEvent class NavigationActivity : AppCompatActivity() { @@ -33,6 +34,7 @@ class NavigationActivity : AppCompatActivity() { val profileFragment=FragmentProfile() bottomNav=findViewById<View>(R.id.bottomNavigationView) as BottomNavigationView setCurrentFragment(fragmentHomePage) + KeyboardEvents() bottomNav.setOnNavigationItemSelectedListener { when(it.itemId){ R.id.navHomePage->setCurrentFragment(fragmentHomePage) @@ -61,34 +63,25 @@ class NavigationActivity : AppCompatActivity() { 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 + + var openAddPost=bottomSheetDialog2.findViewById<View>(R.id.btnBottomSheetAddNewPostOpenAddPost) as Button + var capturePost=bottomSheetDialog2.findViewById<View>(R.id.btnBottomSheetAddNewPostOpenCapturePost) as Button openAddPost.setOnClickListener{ - Toast.makeText( - applicationContext, "Open select from gallery ", Toast.LENGTH_LONG - ).show(); val intent = Intent (this, ActivityAddPost::class.java) startActivity(intent) } capturePost.setOnClickListener{ - Toast.makeText( - applicationContext, "Open capture ", Toast.LENGTH_LONG - ).show(); + val intent = Intent (this, ActivityCapturePost::class.java) startActivity(intent) } - close.setOnClickListener { - bottomSheetDialog2.dismiss() - } + } private fun showBottomSheetAddNew(){ - Toast.makeText( - applicationContext, "Open add new ", Toast.LENGTH_LONG - ).show(); + var bottomSheetDialog:BottomSheetDialog bottomSheetDialog=BottomSheetDialog(this) bottomSheetDialog.setContentView(R.layout.bottom_sheet_add_new) @@ -103,17 +96,34 @@ class NavigationActivity : AppCompatActivity() { } newLocation.setOnClickListener{ - Toast.makeText( - applicationContext, "Open capture ", Toast.LENGTH_LONG - ).show(); + val intent = Intent (this, MapsActivity::class.java) startActivity(intent) } - close.setOnClickListener { - bottomSheetDialog.dismiss() + + } + + fun KeyboardEvents(){ + KeyboardVisibilityEvent.setEventListener( + this + ) { isOpen -> + if (isOpen) { + bottomNav.visibility = View.GONE + bottomNav.forceLayout() + + } else { + MainScope().launch { + bottomNav.visibility = View.VISIBLE + bottomNav.forceLayout() + } + } } } + fun changeToProfile(){ + setCurrentFragment(FragmentProfile()) + bottomNav.menu.findItem(R.id.navProfile).isChecked = true + } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt index 403b736..ec436bd 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ChatMessagesAdapter.kt @@ -51,7 +51,11 @@ class ChatMessagesAdapter (val items : MutableList<Message>, val activity:Activi fun bind(item : Message){ bindingOther?.apply { tvMessage?.text=item.messagge - tvTimestamp.text=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY).toString() + ":" + item.usableTimeStamp.get(Calendar.MINUTE).toString() + var hour=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY) + var hourStr=if(hour<10) "0"+hour.toString() else hour.toString() + var minute=item.usableTimeStamp.get(Calendar.MINUTE) + var minuteStr=if(minute<10) "0"+minute.toString() else minute.toString() + tvTimestamp.text= hourStr + ":" + minuteStr if(layoutPosition==0 || isDifferentDays(items[layoutPosition].usableTimeStamp,items[layoutPosition-1].usableTimeStamp)){ tvDate.text=item.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+ @@ -69,7 +73,11 @@ class ChatMessagesAdapter (val items : MutableList<Message>, val activity:Activi fun bind(item : Message){ binding?.apply { tvMessage.text=item.messagge - tvTimestamp.text=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY).toString() + ":" + item.usableTimeStamp.get(Calendar.MINUTE).toString() + var hour=item.usableTimeStamp.get(Calendar.HOUR_OF_DAY) + var hourStr=if(hour<10) "0"+hour.toString() else hour.toString() + var minute=item.usableTimeStamp.get(Calendar.MINUTE) + var minuteStr=if(minute<10) "0"+minute.toString() else minute.toString() + tvTimestamp.text= hourStr + ":" + minuteStr if(layoutPosition==0 || isDifferentDays(items[layoutPosition].usableTimeStamp,items[layoutPosition-1].usableTimeStamp)){ tvDate.text=item.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+ 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 be564f4..1ed6542 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 @@ -42,16 +42,6 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha override fun onBindViewHolder(holder: ViewHolder, position: Int){ //sets components of particular item holder.bind(items[position]) - holder.itemView.setOnClickListener { - 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 - activity.startActivity(intent) - } } override fun getItemCount() = items.size inner class ViewHolder(itemView : ChatPreviewBinding) : RecyclerView.ViewHolder(itemView.root){ @@ -70,7 +60,7 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha tvUsername.text=user.username if(user.pfp!=null) { Glide.with(activity) - .load(RetrofitHelper.baseUrl + "/api/post/image/" + user.pfp!!._id) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + user.pfp!!._id) .circleCrop() .into(ivUserImage) } @@ -90,10 +80,14 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha 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() + //var msg=lastMessage.messagge.dropLast(if(lastMessage.messagge.length>20) lastMessage.messagge.length-20 else 0) + tvLastMessage.text=lastMessage.messagge//msg+if(lastMessage.messagge.length>20) "..." else "" + if(!isDifferentDays(lastMessage.usableTimeStamp,Calendar.getInstance())){ + var hour=lastMessage.usableTimeStamp.get(Calendar.HOUR_OF_DAY) + var hourStr=if(hour<10) "0"+hour.toString() else hour.toString() + var minute=lastMessage.usableTimeStamp.get(Calendar.MINUTE) + var minuteStr=if(minute<10) "0"+minute.toString() else minute.toString() + tvLastMessageDate.text= hourStr + ":" + minuteStr } else{ tvLastMessageDate.text=lastMessage.usableTimeStamp.get(Calendar.DAY_OF_MONTH).toString()+"/"+ @@ -102,6 +96,16 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha } } + itemView.setOnClickListener { + val intent: Intent = Intent(activity, ChatActivityConversation::class.java) + intent.putExtra("userId",items[position].userId) + intent.putExtra("username",itemView.tvUsername.text) + intent.putExtra("pfp",itemView.ivUserImage.drawable.toBitmap(200,200)) + db.readContact(items[position].userId) + items[position].read=true + setRead() + activity.startActivity(intent) + } } } fun isDifferentDays(c1:Calendar,c2:Calendar):Boolean{ @@ -123,5 +127,16 @@ class ChatPreviewsAdapter (val items : MutableList<ChatPreview>,val activity:Cha itemView.readIndicator.background= ContextCompat.getDrawable(activity,R.color.dark_blue_transparent) itemView.readIndicator.invalidate() } + + fun setRead(){ + itemView.tvUsername.typeface= Typeface.DEFAULT + itemView.tvUsername.invalidate() + itemView.tvLastMessage.typeface= Typeface.DEFAULT + itemView.tvLastMessage.invalidate() + itemView.tvLastMessageDate.typeface= Typeface.DEFAULT + itemView.tvLastMessageDate.invalidate() + itemView.readIndicator.background= ContextCompat.getDrawable(activity,R.color.white) + 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 8f737a3..fc77d76 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 @@ -2,6 +2,8 @@ package com.example.brzodolokacije.Adapters import android.app.Activity import android.content.Context +import android.content.Intent +import android.os.Bundle import android.util.Log import android.view.LayoutInflater import android.view.View @@ -9,22 +11,28 @@ import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.Toast +import androidx.core.content.ContextCompat 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.Activities.ActivityUserProfile +import com.example.brzodolokacije.Fragments.FragmentSinglePostComments 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.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.databinding.SingleCommentBinding +import com.google.gson.Gson import kotlinx.android.synthetic.main.single_comment.view.* import retrofit2.Call import retrofit2.Response +import java.util.* -class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activity) +class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activity, val fragment:FragmentSinglePostComments) : RecyclerView.Adapter<CommentsAdapter.ViewHolder>(){ //constructer has one argument - list of objects that need to be displayed //it is bound to xml of single item @@ -52,6 +60,8 @@ class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activi inner class ViewHolder(itemView : SingleCommentBinding) : RecyclerView.ViewHolder(itemView.root){ fun bind(item : CommentSend){ binding.apply { + var color = ContextCompat.getColor(activity, R.color.purple_500) + etReplyCount.setTextColor(color) tvCommentAuthor.text=item.username tvCommentText.text=item.comment Log.d("info",tvCommentText.text.toString()+binding.toString()) @@ -80,7 +90,7 @@ class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activi else{ showKeyboard(etReply) btnPostReply.setOnClickListener{ - if(etReply.text.isNotEmpty()){ + if(etReply.text!!.isNotEmpty()){ val postId=(activity as ActivitySinglePost).post._id Log.d("main",binding.toString()) val comment= CommentReceive(etReply.text.toString(),item._id) @@ -92,17 +102,47 @@ class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activi } } } + ivPfp.setOnClickListener { + val intent: Intent = Intent(activity, ActivityUserProfile::class.java) + var b= Bundle() + intent.putExtra("user", Gson().toJson( + UserReceive(item.userId,"",item.username,"", + Date(),null,0, listOf(),0,listOf(),0,listOf(),0,null) + )) + activity.startActivity(intent) + } 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) + etReplyCount.setOnClickListener { + if(llReplies.visibility==View.VISIBLE) + llReplies.visibility=View.GONE + else + llReplies.visibility=View.VISIBLE + llReplies.forceLayout() + } + if(item.replies!=null){ + setReplyCount(layoutPosition) + rv.adapter=CommentsAdapter(item.replies as MutableList<CommentSend>,activity,fragment) + } + else { + rv.adapter = CommentsAdapter(mutableListOf(), activity, fragment) + } } } + fun setReplyCount(position: Int){ + + if(items[position].replies==null) + items[position].replies= mutableListOf() + if(items[position].replies!!.count()==1) + itemView.etReplyCount.text=items[position].replies!!.count().toString() + " odgovor" + else + itemView.etReplyCount.text=items[position].replies!!.count().toString() + " odgovora" + itemView.clReplyCount.visibility=View.VISIBLE + itemView.clReplyCount.invalidate() + } fun showKeyboard(item:EditText){ var imm:InputMethodManager=activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager imm.showSoftInput(item,InputMethodManager.SHOW_IMPLICIT) @@ -121,9 +161,10 @@ class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activi if(response.isSuccessful){ var newComment=response.body()!! requestGetComments(newComment) - itemView.etReply.text.clear() + itemView.etReply.text!!.clear() hideKeyboard(itemView.etReply) itemView.etReply.clearFocus() + setReplyCount(bindingAdapterPosition) }else{ if(response.errorBody()!=null) Log.d("main1",response.message().toString()) @@ -143,7 +184,7 @@ class CommentsAdapter (val items : MutableList<CommentSend>,val activity: Activi var adapter:CommentsAdapter=rv.adapter as CommentsAdapter adapter.items.add(0,newComment) rv.adapter=adapter - //(activity as ActivitySinglePost).addedComment() + fragment.addedComment() } private fun requestProfilePic(item:CommentSend){ diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt index 5381ebc..ff798cc 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/FollowersAdapter.kt @@ -1,18 +1,20 @@ package com.example.brzodolokacije.Adapters import android.app.Activity -import android.util.Log +import android.content.Intent +import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.example.brzodolokacije.Models.PostPreview -import com.example.brzodolokacije.Models.User +import com.example.brzodolokacije.Activities.ActivityUserProfile import com.example.brzodolokacije.Models.UserReceive import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper +import com.google.gson.Gson class FollowersAdapter (var followers:MutableList<UserReceive>, val activity: Activity): RecyclerView.Adapter<FollowersAdapter.FollowerViewHolder>() { @@ -34,9 +36,22 @@ class FollowersAdapter (var followers:MutableList<UserReceive>, val activity: Ac private val name: TextView =view.findViewById(R.id.tvFollowerItemName) private val username:TextView=view.findViewById(R.id.tvFollowerItemUsername) + private val pfp: ImageView =view.findViewById(R.id.tvFragmentProfileProfilePicture) fun bindView(follower: UserReceive){ name.text=follower.name username.text="@"+follower.username + if(follower.pfp!=null) { + Glide.with(activity) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + follower.pfp!!._id) + .circleCrop() + .into(pfp) + } + itemView.setOnClickListener { + val intent: Intent = Intent(activity, ActivityUserProfile::class.java) + var b= Bundle() + intent.putExtra("user", Gson().toJson(follower)) + activity.startActivity(intent) + } } } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MonthViewsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MonthViewsAdapter.kt new file mode 100644 index 0000000..240deb0 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MonthViewsAdapter.kt @@ -0,0 +1,63 @@ +package com.example.brzodolokacije.Adapters + +import android.app.Activity +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.brzodolokacije.Models.MonthlyViews +import com.example.brzodolokacije.databinding.SingleDateViewBinding + +class MonthViewsAdapter (val activity: Activity, val items : MutableList<MonthlyViews>) + : RecyclerView.Adapter<MonthViewsAdapter.ViewHolder>() { + + + private lateinit var binding: SingleDateViewBinding + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val inflater = LayoutInflater.from(parent.context) + binding = SingleDateViewBinding.inflate(inflater, parent, false) + return ViewHolder(binding) + } + + + + + override fun getItemCount() = items.size + inner class ViewHolder(itemView: SingleDateViewBinding) : RecyclerView.ViewHolder(itemView.root) { + fun bind(item: MonthlyViews) { + binding.apply { + tvMonth.text=numberToMonthName(item.month) + tvMonthViews.text=item.views.toString() + + } + } + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + return holder.bind(items[position]) + + } + fun numberToMonthName(number:Int):String{ + var text="" + when (number) { + 1 -> text="Januar" + 2 -> text="Februar" + 3 -> text="Mart" + 4 -> text="April" + 5 -> text="Maj" + 6 -> text="Jun" + 7 -> text="Jul" + 8 -> text="Avgust" + 9 -> text="Septembar" + 10 -> text="Oktobar" + 11 -> text="Novembar" + 12 -> text="Decembar" + else -> { + text = "nedefinisan" + } + } + + return text + + } + +} diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt index e557e02..7ea97f6 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/MyPostsAdapter.kt @@ -2,12 +2,10 @@ package com.example.brzodolokacije.Adapters import android.app.Activity import android.content.Intent -import android.graphics.BitmapFactory -import android.os.AsyncTask import android.os.Bundle import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup -import android.widget.Toast import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.example.brzodolokacije.Activities.ActivitySinglePost @@ -16,12 +14,9 @@ import com.example.brzodolokacije.Models.LocationType import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.example.brzodolokacije.databinding.PostItemHomePageBinding +import com.example.brzodolokacije.databinding.PostItemUserPostBinding import com.example.brzodolokacije.databinding.PostPreviewBinding -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch -import okhttp3.ResponseBody -import retrofit2.Call -import retrofit2.Response class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview>) @@ -29,14 +24,12 @@ class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview> private lateinit var token: String private lateinit var imageApi: IBackendApi - //constructer has one argument - list of objects that need to be displayed - //it is bound to xml of single item - private lateinit var binding: PostPreviewBinding + private lateinit var binding: PostItemUserPostBinding override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val inflater = LayoutInflater.from(parent.context) imageApi= RetrofitHelper.getInstance() token= SharedPreferencesHelper.getValue("jwt", activity).toString() - binding = PostPreviewBinding.inflate(inflater, parent, false) + binding = PostItemUserPostBinding.inflate(inflater, parent, false) return ViewHolder(binding) } @@ -44,17 +37,19 @@ class MyPostsAdapter (val activity:Activity,val items : MutableList<PostPreview> override fun getItemCount() = items.size - inner class ViewHolder(itemView: PostPreviewBinding) : RecyclerView.ViewHolder(itemView.root) { + inner class ViewHolder(itemView: PostItemUserPostBinding) : RecyclerView.ViewHolder(itemView.root) { fun bind(item: PostPreview) { binding.apply { - tvTitle.text = item.location.name - tvLocationParent.text = item.location.country - tvPostPreviewRating.text=item.ratings.toString() + piupLocation.text = item.location.name + piupLocationDetail.text = item.location.country + piuprating.text=item.ratings.toString() + if(item.images.size>1) + ivMultipleImagesIcon.visibility= View.VISIBLE // tvLocationType.text = "TODO" if(item.images.isNotEmpty()) { Glide.with(activity) .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item.images[0]._id) - .into(locationImage) + .into(piupbackground) } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/OpenedPostImageAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/OpenedPostImageAdapter.kt new file mode 100644 index 0000000..2a73072 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/OpenedPostImageAdapter.kt @@ -0,0 +1,75 @@ +package com.example.brzodolokacije.Adapters + +import android.app.Activity +import android.net.Uri +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView +import com.example.brzodolokacije.Models.PostImage +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.databinding.OpenedPostImageBinding +import com.github.piasy.biv.BigImageViewer +import com.github.piasy.biv.loader.ImageLoader +import com.github.piasy.biv.loader.glide.GlideImageLoader +import com.github.piasy.biv.view.BigImageView +import java.io.File + +class OpenedPostImageAdapter(val items:List<PostImage>?,val activity:Activity): RecyclerView.Adapter<OpenedPostImageAdapter.ViewHolder>() { + lateinit var binding:OpenedPostImageBinding + + inner class ViewHolder(itemView: OpenedPostImageBinding) : RecyclerView.ViewHolder(itemView.root) { + fun bind(item:PostImage){ + binding.apply { + ivOpenedImage.setImageLoaderCallback(object : ImageLoader.Callback{ + override fun onCacheHit(imageType: Int, image: File?) { + ivOpenedImage.ssiv.orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF + } + + override fun onCacheMiss(imageType: Int, image: File?) { + } + + override fun onStart() { + } + + override fun onProgress(progress: Int) { + } + + override fun onFinish() { + ivOpenedImage.ssiv.orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF + } + + override fun onSuccess(image: File?) { + } + + override fun onFail(error: Exception?) { + } + + }) + ivOpenedImage.setInitScaleType(BigImageView.INIT_SCALE_TYPE_CENTER_CROP) + ivOpenedImage.showImage(Uri.parse(RetrofitHelper.baseUrl + "/api/post/image/compress/" + item._id)) + } + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + BigImageViewer.initialize(GlideImageLoader.with(activity)) + val inflater = LayoutInflater.from(parent.context) + binding= OpenedPostImageBinding.inflate(inflater,parent,false) + return ViewHolder(binding) + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + holder.bind(items!![position]) + } + + override fun getItemCount(): Int { + if(items==null){ + return 0 + } + else{ + return items.size + } + } + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt index 74bfd92..f3a8345 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/PostImageAdapter.kt @@ -1,17 +1,16 @@ package com.example.brzodolokacije.Adapters import android.app.Activity -import android.graphics.BitmapFactory -import android.media.Image +import android.content.Intent import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide -import com.example.brzodolokacije.Models.Post +import com.example.brzodolokacije.Activities.ActivityOpenedImages +import com.example.brzodolokacije.Activities.ActivitySinglePost import com.example.brzodolokacije.Models.PostImage import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.databinding.PostImageBinding -import com.example.brzodolokacije.databinding.PostPreviewBinding class PostImageAdapter(val activity: Activity, val items : MutableList<PostImage>) : RecyclerView.Adapter<PostImageAdapter.ViewHolder>(){ @@ -37,6 +36,11 @@ class PostImageAdapter(val activity: Activity, val items : MutableList<PostImage .into(locationImage) } } + itemView.setOnClickListener { + val intent: Intent = Intent(activity, ActivityOpenedImages::class.java) + intent.putExtra("post",(activity as ActivitySinglePost).post) + activity.startActivity(intent) + } } } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt index 8605246..ed05191 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsAdapter.kt @@ -3,7 +3,9 @@ package com.example.brzodolokacije.Adapters import android.app.Activity import android.content.Intent import android.os.Bundle +import android.util.Log import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.paging.PagingDataAdapter @@ -16,6 +18,8 @@ import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper import com.example.brzodolokacije.databinding.PostPreviewBinding +import kotlinx.android.synthetic.main.post_preview.view.* +import java.text.SimpleDateFormat class ShowPostsAdapter (val activity:Activity,val items : MutableList<PostPreview>?=null) @@ -51,7 +55,7 @@ class ShowPostsAdapter (val activity:Activity,val items : MutableList<PostPrevie //sets components of particular item holder.bind(getItem(position)!!) holder.itemView.setOnClickListener { - Toast.makeText(activity,getItem(position)!!._id,Toast.LENGTH_LONG).show() + val intent:Intent = Intent(activity,ActivitySinglePost::class.java) var b=Bundle() //getItem(position)!!.location.type=LocationType.ADA @@ -65,9 +69,16 @@ class ShowPostsAdapter (val activity:Activity,val items : MutableList<PostPrevie inner class ViewHolder(itemView: PostPreviewBinding) : RecyclerView.ViewHolder(itemView.root) { fun bind(item: PostPreview) { - binding.apply { + itemView.apply { + tvPostPreviewDate.text= SimpleDateFormat("dd/MM/yyyy").format(item.createdAt) tvTitle.text = item.location.name - tvLocationParent.text = item.location.country + if(item.location.city!=null) + tvLocationParent.text = item.location.city + else + tvLocationParent.text = item.location.country + tvPostPreviewRating.text=item.ratings.toString() + if(item.images.size>1) + ivMultipleImagesIcon.visibility= View.VISIBLE //tvLocationType.text = "TODO" if(item.images.isNotEmpty()) { Glide.with(activity) diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsGridViewAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsGridViewAdapter.kt new file mode 100644 index 0000000..f837afd --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsGridViewAdapter.kt @@ -0,0 +1,69 @@ +package com.example.brzodolokacije.Adapters + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import androidx.paging.PagingDataAdapter +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.RecyclerView +import com.bumptech.glide.Glide +import com.example.brzodolokacije.Activities.ActivitySinglePost +import com.example.brzodolokacije.Models.LocationType +import com.example.brzodolokacije.Models.PostPreview +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper + +class ShowPostsGridViewAdapter(val activity: Activity,var postPreview:MutableList<PostPreview>?=null): + PagingDataAdapter<PostPreview,ShowPostsGridViewAdapter.PostViewHolder1>(REPO_COMPARATOR) { + + companion object{ + private val REPO_COMPARATOR=object: DiffUtil.ItemCallback<PostPreview>(){ + override fun areContentsTheSame(oldItem: PostPreview, newItem: PostPreview): Boolean { + return oldItem._id==newItem._id + } + + override fun areItemsTheSame(oldItem: PostPreview, newItem: PostPreview): Boolean { + return oldItem._id==newItem._id + } + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PostViewHolder1 { + val view= + LayoutInflater.from(parent.context).inflate(R.layout.post_item_grid_view,parent,false) + return PostViewHolder1(view) + } + override fun onBindViewHolder(holder: ShowPostsGridViewAdapter.PostViewHolder1, position: Int) { + holder.itemView.setOnClickListener { + val intent: Intent = Intent(activity, ActivitySinglePost::class.java) + var b= Bundle() + getItem(position)!!.location.type= LocationType.ADA + b.putParcelable("selectedPost", getItem(position)!!) + intent.putExtras(b) + activity.startActivity(intent) + } + return holder.bindView(getItem(position)!! ) + } + inner class PostViewHolder1(view: View): RecyclerView.ViewHolder(view){ + private val background:com.google.android.material.imageview.ShapeableImageView=view.findViewById( + R.id.postItemGridViewImage) + private val multipleImageIcon: ImageView =view.findViewById(R.id.ivPostItemMultipleImagesIcon) + + fun bindView(postPreview: PostPreview){ + if(postPreview.images.isNotEmpty()) { + Glide.with(activity) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + postPreview.images[0]._id) + .into(background) + } + if(postPreview.images.size>1) + multipleImageIcon.visibility= View.VISIBLE + + } + } + + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt index 5b6d0f2..5569fd4 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/ShowPostsHomePageAdapter.kt @@ -7,6 +7,7 @@ import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.ImageView import android.widget.TextView import androidx.core.net.toUri import androidx.recyclerview.widget.RecyclerView @@ -49,6 +50,7 @@ inner class PostViewHolder(view: View):RecyclerView.ViewHolder(view){ private val locationName:TextView=view.findViewById(R.id.tvPIHPLocationName) private val locationDetail:TextView=view.findViewById(R.id.tvPIHPLocationDetail) private val rating:TextView=view.findViewById(R.id.tvPIHPRecension) + private val multipleImageIcon:ImageView=view.findViewById(R.id.ivMultipleImagesIcon) fun bindView(postPreview:PostPreview){ //background.setImageURI(postPreview.images[0]._id.to) @@ -59,7 +61,12 @@ inner class PostViewHolder(view: View):RecyclerView.ViewHolder(view){ } locationName.text=postPreview.location.name rating.text=postPreview.ratings.toString() - locationDetail.text="Srbija, Kragujevac" + if(postPreview.images.size>1) + multipleImageIcon.visibility=View.VISIBLE + if(postPreview.location.city!=null) + locationDetail.text=postPreview.location.city + else + locationDetail.text=postPreview.location.country } } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt new file mode 100644 index 0000000..1f0ff56 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/FragmentProfileStatistics.kt @@ -0,0 +1,98 @@ +package com.example.brzodolokacije + +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.widget.TextView +import android.widget.Toast +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.brzodolokacije.Adapters.MonthViewsAdapter +import com.example.brzodolokacije.Adapters.MyPostsAdapter +import com.example.brzodolokacije.Models.MonthlyViews +import com.example.brzodolokacije.Models.Statistics +import com.example.brzodolokacije.Models.UserReceive +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import retrofit2.Call +import retrofit2.Response + + +class FragmentProfileStatistics : Fragment() { + + private var stats:Statistics?=null + private var username:String?=null + private lateinit var totalViews:TextView + private lateinit var numberOfRatings:TextView + private lateinit var averageRatings:TextView + private lateinit var numberOfFavourite:TextView + private lateinit var rcMonths:RecyclerView + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + var view=inflater.inflate(R.layout.fragment_profile_statistics, container, false) + username=this.requireArguments().getString("username") + totalViews=view.findViewById(R.id.tvProfileStatisticsViews) + numberOfRatings=view.findViewById(R.id.tvProfileStatisticsRatingNumber) + averageRatings=view.findViewById(R.id.tvProfileStatisticsAverageRating) + numberOfFavourite=view.findViewById(R.id.tvProfileStatisticsFavouriteNumber) + rcMonths=view.findViewById(R.id.rvFragmentProfileStatisticsMonths) + + + + loadStats() + + return view + } + + + fun loadStats(){ + val authApi= RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) + val request=authApi.getUserStatsFromUsername("Bearer "+token,username!!) + + request.enqueue(object : retrofit2.Callback<Statistics?> { + override fun onResponse(call: Call<Statistics?>, response: Response<Statistics?>) { + if(response.isSuccessful()){ + stats=response.body() + loadText() + loadMonths() + + + } + } + override fun onFailure(call: Call<Statistics?>, t: Throwable) { + Toast.makeText( + activity, t.toString(), Toast.LENGTH_LONG + ).show(); + } + }) + + } + fun loadText(){ + totalViews.text=stats!!.totalViews.toString() + numberOfRatings.text=stats!!.numberOfRatingsOnPosts.toString() + averageRatings.text=stats!!.averagePostRatingOnPosts.toString() + numberOfFavourite.text=stats!!.numberOfFavouritePosts.toString() + } + private fun loadMonths(){ + rcMonths.apply { + layoutManager= GridLayoutManager(requireContext(),2) + adapter= MonthViewsAdapter(requireActivity(), + stats!!.monthlyViews as MutableList<MonthlyViews> + ) + + } + } + + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddNew.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddNew.kt index 8eaa469..a5c3e88 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddNew.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddNew.kt @@ -41,9 +41,7 @@ class FragmentAddNew : Fragment() { addNewPost.setOnClickListener{ - Toast.makeText( - activity, "Add new post", Toast.LENGTH_LONG - ).show(); + val intent = Intent (getActivity(), ActivityAddPost::class.java) getActivity()?.startActivity(intent) 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 a0d6146..bbfd583 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 @@ -209,8 +209,10 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) { for(post in postList){ Log.d("main",post.toString()) val startMarker = Marker(map) + startMarker.setPosition(GeoPoint(post.location.latitude,post.location.longitude)) startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM) + startMarker.icon=ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24) startMarker.setOnMarkerClickListener(object:OnMarkerClickListener{ override fun onMarkerClick( marker: Marker?, @@ -335,7 +337,7 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) { .lastLocation // Set latitude map!!.controller.animateTo(GeoPoint(location1!!.latitude,location1!!.longitude)) - Toast.makeText(requireContext()," "+location1!!.latitude,Toast.LENGTH_LONG) + } } @@ -345,7 +347,7 @@ class FragmentBrowse : Fragment(R.layout.fragment_browse) { Looper.myLooper()); } else { map!!.controller.animateTo(GeoPoint(location!!.latitude,location!!.longitude)) - Toast.makeText(requireContext()," "+location.latitude,Toast.LENGTH_LONG) + } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt index 767c192..2a92e97 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowers.kt @@ -39,9 +39,7 @@ class FragmentFollowers : Fragment() { val bundle = this.arguments if (bundle != null) { userId= bundle.getString("userId").toString() - Toast.makeText( - activity, bundle.getString("userId"), Toast.LENGTH_LONG - ).show(); + } getFollowers() diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt index fe52723..a31fb47 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentFollowing.kt @@ -34,9 +34,7 @@ class FragmentFollowing : Fragment() { val bundle = this.arguments if (bundle != null) { userId= bundle.getString("userId").toString() - Toast.makeText( - activity, bundle.getString("userId"), Toast.LENGTH_LONG - ).show(); + } getFollowing() diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt index fd5aa33..d0a9818 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt @@ -45,7 +45,7 @@ class FragmentHome : Fragment(R.layout.fragment_home) { val rootView = inflater?.inflate(R.layout.fragment_home, container, false) recyclerView = rootView?.findViewById(R.id.rvMain) // set recyclerView attributes - recyclerView?.setHasFixedSize(true) +// recyclerView?.setHasFixedSize(true) recyclerView?.layoutManager = layoutManagerVar recyclerView?.adapter = adapterVar return rootView 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 a26aaba..66bc8e5 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 @@ -7,31 +7,26 @@ import android.view.KeyEvent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.* +import android.widget.AdapterView +import android.widget.ArrayAdapter +import android.widget.AutoCompleteTextView +import android.widget.ImageView 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.auth0.android.jwt.JWT +import com.bumptech.glide.Glide 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.Models.UserReceive 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 -import retrofit2.Retrofit -import retrofit2.converter.gson.GsonConverterFactory class FragmentHomePage : Fragment() { @@ -40,6 +35,7 @@ class FragmentHomePage : Fragment() { private lateinit var btnBack:ImageView private lateinit var searchBar:AutoCompleteTextView private lateinit var searchButton: MaterialButton + private lateinit var pfp:ImageView var responseLocations:MutableList<com.example.brzodolokacije.Models.Location>?=null /* override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -56,6 +52,7 @@ class FragmentHomePage : Fragment() { btnChat=view.findViewById(R.id.ivFragmentHomePageChat) searchBar=view.findViewById(R.id.etFragmentHomePageSearch) searchButton=view.findViewById(R.id.mbFragmentHomePageSearchButton) + pfp=view.findViewById(R.id.ivFragmentHomePageProfile) setBtnBackInvisible() setUpSpinner() var fm: FragmentTransaction =childFragmentManager.beginTransaction() @@ -88,16 +85,46 @@ class FragmentHomePage : Fragment() { false }) + pfp.setOnClickListener { + (activity as NavigationActivity).changeToProfile() + } + reqProfile() + return view } + fun reqProfile(){ + var api=RetrofitHelper.getInstance() + var token=SharedPreferencesHelper.getValue("jwt",requireActivity()) + val request2=api?.getProfileFromId("Bearer "+token, + JWT(token!!).claims["id"]!!.asString()!! + ) + request2?.enqueue(object : retrofit2.Callback<UserReceive?> { + override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { + if(response.isSuccessful()){ + //zahtev da se posalje poruka + var user=response.body()!! + if(user.pfp!=null) { + Glide.with(activity!!) + .load(RetrofitHelper.baseUrl + "/api/post/image/compress/" + user.pfp!!._id) + .circleCrop() + .into(pfp) + } + } + } - fun searchText(){ - if(searchBar.text==null || searchBar.text.toString().trim()=="") - return + override fun onFailure(call: Call<UserReceive?>, t: Throwable) { + } + }) + } + + fun searchText(){ var act=requireActivity() as NavigationActivity - act.searchQuery=searchBar.text.toString() + if(searchBar.text==null || searchBar.text.toString().trim()=="") + act.searchQuery="-1" + else + act.searchQuery=searchBar.text.toString() act.searchId="" 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 82c78a1..3e42c2c 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 @@ -8,11 +8,12 @@ import android.widget.Button import android.widget.ImageButton import android.widget.LinearLayout import android.widget.Toast -import androidx.core.view.isVisible import androidx.fragment.app.Fragment -import androidx.fragment.app.FragmentTransaction import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener +import com.example.brzodolokacije.Activities.NavigationActivity import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter import com.example.brzodolokacije.Interfaces.IBackendApi import com.example.brzodolokacije.Models.LocationType @@ -20,15 +21,15 @@ import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper -import kotlinx.android.synthetic.main.fragment_home_page_main_scroll.* import retrofit2.Call import retrofit2.Callback import retrofit2.Response import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory -class FragmentHomePageMainScroll : Fragment() { +class FragmentHomePageMainScroll : Fragment(),OnRefreshListener { + private lateinit var swipeRefreshLayout: SwipeRefreshLayout private lateinit var posts : MutableList<PostPreview> private lateinit var mostViewedPosts : MutableList<PostPreview> private lateinit var newestPosts : MutableList<PostPreview> @@ -79,107 +80,50 @@ private lateinit var change:Button location_waterfall=view.findViewById(R.id.btnFragmentHomePagelocation_waterfall) //pokupi sve objave iz baze' - getAllPosts() + //getAllPosts() var bundle=Bundle() var fragment=FragmentShowPostsByLocation() location_spa.setOnClickListener { - filter=LocationType.BANJA - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle + tagSearch("Banja") + - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() } location_waterfall.setOnClickListener { - filter=LocationType.VODOPAD - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Vodopad") } location_mountain.setOnClickListener { - filter=LocationType.PLANINA - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Planina") } location_landmark.setOnClickListener { - filter=LocationType.LOKALITET - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Lokalitet") } location_city.setOnClickListener { - filter=LocationType.GRAD - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Grad") } location_lake.setOnClickListener { - filter=LocationType.JEZERO - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Jezero") } location_attraction.setOnClickListener { - filter=LocationType.ATRAKCIJA - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Atrakcija") } location_amusement_park.setOnClickListener { - filter=LocationType.ZABAVNI_PARK - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Zabavni park") } location_beach.setOnClickListener { - filter=LocationType.PLAZA - filterString=filter.toString() - bundle.putString("data",filterString) - fragment.arguments=bundle - val parentFrag: FragmentHomePage = this@FragmentHomePageMainScroll.getParentFragment() as FragmentHomePage - parentFrag.changeScrollVIewToLocationView() - parentFrag.setBtnBackVisible() + tagSearch("Plaza") } /* ll1.isVisible=true @@ -190,13 +134,30 @@ private lateinit var change:Button } */ + swipeRefreshLayout = view.findViewById<View>(R.id.swipeContainer) as SwipeRefreshLayout + swipeRefreshLayout.setOnRefreshListener(this) + swipeRefreshLayout.setColorSchemeResources( + R.color.purple_200, + R.color.teal_200, + R.color.dark_blue_transparent, + R.color.purple_700 + ) + swipeRefreshLayout.post(kotlinx.coroutines.Runnable { + swipeRefreshLayout.isRefreshing=true + }) return view } + override fun onRefresh() { + getAllPosts() + } + + override fun onResume() { + super.onResume() + getAllPosts() + } + private fun getAllPosts(){ - Toast.makeText( - activity," get all", Toast.LENGTH_LONG - ).show(); val api = Retrofit.Builder() .addConverterFactory(GsonConverterFactory.create()) .baseUrl(RetrofitHelper.baseUrl) @@ -269,9 +230,7 @@ private lateinit var change:Button // Toast.makeText( // activity, "get all r ", Toast.LENGTH_LONG // ).show(); - Toast.makeText( - activity," get all newest", Toast.LENGTH_LONG - ).show(); + val api = RetrofitHelper.getInstance() val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) val data=api.get10Newest("Bearer "+token) @@ -289,6 +248,7 @@ private lateinit var change:Button layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) adapter= ShowPostsHomePageAdapter(newestposts,requireActivity()) } + swipeRefreshLayout.isRefreshing=false } override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) { @@ -301,9 +261,6 @@ private lateinit var change:Button // Toast.makeText( // activity, "get all br ", Toast.LENGTH_LONG // ).show(); - Toast.makeText( - activity," get all best", Toast.LENGTH_LONG - ).show(); val api = RetrofitHelper.getInstance() val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) val data=api.get10Best("Bearer "+token) @@ -329,5 +286,11 @@ private lateinit var change:Button } + private fun tagSearch(tag:String){ + var act = requireActivity() as NavigationActivity + act.searchQuery = tag + act.searchId = "" + act.bottomNav.selectedItemId = R.id.navAllPosts + } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentLogin.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentLogin.kt index 01b3f1d..35309c4 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentLogin.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentLogin.kt @@ -3,6 +3,7 @@ package com.example.brzodolokacije.Fragments import android.content.Intent import android.graphics.Color import android.os.Bundle +import android.view.KeyEvent import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View @@ -49,6 +50,16 @@ class FragmentLogin : Fragment() { forgottenPassword = view.findViewById<View>(R.id.tvFragmentLoginForgottenPassword) as TextView login=view.findViewById<View>(R.id.btnFragmentLoginLogin) as Button + password.setOnKeyListener(View.OnKeyListener{v, keyCode, event -> + if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP){ + //Start your action + login.performClick() + //End action + return@OnKeyListener true + } + false + }) + //osluskivanje unosa login.setOnClickListener{ @@ -89,9 +100,6 @@ class FragmentLogin : Fragment() { override fun onResponse(call: Call<String?>, response: Response<String?>) { if(response.isSuccessful()){ val token=response.body().toString() - Toast.makeText( - activity, token, Toast.LENGTH_LONG - ).show(); SharedPreferencesHelper.addValue("jwt",token,activity!!) val intent= Intent(activity!!, NavigationActivity::class.java) startActivity(intent) 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 d6e345b..4192f8d 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 @@ -1,24 +1,32 @@ package com.example.brzodolokacije.Fragments + import android.content.Intent +import android.net.Uri import android.os.Bundle 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 androidx.fragment.app.FragmentTransaction import com.exam.DBHelper +import com.example.brzodolokacije.Activities.ActivityChangePassword import com.example.brzodolokacije.Activities.ActivityChangeUserData -import com.example.brzodolokacije.Activities.ActivityForgottenPassword import com.example.brzodolokacije.Activities.ActivityLoginRegister +import com.example.brzodolokacije.FragmentProfileStatistics import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper class FragmentMyProfileInfo : Fragment() { private lateinit var logout:Button private lateinit var changeAccount:Button + private lateinit var statistics:Button + private lateinit var changePassword:Button + private lateinit var favouritePosts:Button + private lateinit var inviteFriends:Button override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -29,7 +37,10 @@ class FragmentMyProfileInfo : Fragment() { logout=view.findViewById<View>(R.id.buttonLogOut) as Button changeAccount=view.findViewById(R.id.changeAccountData) - + statistics=view.findViewById<View>(R.id.getAccoutStatistics) as Button + changePassword=view.findViewById(R.id.ChangePassword) + favouritePosts=view.findViewById(R.id.getMyFavorite) + inviteFriends=view.findViewById(R.id.inviteFriends) logout.setOnClickListener{ logOut() } @@ -39,6 +50,56 @@ class FragmentMyProfileInfo : Fragment() { getActivity()?.startActivity(intent) } + inviteFriends.setOnClickListener { + val uri: Uri = + Uri.parse(RetrofitHelper.baseUrl+"/api/app/download") // missing 'http://' will cause crashed + + val intent = Intent(Intent.ACTION_VIEW, uri) + startActivity(intent) + } + favouritePosts.setOnClickListener { + + val manager: androidx.fragment.app.FragmentManager? = fragmentManager + val transaction: FragmentTransaction = manager!!.beginTransaction() + + var fragment:FragmentUserPosts=FragmentUserPosts() + val bundle = Bundle() + var parentFragment:FragmentProfile=parentFragment as FragmentProfile + var username=parentFragment.usernameStringSend + bundle.putString("username", username) + fragment.arguments=bundle + + + + transaction.replace(R.id.flFragmentProfileFragmentContainer,fragment ) + transaction.commit() + + } + statistics.setOnClickListener { + + val manager: androidx.fragment.app.FragmentManager? = fragmentManager + val transaction: FragmentTransaction = manager!!.beginTransaction() + + var fragment:FragmentProfileStatistics=FragmentProfileStatistics() + val bundle = Bundle() + var parentFragment:FragmentProfile=parentFragment as FragmentProfile + var username=parentFragment.usernameStringSend + bundle.putString("username", username) + fragment.arguments=bundle + + + + transaction.replace(R.id.flFragmentProfileFragmentContainer,fragment ) + transaction.commit() + + } + + + changePassword.setOnClickListener { + val intent = Intent (getActivity(), ActivityChangePassword::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 6fe4678..9759002 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 @@ -15,6 +15,8 @@ import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentTransaction +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener import com.bumptech.glide.Glide import com.example.brzodolokacije.Activities.ActivityShowFollowersAndFollowing import com.example.brzodolokacije.Models.UserReceive @@ -41,7 +43,9 @@ private const val ARG_PARAM2 = "param2" * Use the [FragmentProfile.newInstance] factory method to * create an instance of this fragment. */ -class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_profile) { +class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_profile),OnRefreshListener { + private lateinit var swipeRefreshLayout: SwipeRefreshLayout + // TODO: Rename and change types of parameters private lateinit var username: TextView private lateinit var name: TextView @@ -60,6 +64,7 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr private lateinit var profilePicturePlus: MaterialButton private lateinit var showFollowers: TextView private lateinit var showFollowing: TextView + public var usernameStringSend:String?=null override fun onCreateView( @@ -131,8 +136,37 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr intent.putExtras(bundle) startActivity(intent) } - getProfileInfo() - openMyPosts() + swipeRefreshLayout = view.findViewById<View>(R.id.ProfileSwipeRefresh) as SwipeRefreshLayout + swipeRefreshLayout?.setOnRefreshListener(this@FragmentProfile) + swipeRefreshLayout?.setColorSchemeResources( + R.color.purple_200, + R.color.teal_200, + R.color.dark_blue_transparent, + R.color.purple_700 + ) + swipeRefreshLayout?.post(kotlinx.coroutines.Runnable { + swipeRefreshLayout?.isRefreshing=true + }) + + + followersNumber.setOnClickListener{ + val bundle = Bundle() + bundle.putString("userId","error") + bundle.putString("show","followers") + bundle.putString("showMy","yes") + val intent = Intent(activity, ActivityShowFollowersAndFollowing::class.java) + intent.putExtras(bundle) + startActivity(intent) + } + followingNumber.setOnClickListener { + val bundle = Bundle() + bundle.putString("userId","error") + bundle.putString("show","following") + bundle.putString("showMy","yes") + val intent = Intent(activity,ActivityShowFollowersAndFollowing::class.java) + intent.putExtras(bundle) + startActivity(intent) + } return view } fun openMyPosts(){ @@ -142,6 +176,16 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr fm.commit() } + override fun onRefresh() { + onResume() + } + + override fun onResume(){ + super.onResume() + getProfileInfo() + openMyPosts() + } + private fun addProfilePicture(){ val intent= Intent(Intent.ACTION_PICK) intent.action = Intent.ACTION_GET_CONTENT @@ -193,7 +237,9 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr override fun onResponse(call: Call<UserReceive?>, response: Response<UserReceive?>) { if(response.isSuccessful()){ setUserInfo(response.body()!!) + swipeRefreshLayout.isRefreshing=false }else{ + swipeRefreshLayout.isRefreshing=false if(response.errorBody()!=null) Toast.makeText(activity, response.errorBody()!!.string(), Toast.LENGTH_LONG).show(); } @@ -202,12 +248,14 @@ class FragmentProfile : Fragment(com.example.brzodolokacije.R.layout.fragment_pr Toast.makeText( activity, t.toString(), Toast.LENGTH_LONG ).show(); + swipeRefreshLayout.isRefreshing=false } }) } private fun setUserInfo(user:UserReceive){ name.setText(user.name) username.setText("@"+user.username) + usernameStringSend=user.username postsCount.setText(user.postcount.toString()) Log.d("follno",user.followersCount.toString()) Log.d("follno","helllllllllllllllllllllppppppppppppppppppppppppppppppp") diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentRegister.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentRegister.kt index e166d38..ac08d9c 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentRegister.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentRegister.kt @@ -2,6 +2,7 @@ package com.example.brzodolokacije.Fragments import android.graphics.Color import android.os.Bundle +import android.view.KeyEvent import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View @@ -42,6 +43,16 @@ class FragmentRegister : Fragment() { name = view.findViewById<View>(R.id.etFragmentRegisterName) as EditText register=view.findViewById<View>(R.id.btnFragmentRegisterRegister) as Button + password.setOnKeyListener(View.OnKeyListener{v, keyCode, event -> + if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP){ + //Start your action + register.performClick() + //End action + return@OnKeyListener true + } + false + }) + //osluskivanje unosa register.setOnClickListener{ 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 76fa4e0..a26ea43 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 @@ -1,6 +1,8 @@ package com.example.brzodolokacije.Fragments -import android.content.Intent + +import android.graphics.Color + import android.os.Bundle import android.util.Log import android.view.KeyEvent @@ -8,20 +10,21 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup 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 +import androidx.paging.PagingData import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager 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.Adapters.ShowPostsGridViewAdapter + import com.example.brzodolokacije.Models.Location +import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.Models.SearchParams import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper @@ -31,34 +34,45 @@ 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.android.synthetic.main.activity_splash_page.* +import kotlinx.android.synthetic.main.bottom_sheet_sort.* 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 { + private var dataChanged:Boolean=false + private var flowData: PagingData<PostPreview>?=null private lateinit var binding: FragmentShowPostsBinding private var linearManagerVar: RecyclerView.LayoutManager? = null private var adapterVar: ShowPostsAdapter? = null + private var gridViewAdapter:ShowPostsGridViewAdapter?=null private var recyclerView: RecyclerView?=null - private var gridManagerVar: RecyclerView.LayoutManager?=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("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 + + private lateinit var filter:Button + private lateinit var sort:Button + + private var filterBool:Boolean=false + private var ratingFrom:Int=-1 + private var ratingTo:Int=-1 + private var viewsFrom:Int=-1 + private var viewsTo:Int=-1 + private var searchParams:SearchParams?= SearchParams("-1",filterBool,1,1,ratingFrom,ratingTo,viewsFrom,viewsTo) + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setUpViewModel() @@ -66,15 +80,21 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { //instantiate adapter and linearLayout adapterVar=ShowPostsAdapter(requireActivity()) linearManagerVar= LinearLayoutManager(activity) - gridManagerVar=GridLayoutManager(activity,2) + //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() + if(searchBar.text==null || searchBar.text.toString().trim()=="") + act.searchQuery="-1" + else{ + act.searchQuery=searchBar.text.toString() + } + + act.searchId="" - searchParams=SearchParams(searchBar.text.toString(),1,1) + searchParams=SearchParams(act.searchQuery,filterBool,1,1,ratingFrom,ratingTo,viewsFrom,viewsTo) requestToBack(searchParams!!) } fun onTextEnter(){ @@ -124,7 +144,7 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { var act=requireActivity() as NavigationActivity act.searchQuery=selectedLocation!!.name act.searchId=selectedLocation!!._id - searchParams=SearchParams(selectedLocation!!._id,1,1)//to do sort type + searchParams=SearchParams(selectedLocation!!._id,filterBool,1,1,ratingFrom,ratingTo,viewsFrom,viewsTo)//to do sort type requestToBack(searchParams!!) }) @@ -138,8 +158,16 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { fun setUpListeners(rootView: View?){ rootView?.findViewById<ImageButton>(R.id.btnGridLayout)?.setOnClickListener() { - if(recyclerView?.layoutManager!=gridManagerVar){ - recyclerView?.layoutManager=gridManagerVar + /*if(recyclerView?.layoutManager!=gridManagerVar){ + recyclerView?.layoutManager=gridManagerVar*/ + recyclerView?.apply { + layoutManager= GridLayoutManager(activity,2) + if(gridViewAdapter==null) + gridViewAdapter= ShowPostsGridViewAdapter(requireActivity()) + recyclerView?.adapter=gridViewAdapter + if(dataChanged) + gridViewAdapter?.submitData(lifecycle,flowData!!) + dataChanged=false } Log.d("main","klik") } @@ -148,19 +176,27 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { if(recyclerView?.layoutManager!=linearManagerVar){ recyclerView?.layoutManager=linearManagerVar } + recyclerView?.adapter=adapterVar + if(dataChanged) + adapterVar?.submitData(lifecycle,flowData!!) + dataChanged=false Log.d("main","klik") } - rootView?.findViewById<ImageButton>(R.id.btnChat)?.setOnClickListener() { - val intent: Intent = Intent(activity, ChatActivity::class.java) - requireActivity().startActivity(intent) - } + } fun requestToBack(searchParams: SearchParams){ lifecycleScope.launch{ searchPostsViewModel.fetchPosts(searchParams).distinctUntilChanged().collectLatest { - adapterVar?.submitData(lifecycle,it) + if(recyclerView?.adapter == gridViewAdapter){ + gridViewAdapter?.submitData(lifecycle,it) + } + else{ + adapterVar?.submitData(lifecycle,it) + } + dataChanged=true + flowData=it swipeRefreshLayout?.isRefreshing=false } } @@ -172,11 +208,171 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { ): View? { val rootView = inflater?.inflate(R.layout.fragment_show_posts, container, false) recyclerView = rootView?.findViewById(R.id.rvMain) + + // set recyclerView attributes - recyclerView?.setHasFixedSize(true) +// recyclerView?.setHasFixedSize(true) //recyclerView?.layoutManager = linearManagerVar recyclerView?.layoutManager = linearManagerVar recyclerView?.adapter = adapterVar + + + //filter dialog + var bottomSheetDialogFilter: BottomSheetDialog + bottomSheetDialogFilter = BottomSheetDialog(requireContext()) + bottomSheetDialogFilter.setContentView(R.layout.bottom_sheet_filter) + + //sort dialog + var bottomSheetDialogSort: BottomSheetDialog + bottomSheetDialogSort = BottomSheetDialog(requireContext()) + bottomSheetDialogSort.setContentView(R.layout.bottom_sheet_sort) + + var ratingFromInput=bottomSheetDialogFilter.findViewById<View>(R.id.filterRatingFrom) as EditText + var ratingToInput=bottomSheetDialogFilter.findViewById<View>(R.id.filterRatingTo) as EditText + var viewsFromInput=bottomSheetDialogFilter.findViewById<View>(R.id.filterViewsFrom) as EditText + var viewsToInput=bottomSheetDialogFilter.findViewById<View>(R.id.filterViewsTo) as EditText + + + btnFilter= rootView!!.findViewById(R.id.btnSortType) + btnSort=rootView!!.findViewById(R.id.btnSortDirection) + + btnFilter.setOnClickListener{ + bottomSheetDialogFilter.show() + + var filter = bottomSheetDialogFilter.findViewById<View>(R.id.btnBSFFilter) as Button + var radioGroupF = bottomSheetDialogFilter.findViewById<View>(R.id.radioGroupFilter) as RadioGroup + + filter.setOnClickListener { + + var selectedRadioButtonIdF: Int = radioGroupF.checkedRadioButtonId + if (selectedRadioButtonIdF != -1) { + var selectedRadioButtonF = + bottomSheetDialogFilter.findViewById<View>(selectedRadioButtonIdF) as RadioButton + val string: String = selectedRadioButtonF.text.toString().trim() + + if (string.equals("Prethodna nedelja")) { + searchParams!!.filterdate= 5 + } else if (string.equals("Prethodni mesec")) { + searchParams!!.filterdate=4 + } else if (string.equals("Prethodna tri meseca")) { + searchParams!!.filterdate=3 + } else if (string.equals("Prethodna godina")) { + searchParams!!.filterdate=2 + } else { + searchParams!!.filterdate=1 + } + } + if(ratingFromInput.text.toString().isNotEmpty()) { + if (ratingFromInput.text.toString().trim().toInt() >= 0) { + filterBool = true + ratingFrom = ratingFromInput.text.toString().toInt() + } else { + Toast.makeText( + activity, + "Vrednost rejtinga ne može biti negativna", + Toast.LENGTH_LONG + ).show(); + var fromrating = + bottomSheetDialogFilter.findViewById<View>(R.id.ratingFromtxt) as TextView + fromrating.setTextColor(Color.RED) + } + } + else{ + ratingFrom=-1 + } + if(ratingToInput.text.toString().isNotEmpty()) { + if (ratingToInput.text.toString().trim().toInt() >= 0) { + filterBool = true + ratingTo = ratingToInput.text.toString().toInt() + } else { + Toast.makeText( + activity, + "Vrednost rejtinga ne može biti negativna", + Toast.LENGTH_LONG + ).show(); + var torating = + bottomSheetDialogFilter.findViewById<View>(R.id.ratingTotxt) as TextView + torating.setTextColor(Color.RED) + } + }else{ + ratingTo=-1 + } + + if(viewsFromInput.text.toString().isNotEmpty()) { + if (viewsFromInput.text.toString().trim().toInt() >= 0) { + filterBool = true + viewsFrom = viewsFromInput.text.toString().toInt() + } else { + Toast.makeText( + activity, + "Vrednost broja pregleda ne može biti negativna", + Toast.LENGTH_LONG + ).show(); + var fromviews = + bottomSheetDialogFilter.findViewById<View>(R.id.viewsFromtxt) as TextView + fromviews.setTextColor(Color.RED) + } + } + else{ + viewsFrom=-1 + } + if(viewsToInput.text.toString().isNotEmpty()) { + if (viewsToInput.text.toString().trim().toInt() >= 0) { + filterBool = true + viewsTo = viewsToInput.text.toString().trim().toInt() + } else { + Toast.makeText( + activity, + "Vrednost broja pregleda ne može biti negativna", + Toast.LENGTH_LONG + ).show(); + var toviews = + bottomSheetDialogFilter.findViewById<View>(R.id.viewsTotxt) as TextView + toviews.setTextColor(Color.RED) + } + }else{ + viewsTo=-1 + } + searchParams!!.filter=filterBool + searchParams!!.ratingFrom=ratingFrom + searchParams!!.ratingTo=ratingTo + searchParams!!.viewsFrom=viewsFrom + searchParams!!.viewsTo=viewsTo + searchText() + bottomSheetDialogFilter.dismiss() + } + + + } + btnSort.setOnClickListener{ + Log.d("main","fgdsfdssdfd") + bottomSheetDialogSort.show() + var sort = bottomSheetDialogSort.findViewById<View>(R.id.btnSortPosts) as Button + var radioGroup = bottomSheetDialogSort.findViewById<View>(R.id.radioGroup)as RadioGroup + + sort.setOnClickListener { + val selectedRadioButtonId: Int = radioGroup.checkedRadioButtonId + if (selectedRadioButtonId != -1) { + var selectedRadioButton = + bottomSheetDialogSort.findViewById<View>(selectedRadioButtonId) as RadioButton + val string: String = selectedRadioButton.text.toString().trim() + if (string.equals("Najnovije")) { + searchParams!!.sorttype = 3 + } else if (string.equals("Najstarije")) { + searchParams!!.sorttype=4 + } else if (string.equals("Najbolje ocenjeno")) { + searchParams!!.sorttype=2 + } else if (string.equals("Najviše pregleda")) { + searchParams!!.sorttype=1 + } else { + searchParams!!.sorttype=1 + } + } + + } + bottomSheetDialogSort.dismiss() + } + setUpListeners(rootView) swipeRefreshLayout = rootView?.findViewById<View>(R.id.swipeContainer) as SwipeRefreshLayout swipeRefreshLayout?.setOnRefreshListener(this) @@ -190,17 +386,14 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { swipeRefreshLayout?.isRefreshing=true requestToBack(searchParams!!) }) +////////////////////////////////////////////////////////////////// - btnFilter=rootView.findViewById(R.id.btnSortType) - btnSort=rootView.findViewById(R.id.btnSortDirection) - btnFilter.setOnClickListener{ - showBottomSheetFilter() - } - btnSort.setOnClickListener{ - showBottomSheetSort() - } + + + ///////////////////////////////////////////////////////////////////////////// + searchBar=rootView.findViewById(R.id.etFragmentShowPostsSearch) as AutoCompleteTextView searchButton=rootView.findViewById<View>(R.id.mbFragmentHomePageSearch) as MaterialButton setUpSpinner() @@ -240,42 +433,18 @@ class FragmentShowPosts : Fragment(), SwipeRefreshLayout.OnRefreshListener { Log.d("TEST","USAO") if(act.searchId!=null && act.searchId.trim()!="") { - searchBar.setText(act.searchQuery,TextView.BufferType.EDITABLE) - searchParams= SearchParams(act.searchId,1,1) + if(act.searchQuery!="-1") + searchBar.setText(act.searchQuery,TextView.BufferType.EDITABLE) + searchParams= SearchParams(act.searchId,filterBool,1,1,ratingFrom,ratingTo,viewsFrom,viewsTo) requestToBack(searchParams!!) }else if(act.searchQuery!=null && act.searchQuery.trim()!="") { searchBar.setText(act.searchQuery,TextView.BufferType.EDITABLE) - searchParams= SearchParams(act.searchQuery,1,1) + searchParams= SearchParams(act.searchQuery,filterBool,1,1,ratingFrom,ratingTo,viewsFrom,viewsTo) requestToBack(searchParams!!) } } - private fun showBottomSheetFilter() { - var bottomSheetDialog: BottomSheetDialog - bottomSheetDialog = BottomSheetDialog(requireContext()) - bottomSheetDialog.setContentView(R.layout.bottom_sheet_filter) - bottomSheetDialog.show() - - var dateFrom=bottomSheetDialog.findViewById<View>(R.id.dateFromBSF)as EditText - var dateTo=bottomSheetDialog.findViewById<View>(R.id.dateToBSF) as EditText - var location=bottomSheetDialog.findViewById<View>(R.id.locationBSF) as EditText - var filter = bottomSheetDialog.findViewById<View>(R.id.btnBSFFilter) as Button - - - filter.setOnClickListener { - //povezati sa back-om - - - } - } - private fun showBottomSheetSort() { - var bottomSheetDialogSort: BottomSheetDialog - bottomSheetDialogSort = BottomSheetDialog(requireContext()) - bottomSheetDialogSort.setContentView(R.layout.bottom_sheet_sort) - bottomSheetDialogSort.show() - - } }
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPostsByLocation.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPostsByLocation.kt index f9accc8..6823f42 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPostsByLocation.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentShowPostsByLocation.kt @@ -59,9 +59,7 @@ class FragmentShowPostsByLocation : Fragment() { data.enqueue(object : Callback<MutableList<PostPreview>> { override fun onResponse(call: Call<MutableList<PostPreview>>, response: Response<MutableList<PostPreview>>) { if (response.body() == null) { - Toast.makeText( - activity, "get all null", Toast.LENGTH_LONG - ).show(); + return } 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 index 45fbcba..1032ee3 100644 --- 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 @@ -3,7 +3,6 @@ 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 @@ -12,19 +11,17 @@ import android.widget.EditText import android.widget.ImageView import android.widget.TextView import android.widget.Toast +import androidx.fragment.app.Fragment 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 @@ -131,15 +128,17 @@ class FragmentSinglePostComments : Fragment() { }) } else{ + newComment.replies= mutableListOf() (adapterComments as CommentsAdapter).items.add(0,newComment) recyclerViewComments?.adapter=adapterComments addedComment() + } } fun buildRecyclerViewComments(){ recyclerViewComments=commentsContainer - adapterComments=CommentsAdapter(comments as MutableList<CommentSend>,requireActivity()) + adapterComments=CommentsAdapter(comments as MutableList<CommentSend>,requireActivity(),this@FragmentSinglePostComments) layoutManagerComments= LinearLayoutManager(requireActivity(),LinearLayoutManager.VERTICAL,false) recyclerViewComments!!.setHasFixedSize(false) recyclerViewComments!!.layoutManager=layoutManagerComments 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 index 877fbc4..6e37052 100644 --- 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 @@ -1,21 +1,24 @@ package com.example.brzodolokacije.Fragments +import android.content.Intent 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.Button import android.widget.ImageView import android.widget.TextView -import android.widget.Toast +import androidx.core.view.isGone +import androidx.core.view.isVisible import androidx.fragment.app.Fragment +import com.example.brzodolokacije.Activities.ActivitySinglePost +import com.example.brzodolokacije.Activities.NavigationActivity 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 @@ -30,6 +33,13 @@ class FragmentSinglePostDescription : Fragment() { private lateinit var star5:ImageView private var starNumber:Number=0 private lateinit var post:PostPreview + private lateinit var parentact:ActivitySinglePost + private lateinit var ocenitext:TextView + private lateinit var userid:String + private lateinit var del:TextView + private lateinit var delbtn:Button + private lateinit var delbtnY:Button + private lateinit var delbtnN:Button override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -37,7 +47,7 @@ class FragmentSinglePostDescription : Fragment() { ): View? { var view=inflater.inflate(R.layout.fragment_single_post_description, container, false) - + parentact = activity as ActivitySinglePost //uzmi post prosledjen iz single post @@ -45,10 +55,18 @@ class FragmentSinglePostDescription : Fragment() { 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() + + del=view.findViewById(R.id.tvObrisi) + delbtn=view.findViewById(R.id.btnObrisi) + delbtnY=view.findViewById(R.id.btnObrisiY) + delbtnN=view.findViewById(R.id.btnObrisiN) + userid="" + ocenitext=view.findViewById(R.id.title) //setuj zvezdice star1=view.findViewById(R.id.rateStar1) star2=view.findViewById(R.id.rateStar2) @@ -57,15 +75,17 @@ class FragmentSinglePostDescription : Fragment() { star5=view.findViewById(R.id.rateStar5) setRatingListeners() + val alreadyrated= RatingReceive(starNumber.toInt(),post._id) requestAddRating(alreadyrated) - + toggleStarRatings() return view } fun setRatingListeners() { val emptyStar = R.drawable.ic_round_star_outline_24 val fullStar = R.drawable.ic_baseline_star_rate_24 + val offStar = R.drawable.ic_baseline_star_24 star1.setOnClickListener { //Toast.makeText(this,"kliknuta prva zvezdica",Toast.LENGTH_SHORT).show() @@ -77,7 +97,7 @@ class FragmentSinglePostDescription : Fragment() { starNumber=1 rate(starNumber) } - star1.setOnClickListener { + star2.setOnClickListener { //Toast.makeText(this,"kliknuta druga zvezdica",Toast.LENGTH_SHORT).show() star1.setImageResource(fullStar) star2.setImageResource(fullStar) @@ -87,7 +107,7 @@ class FragmentSinglePostDescription : Fragment() { starNumber=2 rate(starNumber) } - star1.setOnClickListener { + star3.setOnClickListener { //Toast.makeText(this,"kliknuta treca zvezdica",Toast.LENGTH_SHORT).show() star1.setImageResource(fullStar) star2.setImageResource(fullStar) @@ -97,8 +117,8 @@ class FragmentSinglePostDescription : Fragment() { starNumber=3 rate(starNumber) } - star1.setOnClickListener { - Toast.makeText(requireActivity(),"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show() + star4.setOnClickListener { + //Toast.makeText(requireActivity(),"kliknuta cetvrta zvezdica",Toast.LENGTH_SHORT).show() star1.setImageResource(fullStar) star2.setImageResource(fullStar) star3.setImageResource(fullStar) @@ -107,7 +127,7 @@ class FragmentSinglePostDescription : Fragment() { starNumber=4 rate(starNumber) } - star1.setOnClickListener { + star5.setOnClickListener { //Toast.makeText(this,"kliknuta peta zvezdica",Toast.LENGTH_SHORT).show() star1.setImageResource(fullStar) star2.setImageResource(fullStar) @@ -140,19 +160,54 @@ class FragmentSinglePostDescription : Fragment() { "--------------", 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) + parentact.updateratings(data.ratingscount,data.ratings) + if(rating.rating==0) { + val emptyStar = R.drawable.empty_star + val fullStar = R.drawable.ic_baseline_star_rate_24 + + when (data.myrating) { + 1 -> { + star1.setImageResource(fullStar) + star2.setImageResource(emptyStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + } + 2 -> { + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + } + 3 -> { + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + } + 4 -> { + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(fullStar) + star5.setImageResource(emptyStar) + } + 5 -> { + star1.setImageResource(fullStar) + star2.setImageResource(fullStar) + star3.setImageResource(fullStar) + star4.setImageResource(fullStar) + star5.setImageResource(fullStar) + } + else -> { + star1.setImageResource(emptyStar) + star2.setImageResource(emptyStar) + star3.setImageResource(emptyStar) + star4.setImageResource(emptyStar) + star5.setImageResource(emptyStar) + } } } /*Toast.makeText( @@ -171,4 +226,97 @@ class FragmentSinglePostDescription : Fragment() { } }) } + fun toggleStarRatings(){ + var token= SharedPreferencesHelper.getValue("jwt", requireActivity()).toString() + val api= RetrofitHelper.getInstance() + val request= api.getUserId("Bearer " + token) + request.enqueue(object : retrofit2.Callback<String> { + override fun onResponse(call: Call<String>, + response: Response<String> + ) { + if (response.body() == null) { + return + } + userid=response.body().toString() + Log.d("UID TEST",userid) + if(post.ownerId==userid){ + //val offStar = R.drawable.ic_baseline_star_24 + ocenitext.text="Vlasnik posta ne moze ocenjivati sebe" + /*star1.setImageResource(offStar) + star2.setImageResource(offStar) + star3.setImageResource(offStar) + star4.setImageResource(offStar) + star5.setImageResource(offStar)*/ + star1.isEnabled=false + star2.isEnabled=false + star3.isEnabled=false + star4.isEnabled=false + star5.isEnabled=false + + ocenitext.isVisible=false + ocenitext.isGone=true + star1.isVisible=false + star1.isGone=true + star2.isVisible=false + star2.isGone=true + star3.isVisible=false + star3.isGone=true + star4.isVisible=false + star4.isGone=true + star5.isVisible=false + star5.isGone=true + + delbtn.isGone=false + delbtn.setOnClickListener{ + del.isGone=false + delbtnY.isGone=false + delbtnN.isGone=false + delbtn.isGone=true + delbtnY.setOnClickListener { + deletePostreq() + } + delbtnN.setOnClickListener { + del.isGone=true + delbtnY.isGone=true + delbtnN.isGone=true + delbtn.isGone=false + } + } + + + } + } + + override fun onFailure(call: Call<String>, t: Throwable) { + + } + }) + + + } + + fun deletePostreq(){ + var token= SharedPreferencesHelper.getValue("jwt", requireActivity()).toString() + val api= RetrofitHelper.getInstance() + val request= api.DeletePost("Bearer " + token,post._id) + request.enqueue(object : retrofit2.Callback<String> { + override fun onResponse( + call: Call<String>, + response: Response<String> + ) { + if(response.isSuccessful){ + SharedPreferencesHelper.addValue("jwt",token,activity!!) + val intent= Intent(activity!!, NavigationActivity::class.java) + startActivity(intent) + activity!!.finish() + } + + } + + override fun onFailure(call: Call<String>, t: Throwable) { + + } + }) + } + }
\ 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 376517c..f2c817a 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 @@ -1,30 +1,37 @@ package com.example.brzodolokacije.Fragments import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher import android.util.Log -import androidx.fragment.app.Fragment +import android.view.KeyEvent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.AutoCompleteTextView +import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.example.brzodolokacije.Adapters.FollowersAdapter -import com.example.brzodolokacije.Adapters.ShowPostsHomePageAdapter -import com.example.brzodolokacije.Models.PostPreview import com.example.brzodolokacije.Models.UserReceive import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.android.material.button.MaterialButton import retrofit2.Call import retrofit2.Callback import retrofit2.Response + class FragmentUserFollowers : Fragment() { private lateinit var followers:MutableList<UserReceive> + private lateinit var searchedFollowers:MutableList<UserReceive> private lateinit var rvFollowers:RecyclerView private lateinit var userId:String private lateinit var showMy:String + private lateinit var searchBar:AutoCompleteTextView + private lateinit var searchButton:MaterialButton override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -37,6 +44,8 @@ class FragmentUserFollowers : Fragment() { userId = bundle!!.getString("userId").toString() showMy = bundle!!.getString("showMy").toString().trim() rvFollowers=view.findViewById(R.id.rvFragmentUserFollowers) + searchBar=view.findViewById(R.id.FragmentFollowersSearchBar) + searchButton=view.findViewById(R.id.FragmentFollowersSearchBButton) if(showMy=="yes"){ getFollowersWithoutId() @@ -44,9 +53,63 @@ class FragmentUserFollowers : Fragment() { else if(showMy=="no") { getFollowers() } + searchButton.setOnClickListener { + searchText() + } + 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 + }) + + searchBar.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { + searchText() + if(count==0) + if(showMy=="yes"){ + getFollowersWithoutId() + } + else if(showMy=="no") { + getFollowers() + } + } + + override fun afterTextChanged(s: Editable) { + } + }) return view } + fun searchText(){ + if(searchBar.text==null || searchBar.text.isNullOrEmpty() || searchBar.text.toString().trim()=="") + return + if(!this::followers.isInitialized) + return + var text=searchBar.text.toString().trim() + searchedFollowers= mutableListOf() + for(user in followers){ + if(user.username.contains(text)) + searchedFollowers.add(user) + } + rvFollowers.apply { + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) + adapter= FollowersAdapter(searchedFollowers,requireActivity()) + + } + + + + + } + fun getFollowers(){ val api = RetrofitHelper.getInstance() @@ -64,7 +127,7 @@ class FragmentUserFollowers : Fragment() { } followers = response.body()!!.toMutableList<UserReceive>() rvFollowers.apply { - layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) adapter= FollowersAdapter(followers,requireActivity()) } @@ -89,7 +152,7 @@ class FragmentUserFollowers : Fragment() { Log.d("MyFollowers","Successsssssssssssssssssssssssssssss") followers = response.body()!!.toMutableList<UserReceive>() rvFollowers.apply { - layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) adapter= FollowersAdapter(followers,requireActivity()) } } @@ -98,4 +161,13 @@ class FragmentUserFollowers : Fragment() { } }) } + override fun onResume() { + super.onResume() + if(showMy=="yes"){ + getFollowersWithoutId() + } + else if(showMy=="no") { + getFollowers() + } + } }
\ 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 9a78b6e..0508c13 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 @@ -1,11 +1,15 @@ package com.example.brzodolokacije.Fragments import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher import android.util.Log +import android.view.KeyEvent import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.AutoCompleteTextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.example.brzodolokacije.Adapters.FollowersAdapter @@ -13,6 +17,7 @@ import com.example.brzodolokacije.Models.UserReceive import com.example.brzodolokacije.R import com.example.brzodolokacije.Services.RetrofitHelper import com.example.brzodolokacije.Services.SharedPreferencesHelper +import com.google.android.material.button.MaterialButton import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -21,9 +26,12 @@ import retrofit2.Response class FragmentUserFollowing : Fragment() { private lateinit var following:MutableList<UserReceive> + private lateinit var searchedFollowing:MutableList<UserReceive> private lateinit var rvFollowing: RecyclerView private lateinit var userId:String private lateinit var showMy:String + private lateinit var searchBar: AutoCompleteTextView + private lateinit var searchButton: MaterialButton override fun onCreateView( @@ -36,15 +44,68 @@ class FragmentUserFollowing : Fragment() { userId = bundle!!.getString("userId").toString() showMy = bundle!!.getString("showMy").toString().trim() rvFollowing=view.findViewById(R.id.rvFragmentUserFollowing) - + searchBar=view.findViewById(R.id.FragmentFollowingSearchBar) + searchButton=view.findViewById(R.id.FragmentFollowingSearchBButton) if(showMy=="yes"){ getFollowingWithoutId() } else if(showMy=="no") { getFollowing() } + searchButton.setOnClickListener { + searchText() + } + 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 + }) + searchBar.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { + } + + override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { + searchText() + if(count==0) + if(showMy=="yes"){ + getFollowingWithoutId() + } + else if(showMy=="no") { + getFollowing() + } + } + + override fun afterTextChanged(s: Editable) { + } + }) return view } + fun searchText(){ + if(searchBar.text==null || searchBar.text.isNullOrEmpty() || searchBar.text.toString().trim()=="") + return + var text=searchBar.text.toString().trim() + if(!this::following.isInitialized) + return + searchedFollowing= mutableListOf() + for(user in following){ + if(user.username.contains(text)) + searchedFollowing.add(user) + } + rvFollowing.apply { + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) + adapter= FollowersAdapter(searchedFollowing,requireActivity()) + + } + + + + + } fun getFollowing(){ val api = RetrofitHelper.getInstance() @@ -58,7 +119,7 @@ class FragmentUserFollowing : Fragment() { Log.d("Following","Successsssssssssssssssssssssssssssss") following = response.body()!!.toMutableList<UserReceive>() rvFollowing.apply { - layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) adapter= FollowersAdapter(following,requireActivity()) } } @@ -80,7 +141,7 @@ class FragmentUserFollowing : Fragment() { Log.d("MyFollowings","Successsssssssssssssssssssssssssssss") following = response.body()!!.toMutableList<UserReceive>() rvFollowing.apply { - layoutManager= LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL,false) + layoutManager= LinearLayoutManager(activity, LinearLayoutManager.VERTICAL,false) adapter= FollowersAdapter(following,requireActivity()) } } @@ -90,4 +151,14 @@ class FragmentUserFollowing : Fragment() { }) } + override fun onResume() { + super.onResume() + if(showMy=="yes"){ + getFollowingWithoutId() + } + else if(showMy=="no") { + getFollowing() + } + } + }
\ 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 d6971c4..e132ec4 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 @@ -46,6 +46,7 @@ class FragmentUserPosts : Fragment() { private lateinit var posts : MutableList<PostPreview> private lateinit var rvPosts: RecyclerView private lateinit var addNewPost:TextView + var favourite=0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -64,6 +65,8 @@ class FragmentUserPosts : Fragment() { if(jwtString!=null) { var jwt: JWT = JWT(jwtString!!) var userId=jwt.getClaim("id").asString() + if(favourite==1) + bundle.putString("favourite","true") bundle.putString("id", userId) val userMapFragment = UserPostsMapFragment() userMapFragment.setArguments(bundle) @@ -77,9 +80,35 @@ class FragmentUserPosts : Fragment() { } rvPosts=view.findViewById(R.id.rvFragmentUserPostsPosts) as RecyclerView - getPosts() + if(this.arguments==null) + getPosts() + else + getFavouritePosts() return view } + fun getFavouritePosts(){ + val api = RetrofitHelper.getInstance() + val token= SharedPreferencesHelper.getValue("jwt", requireActivity()) + val data=api.getMyFavouritePosts("Bearer "+token) + + data.enqueue(object : Callback<MutableList<PostPreview>> { + override fun onResponse( + call: Call<MutableList<PostPreview>>, + response: Response<MutableList<PostPreview>> + ) { + if (response.body() == null) { + return + } + posts = response.body()!!.toMutableList<PostPreview>() + loadPosts() + favourite=1 + } + override fun onFailure(call: Call<MutableList<PostPreview>>, t: Throwable) { + + } + }) + + } fun getPosts(){ val api = RetrofitHelper.getInstance() 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 19b1bb5..c7d238c 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 @@ -1,10 +1,7 @@ package com.example.brzodolokacije.Interfaces import com.example.brzodolokacije.Models.* -import com.example.brzodolokacije.Models.Auth.JustMail -import com.example.brzodolokacije.Models.Auth.Login -import com.example.brzodolokacije.Models.Auth.Register -import com.example.brzodolokacije.Models.Auth.ResetPass +import com.example.brzodolokacije.Models.Auth.* import okhttp3.MultipartBody import okhttp3.RequestBody import okhttp3.ResponseBody @@ -57,13 +54,20 @@ interface IBackendApi { @GET("/api/user/posts") fun getMyPosts(@Header("Authorization") authHeader:String):Call<MutableList<PostPreview>> + @GET("/api/post/userFavouritePosts") + fun getMyFavouritePosts(@Header("Authorization") authHeader:String):Call<MutableList<PostPreview>> @GET("/api/post/locations/{id}/posts") suspend fun getPagedPosts(@Header("Authorization") authHeader: String, @Path("id") locationId:String, + @Query("filter") filter:Boolean, @Query("page") page:Int, @Query("sorttype") sorttype:Int, - @Query("filterdate") filterdate:Int + @Query("filterdate") filterdate:Int, + @Query("ratingFrom") ratingFrom:Int, + @Query("ratingTo") ratingTo:Int, + @Query("viewsFrom") viewsFrom:Int, + @Query("viewsTo") viewsTo:Int ):PagedPosts @POST("/api/message/add") fun sendMessage(@Header("Authorization") authHeader:String,@Body message:MessageSend):Call<Message> @@ -121,4 +125,13 @@ interface IBackendApi { @GET("/api/user/{newName}/changeMyName") fun changeMyName(@Header("Authorization") authHeader:String,@Path("newName") newName:String):Call<Boolean> + + @POST("/api/user/changePass") + fun changePass(@Header("Authorization") authHeader:String,@Body changePass:ChangePass):Call<Int> + @GET("/api/user/{username}/profile/stats") + fun getUserStatsFromUsername(@Header("Authorization") authHeader:String,@Path("username") username:String):Call<Statistics> + @GET("/api/auth/jwttoid") + fun getUserId(@Header("Authorization") authHeader:String):Call<String> + @DELETE("api/Post/posts/delete/{id}") + fun DeletePost(@Header("Authorization") authHeader:String,@Path("id") id:String):Call<String> }
\ 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 acce7b3..b996b12 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,7 +9,6 @@ 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 @@ -23,7 +22,6 @@ class MainActivity : AppCompatActivity() { val intent:Intent if(checkLoggedIn()) { - Notifications.makeChannel(this) intent = Intent(this, NavigationActivity::class.java) } else @@ -57,13 +55,14 @@ class MainActivity : AppCompatActivity() { override fun onResponse(call: Call<String?>, response: Response<String?>) { if(response.isSuccessful()){ val newToken=response.body().toString() - Toast.makeText( - applicationContext, token, Toast.LENGTH_LONG - ).show(); + SharedPreferencesHelper.addValue("jwt",newToken,this@MainActivity) }else{ if(response.errorBody()!=null) Toast.makeText(applicationContext, response.errorBody()!!.string(), Toast.LENGTH_LONG).show(); + intent= Intent(this@MainActivity, ActivityLoginRegister::class.java) + SharedPreferencesHelper.removeValue("jwt",this@MainActivity) + startActivity(intent) } diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/ChangePass.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/ChangePass.kt new file mode 100644 index 0000000..46957df --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/ChangePass.kt @@ -0,0 +1,6 @@ +package com.example.brzodolokacije.Models.Auth + +data class ChangePass( + var currentPass:String, + var newPass:String +) 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 8f07bca..3df1621 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 @@ -3,6 +3,7 @@ package com.example.brzodolokacije.Models import android.os.Parcelable import kotlinx.android.parcel.Parcelize import okhttp3.MultipartBody +import retrofit2.http.Query import java.time.LocalDateTime import java.util.* @@ -91,6 +92,29 @@ data class PagedPosts( data class SearchParams( var locationId: String, + var filter:Boolean, var sorttype:Int, - var filterdate:Int -)
\ No newline at end of file + var filterdate:Int, + var ratingFrom:Int, + var ratingTo:Int, + var viewsFrom:Int, + var viewsTo:Int, +) +/* +data class FilterSort( + //var posts: MutableList<PostPreview>, + var sort:Boolean, + var filter:Boolean, + + //var filterDateFrom:Date, + //var filterDateTo:Date, + var filterRatingFrom:Int, + var filterRatingTo:Int, + var filterViewsFrom:Int, + var filterViewsTo:Int, + + var sortLatest:Boolean, + var sortOldest:Boolean, + var sortBest:Boolean, + var sortMostViews:Boolean + )*/
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Statistics.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Statistics.kt new file mode 100644 index 0000000..4466e05 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Statistics.kt @@ -0,0 +1,18 @@ +package com.example.brzodolokacije.Models + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize +data class Statistics( + var totalViews:Int, + var numberOfPosts:Int, + var numberOfRatingsOnPosts:Int, + var averagePostRatingOnPosts:Double, + var monthlyViews:List<MonthlyViews>, + var numberOfFavouritePosts:Int +) +@Parcelize +data class MonthlyViews( + var month:Int, + var views:Int +):Parcelable + diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt index 6e282a9..072be55 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt @@ -34,5 +34,6 @@ data class UserReceive( var following:List<String>, var followingCount:Int, var postIds:List<Int>, - var postNumber:Int + var postNumber:Int, + var favourites:List<String>? )
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/LinePagerIndicatorDecoration.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/LinePagerIndicatorDecoration.kt new file mode 100644 index 0000000..31f03ab --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/LinePagerIndicatorDecoration.kt @@ -0,0 +1,111 @@ +import android.content.res.Resources +import android.graphics.Canvas +import android.graphics.Paint +import android.graphics.Rect +import android.view.View +import androidx.annotation.ColorInt +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.ItemDecoration + + +class LinePagerIndicatorDecoration( + radius: Int, + padding: Int, + indicatorHeight: Int, + @ColorInt colorInactive: Int, + @ColorInt colorActive: Int +) : + ItemDecoration() { + private val indicatorHeight: Int + private val indicatorItemPadding: Int + private val radius: Int + private val inactivePaint: Paint = Paint() + private val activePaint: Paint = Paint() + + init { + val strokeWidth: Float = Resources.getSystem().getDisplayMetrics().density * 1 + this.radius = radius + inactivePaint.setStrokeCap(Paint.Cap.ROUND) + inactivePaint.setStrokeWidth(strokeWidth) + inactivePaint.setStyle(Paint.Style.STROKE) + inactivePaint.setAntiAlias(true) + inactivePaint.setColor(colorInactive) + activePaint.setStrokeCap(Paint.Cap.ROUND) + activePaint.setStrokeWidth(strokeWidth) + activePaint.setStyle(Paint.Style.FILL) + activePaint.setAntiAlias(true) + activePaint.setColor(colorActive) + indicatorItemPadding = padding + this.indicatorHeight = indicatorHeight + } + + override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { + super.onDrawOver(c, parent, state) + val adapter = parent.adapter ?: return + val itemCount = adapter.itemCount + + // center horizontally, calculate width and subtract half from center + val totalLength = (radius * 2 * itemCount).toFloat() + val paddingBetweenItems = (Math.max(0, itemCount - 1) * indicatorItemPadding).toFloat() + val indicatorTotalWidth = totalLength + paddingBetweenItems + val indicatorStartX = (parent.width - indicatorTotalWidth) / 2f + + // center vertically in the allotted space + val indicatorPosY = parent.height - indicatorHeight / 2f + drawInactiveDots(c, indicatorStartX, indicatorPosY, itemCount) + val activePosition: Int + activePosition = if (parent.layoutManager is GridLayoutManager) { + (parent.layoutManager as GridLayoutManager?)!!.findFirstVisibleItemPosition() + } else if (parent.layoutManager is LinearLayoutManager) { + (parent.layoutManager as LinearLayoutManager?)!!.findFirstVisibleItemPosition() + } else { + // not supported layout manager + return + } + if (activePosition == RecyclerView.NO_POSITION) { + return + } + + // find offset of active page if the user is scrolling + val activeChild = parent.layoutManager!!.findViewByPosition(activePosition) + ?: return + drawActiveDot(c, indicatorStartX, indicatorPosY, activePosition) + } + + private fun drawInactiveDots( + c: Canvas, + indicatorStartX: Float, + indicatorPosY: Float, + itemCount: Int + ) { + // width of item indicator including padding + val itemWidth = (radius * 2 + indicatorItemPadding).toFloat() + var start = indicatorStartX + radius + for (i in 0 until itemCount) { + c.drawCircle(start, indicatorPosY, radius.toFloat(), inactivePaint) + start += itemWidth + } + } + + private fun drawActiveDot( + c: Canvas, indicatorStartX: Float, indicatorPosY: Float, + highlightPosition: Int + ) { + // width of item indicator including padding + val itemWidth = (radius * 2 + indicatorItemPadding).toFloat() + val highlightStart = indicatorStartX + radius + itemWidth * highlightPosition + c.drawCircle(highlightStart, indicatorPosY, radius.toFloat(), activePaint) + } + + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + super.getItemOffsets(outRect, view, parent, state) + outRect.bottom = indicatorHeight + } +}
\ No newline at end of file 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 index 882a1ae..665a48e 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/UserPostsMapFragment.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/UserPostsMapFragment.kt @@ -10,6 +10,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView +import androidx.core.content.ContextCompat import com.example.brzodolokacije.Activities.ActivitySinglePost import com.example.brzodolokacije.Fragments.FragmentProfile import com.example.brzodolokacije.Models.PostPreview @@ -40,13 +41,16 @@ class UserPostsMapFragment : Fragment() { map=view.findViewById(R.id.FragmentUserPostsMapMapView) as MapView backButton=view.findViewById(R.id.btnFragmentUserPostsBack) as ImageView map!!.setTileSource(TileSourceFactory.MAPNIK); + if(this.requireArguments().getString("other")!=null) + backButton!!.visibility=View.INVISIBLE + 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) + ?.replace(R.id.flNavigationFragment,fragmentProfile) ?.commit() //How to call fragment // val bundle = Bundle() @@ -70,7 +74,12 @@ class UserPostsMapFragment : Fragment() { var jwtString= SharedPreferencesHelper.getValue("jwt",requireActivity()) if(id==null) return - var data=api.getUsersPosts("Bearer "+jwtString,id!!) + var data:Call<MutableList<PostPreview>> + if(this.requireArguments().getString("favourite")==null) + data=api.getUsersPosts("Bearer "+jwtString,id!!) + else + data=api.getMyFavouritePosts("Bearer "+jwtString) + data.enqueue(object : retrofit2.Callback<MutableList<PostPreview>> { override fun onResponse(call: Call<MutableList<PostPreview>>, response: Response<MutableList<PostPreview>>) { @@ -83,6 +92,7 @@ class UserPostsMapFragment : Fragment() { val startMarker = Marker(map) startMarker.setPosition(GeoPoint(post.location.latitude,post.location.longitude)) startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM) + startMarker.icon= ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_location_on_24) if(flag){ flag=false map!!.controller.animateTo(GeoPoint(post.location.latitude,post.location.longitude)) 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 041eebb..ee7e924 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 @@ -175,7 +175,6 @@ class DBHelper : ) Log.d("main",cal.time.toString()) - readContact(userId) return msg } return null @@ -216,20 +215,23 @@ class DBHelper : return null } - fun getContacts(): MutableList<ChatPreview>? { + suspend fun getContacts(): MutableList<ChatPreview>? { + var mapChats:Map<Long,ChatPreview> + mapChats= mutableMapOf() onCreate(db) var sql="SELECT * FROM "+ CONTACTS_TABLE_NAME var cursor=db?.rawQuery(sql,null) if(cursor?.count!! >0){ - 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,cursor.getString(usernameIndex))) + var chat=ChatPreview(cursor.getString(userIdIndex),cursor.getInt(readIndex)==1,cursor.getString(usernameIndex)) + var lastMessage=getLastMessage(chat.userId)?.usableTimeStamp!!.timeInMillis + mapChats[lastMessage]=chat } - Log.d("main",contactList.size.toString()) - return contactList + var sorted=mapChats.toSortedMap(kotlin.Comparator { o1, o2 -> (o2-o1).toInt() }) + return ArrayList<ChatPreview>(sorted.values).toMutableList() } return null } @@ -242,10 +244,12 @@ class DBHelper : } fun readContact(userId: String){ + onCreate(db) var sql="UPDATE "+ CONTACTS_TABLE_NAME+" SET read=1 WHERE userId='"+userId+"'" db?.execSQL(sql) } fun unreadContact(userId: String){ + onCreate(db) var sql="UPDATE "+ CONTACTS_TABLE_NAME+" SET read=0 WHERE userId='"+userId+"'" db?.execSQL(sql) } 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 627d7c0..49d76c9 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/chat/SignalRListener.kt @@ -2,16 +2,20 @@ package com.example.brzodolokacije.chat import android.Manifest import android.app.Activity +import android.app.PendingIntent +import android.content.Intent 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.app.TaskStackBuilder 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.Activities.ChatActivityConversation import com.example.brzodolokacije.Models.Message import com.example.brzodolokacije.Models.MessageReceive import com.example.brzodolokacije.Models.UserReceive @@ -82,35 +86,42 @@ class SignalRListener private constructor(val activity: Activity){ if(activity.clickedChat?.userId==message.senderId){ activity.clickedChat?.requestMessages() } - activity.requestNewMessages() + activity.onRefresh() } - 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") + if(ContextCompat.checkSelfPermission(activity, + Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED || SharedPreferencesHelper.getValue("notifications",activity)=="true"){ + //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 resultIntent = Intent(activity, ChatActivityConversation::class.java) + resultIntent.putExtra("userId",user._id) + resultIntent.putExtra("username",user.username) + resultIntent.putExtra("pfp",user.pfp?._id) + val resultPendingIntent: PendingIntent? = TaskStackBuilder.create(activity).run { + addNextIntentWithParentStack(resultIntent) + getPendingIntent(0, + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + } + val notificationBuilder = NotificationCompat.Builder(activity, Notifications.CHANNEL_ID) .setSmallIcon(R.drawable.ic_round_chat_24) .setAutoCancel(true) @@ -120,6 +131,7 @@ class SignalRListener private constructor(val activity: Activity){ .setContentTitle(user.username) .setContentText(message.messagge) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + .setContentIntent(resultPendingIntent) val notificationManager = NotificationManagerCompat.from(activity) val notification = notificationBuilder.build() notificationManager.notify(NotificationID.iD, notification) diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt index cee39ce..6a8fec2 100644 --- a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/paging/SearchPostsPagingSource.kt @@ -21,8 +21,9 @@ class SearchPostsPagingSource( val page=params.key?:0 val token=SharedPreferencesHelper.getValue("jwt", activity) return try{ - val response=backend.getPagedPosts("Bearer "+token,searchParams.locationId, - page,searchParams.sorttype,searchParams.filterdate + val response=backend.getPagedPosts("Bearer "+token,searchParams.locationId,searchParams.filter, + page,searchParams.sorttype,searchParams.filterdate,searchParams.ratingFrom,searchParams.ratingTo, + searchParams.viewsFrom,searchParams.viewsTo ) Log.d("main","stranicenje: "+page.toString()) LoadResult.Page( diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_filter.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_filter.xml index 00b22aa..1e37cbb 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_filter.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_filter.xml @@ -5,6 +5,6 @@ android:viewportWidth="24" android:viewportHeight="24"> <path - android:fillColor="#FF093A4C" + android:fillColor="#737374" android:pathData="M11 18c-0.28 0-0.52-0.1-0.71-0.29C10.09 17.52 10 17.28 10 17c0-0.28 0.1-0.52 0.29-0.71C10.48 16.09 10.72 16 11 16h2c0.28 0 0.52 0.1 0.71 0.29C13.91 16.48 14 16.72 14 17c0 0.28-0.1 0.52-0.29 0.71C13.52 17.91 13.28 18 13 18h-2ZM4 8C3.72 8 3.48 7.9 3.29 7.71 3.09 7.52 3 7.28 3 7c0-0.28 0.1-0.52 0.29-0.71C3.48 6.09 3.72 6 4 6h16c0.28 0 0.52 0.1 0.71 0.29C20.91 6.48 21 6.72 21 7c0 0.28-0.1 0.52-0.29 0.71C20.52 7.91 20.28 8 20 8H4Zm3 5c-0.28 0-0.52-0.1-0.71-0.29C6.09 12.52 6 12.28 6 12c0-0.28 0.1-0.52 0.29-0.71C6.48 11.09 6.72 11 7 11h10c0.28 0 0.52 0.1 0.71 0.29C17.91 11.48 18 11.72 18 12c0 0.28-0.1 0.52-0.29 0.71C17.52 12.91 17.28 13 17 13H7Z"/> </vector>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_sort.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_sort.xml index fe93f22..d5a2cb0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_sort.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_sort.xml @@ -5,7 +5,7 @@ android:viewportWidth="24" android:viewportHeight="24"> <path - android:strokeColor="#FF093A4C" + android:strokeColor="#737374" android:strokeWidth="1.5" android:strokeLineCap="round" android:strokeLineJoin="round" diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_post_red_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_post_red_24.xml new file mode 100644 index 0000000..111c9a1 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_add_post_red_24.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="#FC3636" + 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="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml new file mode 100644 index 0000000..a278444 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_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,4h-1V2h-2v2H8V2H6v2H5C3.89,4 3.01,4.9 3.01,6L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V6C21,4.9 20.1,4 19,4zM19,20H5V10h14V20zM9,14H7v-2h2V14zM13,14h-2v-2h2V14zM17,14h-2v-2h2V14zM9,18H7v-2h2V18zM13,18h-2v-2h2V18zM17,18h-2v-2h2V18z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_close_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_close_24.xml index 42a6279..3290245 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_close_24.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_close_24.xml @@ -1,4 +1,4 @@ -<vector android:height="24dp" android:tint="#666666" +<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,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_download_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_download_24.xml new file mode 100644 index 0000000..2815149 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_download_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="M5,20h14v-2H5V20zM19,9h-4V3H9v6H5l7,7L19,9z"/> +</vector> 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 index 84df34b..2dbc440 100644 --- 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 @@ -1,4 +1,4 @@ -<vector android:height="24dp" android:tint="#E52121" +<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,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"/> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_insert_photo_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_insert_photo_24.xml new file mode 100644 index 0000000..238eb8c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_insert_photo_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="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_multiple_images_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_multiple_images_24.xml new file mode 100644 index 0000000..0dbac0c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_multiple_images_24.xml @@ -0,0 +1,5 @@ +<vector android:height="24dp" android:tint="@color/white" + 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,2L4,2c-1.11,0 -2,0.9 -2,2v10h2L4,4h10L14,2zM18,6L8,6c-1.11,0 -2,0.9 -2,2v10h2L8,8h10L18,6zM20,10h-8c-1.11,0 -2,0.9 -2,2v8c0,1.1 0.89,2 2,2h8c1.1,0 2,-0.9 2,-2v-8c0,-1.1 -0.9,-2 -2,-2z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_post_add_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_post_add_24.xml index 32f0448..aa413e9 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_post_add_24.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_post_add_24.xml @@ -1,4 +1,4 @@ -<vector android:height="24dp" android:tint="#274352" +<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="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z"/> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_white_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_white_24.xml new file mode 100644 index 0000000..4cf0a52 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_send_white_24.xml @@ -0,0 +1,5 @@ +<vector android:autoMirrored="true" android:height="24dp" + 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_baseline_star_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_24.xml new file mode 100644 index 0000000..88f8d7a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_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,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml new file mode 100644 index 0000000..d532b23 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_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="M22,9.24l-7.19,-0.62L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27L18.18,21l-1.63,-7.03L22,9.24zM12,15.4V6.1l1.71,4.04l4.38,0.38l-3.32,2.88l1,4.28L12,15.4z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml index cdafe07..e6a963c 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_rate_24.xml @@ -1,5 +1,5 @@ -<vector android:height="24dp" android:tint="#F1DB24" +<vector android:height="20dp" android:tint="#F1DB24" android:viewportHeight="24" android:viewportWidth="24" - android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="@android:color/white" android:pathData="M14.43,10l-2.43,-8l-2.43,8l-7.57,0l6.18,4.41l-2.35,7.59l6.17,-4.69l6.18,4.69l-2.35,-7.59l6.17,-4.41z"/> </vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_a_photo_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_a_photo_24.xml new file mode 100644 index 0000000..db18015 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_a_photo_24.xml @@ -0,0 +1,5 @@ +<vector android:height="35dp" android:tint="#747474" + android:viewportHeight="24" android:viewportWidth="24" + android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M21,6h-3.17L16,4h-6v2h5.12l1.83,2L21,8v12L5,20v-9L3,11v9c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L23,8c0,-1.1 -0.9,-2 -2,-2zM8,14c0,2.76 2.24,5 5,5s5,-2.24 5,-5 -2.24,-5 -5,-5 -5,2.24 -5,5zM13,11c1.65,0 3,1.35 3,3s-1.35,3 -3,3 -3,-1.35 -3,-3 1.35,-3 3,-3zM5,6h3L8,4L5,4L5,1L3,1v3L0,4v2h3v3h2z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_photo_alternate_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_photo_alternate_24.xml new file mode 100644 index 0000000..6ab0441 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_add_photo_alternate_24.xml @@ -0,0 +1,5 @@ +<vector android:height="35dp" android:tint="#747474" + android:viewportHeight="24" android:viewportWidth="24" + android:width="35dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="@android:color/white" android:pathData="M18,20L4,20L4,6h9L13,4L4,4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-9h-2v9zM10.21,16.83l-1.96,-2.36L5.5,18h11l-3.54,-4.71zM20,4L20,1h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0L20,6h3L23,4h-3z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_camera_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_camera_24.xml new file mode 100644 index 0000000..155c4e3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_camera_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.25,2.26l-0.08,-0.04 -0.01,0.02C13.46,2.09 12.74,2 12,2 6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10c0,-4.75 -3.31,-8.72 -7.75,-9.74zM19.41,9h-7.99l2.71,-4.7c2.4,0.66 4.35,2.42 5.28,4.7zM13.1,4.08L10.27,9l-1.15,2L6.4,6.3C7.84,4.88 9.82,4 12,4c0.37,0 0.74,0.03 1.1,0.08zM5.7,7.09L8.54,12l1.15,2L4.26,14C4.1,13.36 4,12.69 4,12c0,-1.85 0.64,-3.55 1.7,-4.91zM4.59,15h7.98l-2.71,4.7c-2.4,-0.67 -4.34,-2.42 -5.27,-4.7zM10.9,19.91L14.89,13l2.72,4.7C16.16,19.12 14.18,20 12,20c-0.38,0 -0.74,-0.04 -1.1,-0.09zM18.3,16.91l-4,-6.91h5.43c0.17,0.64 0.27,1.31 0.27,2 0,1.85 -0.64,3.55 -1.7,4.91z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_star_border_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_star_border_24.xml new file mode 100644 index 0000000..458d104 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_outline_star_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="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,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/ic_round_grid_view_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_grid_view_24.xml new file mode 100644 index 0000000..63fadd8 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_grid_view_24.xml @@ -0,0 +1,8 @@ +<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="M5,11h4c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2H5C3.9,3 3,3.9 3,5v4C3,10.1 3.9,11 5,11z"/> + <path android:fillColor="@android:color/white" android:pathData="M5,21h4c1.1,0 2,-0.9 2,-2v-4c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v4C3,20.1 3.9,21 5,21z"/> + <path android:fillColor="@android:color/white" android:pathData="M13,5v4c0,1.1 0.9,2 2,2h4c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2h-4C13.9,3 13,3.9 13,5z"/> + <path android:fillColor="@android:color/white" android:pathData="M15,21h4c1.1,0 2,-0.9 2,-2v-4c0,-1.1 -0.9,-2 -2,-2h-4c-1.1,0 -2,0.9 -2,2v4C13,20.1 13.9,21 15,21z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_view_list_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_view_list_24.xml new file mode 100644 index 0000000..b4ff51e --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_round_view_list_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="M4,14h2c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v2C3,13.55 3.45,14 4,14zM4,19h2c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1H4c-0.55,0 -1,0.45 -1,1v2C3,18.55 3.45,19 4,19zM4,9h2c0.55,0 1,-0.45 1,-1V6c0,-0.55 -0.45,-1 -1,-1H4C3.45,5 3,5.45 3,6v2C3,8.55 3.45,9 4,9zM9,14h11c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1H9c-0.55,0 -1,0.45 -1,1v2C8,13.55 8.45,14 9,14zM9,19h11c0.55,0 1,-0.45 1,-1v-2c0,-0.55 -0.45,-1 -1,-1H9c-0.55,0 -1,0.45 -1,1v2C8,18.55 8.45,19 9,19zM8,6v2c0,0.55 0.45,1 1,1h11c0.55,0 1,-0.45 1,-1V6c0,-0.55 -0.45,-1 -1,-1H9C8.45,5 8,5.45 8,6z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_total_views.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_total_views.xml new file mode 100644 index 0000000..3b4e7d5 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_total_views.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,6.5c3.79,0 7.17,2.13 8.82,5.5 -1.65,3.37 -5.02,5.5 -8.82,5.5S4.83,15.37 3.18,12C4.83,8.63 8.21,6.5 12,6.5m0,-2C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,9.5c1.38,0 2.5,1.12 2.5,2.5s-1.12,2.5 -2.5,2.5 -2.5,-1.12 -2.5,-2.5 1.12,-2.5 2.5,-2.5m0,-2c-2.48,0 -4.5,2.02 -4.5,4.5s2.02,4.5 4.5,4.5 4.5,-2.02 4.5,-4.5 -2.02,-4.5 -4.5,-4.5z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_alert_background.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_alert_background.xml new file mode 100644 index 0000000..e081091 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_alert_background.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="20dp"/> + <solid android:color="#FFFCFCFC"></solid> +<!-- <padding--> +<!-- android:left="10dp"--> +<!-- android:top="5dp"--> +<!-- android:right="10dp"--> +<!-- android:bottom="5dp" >--> + +<!-- </padding>--> +</shape> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml index dad1a7a..cbf3e2c 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/view_top_corner_radius.xml @@ -2,8 +2,8 @@ <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFFFF"/> <corners - android:topLeftRadius="10dp" - android:topRightRadius="10dp" + android:topLeftRadius="15dp" + android:topRightRadius="15dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml index 405c221..dabb494 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_add_post.xml @@ -6,25 +6,30 @@ android:layout_height="match_parent" tools:context=".Activities.ActivityAddPost"> - <ImageSwitcher + <ImageView android:id="@+id/isActivityAddPostSwitcher" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="0dp" - android:elevation="10dp" - app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostUploadFromGallery" + android:scaleType="fitCenter" + app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddLocation" 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" + app:layout_constraintVertical_bias="1.0" + tools:ignore="ImageContrastCheck" + tools:srcCompat="@tools:sample/avatars"/> <Button android:id="@+id/nextImage" android:layout_width="78dp" android:layout_height="0dp" + android:elevation="15dp" android:background="@drawable/rounded_transparent_button" android:gravity="right" android:padding="30dp" app:icon="@drawable/ic_baseline_arrow_forward" - app:iconTint="#072242" + app:iconTint="@color/grey" app:layout_constraintBottom_toBottomOf="@+id/isActivityAddPostSwitcher" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -34,12 +39,12 @@ android:id="@+id/previousImage" android:layout_width="70dp" android:layout_height="0dp" - + android:elevation="15dp" android:background="@drawable/rounded_transparent_button" android:gravity="left" android:padding="30dp" app:icon="@drawable/ic_baseline_arrow_back" - app:iconTint="#0E283C" + app:iconTint="@color/grey" app:layout_constraintBottom_toBottomOf="@+id/isActivityAddPostSwitcher" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -53,7 +58,7 @@ android:text="Otvori galeriju" android:visibility="invisible" app:cornerRadius="20dp" - app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddLocation" + app:layout_constraintBottom_toTopOf="@+id/llTags" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.497" app:layout_constraintStart_toStartOf="parent" /> @@ -68,7 +73,7 @@ android:drawableLeft="@drawable/ic_baseline_location_on_24" android:text="Dodaj lokaciju" android:textColor="#757471" - app:layout_constraintBottom_toTopOf="@+id/tvActivityAddPostDescriptiontext" + app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddTag" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.074" app:layout_constraintStart_toStartOf="parent" /> @@ -102,24 +107,25 @@ <EditText android:id="@+id/etActivityAddPostDescription" android:layout_width="match_parent" - android:layout_height="50dp" + android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:ems="10" - android:hint="Reykjavik, Iceland" - android:inputType="textEmailAddress" + android:maxLines="100" + android:minHeight="50dp" android:visibility="gone" - app:layout_constraintBottom_toTopOf="@+id/llTags" + android:inputType="textCapSentences|textMultiLine" + app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostPost" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> <Button android:id="@+id/btnActivityAddPostPost" - android:layout_width="250dp" - android:layout_height="40dp" + android:layout_width="match_parent" + android:layout_marginHorizontal="16dp" + android:layout_height="45dp" android:layout_marginBottom="12dp" - android:background="@drawable/rounded_cyan_button" - android:backgroundTint="#1C789A" + style="@style/imageViewRoundedEdge" android:text="Objavi" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -148,7 +154,7 @@ android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:orientation="horizontal" - app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddTag" + app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostAddLocation" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"></LinearLayout> @@ -157,12 +163,15 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="28dp" - android:hint="Planina,Reka,Park..." + android:hint="Planina, Reka, Park..." + android:inputType="text" android:maxLength="12" android:minHeight="48dp" + android:singleLine="true" android:visibility="gone" - app:layout_constraintBottom_toTopOf="@+id/btnActivityAddPostPost" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintBottom_toBottomOf="@+id/btnActivityAddPostAddTag" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/btnActivityAddPostAddTag" /> <Button android:id="@+id/btnActivityAddPostAddTag" @@ -175,7 +184,7 @@ android:text="Dodaj tag" android:textColor="#757471" - app:layout_constraintBottom_toTopOf="@+id/acTags" + app:layout_constraintBottom_toTopOf="@+id/tvActivityAddPostDescriptiontext" app:layout_constraintStart_toStartOf="parent" /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml index cb2c8dc..f46d6bd 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_capture_post.xml @@ -8,9 +8,8 @@ <ImageView android:id="@+id/ivActivityCapturePostImage" - android:layout_width="413dp" + android:layout_width="match_parent" android:layout_height="0dp" - android:layout_marginTop="4dp" android:scaleType="fitCenter" app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostCapture" app:layout_constraintEnd_toEndOf="parent" @@ -22,6 +21,49 @@ tools:srcCompat="@tools:sample/avatars" /> <Button + android:id="@+id/nextImage" + android:layout_width="78dp" + android:layout_height="0dp" + android:background="@drawable/rounded_transparent_button" + android:gravity="right" + android:padding="30dp" + app:icon="@drawable/ic_baseline_arrow_forward" + app:iconTint="@color/grey" + app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostCapture" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:ignore="SpeakableTextPresentCheck" /> + + <Button + android:id="@+id/previousImage" + android:layout_width="70dp" + android:layout_height="0dp" + android:background="@drawable/rounded_transparent_button" + android:gravity="left" + android:padding="30dp" + app:icon="@drawable/ic_baseline_arrow_back" + app:iconTint="@color/grey" + app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostCapture" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:ignore="SpeakableTextPresentCheck" /> + <com.google.android.material.button.MaterialButton + android:id="@+id/btnActivityCapturePostCaptureVisible1" + android:layout_width="50dp" + android:layout_height="wrap_content" + android:stateListAnimator="@null" + android:layout_margin="5dp" + android:elevation="10dp" + app:backgroundTint="#00FFFFFF" + app:icon="@drawable/ic_baseline_add_a_photo_24" + app:iconGravity="textEnd" + app:iconSize="40dp" + app:iconTint="#1C7696" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + android:visibility="invisible"/> + + <Button android:id="@+id/btnActivityCapturePostCapture" android:layout_width="68dp" android:layout_height="15dp" @@ -113,8 +155,8 @@ <com.google.android.material.button.MaterialButton android:id="@+id/btnActivityCapturePostCaptureVisible" - android:layout_width="50dp" - android:layout_height="wrap_content" + android:layout_width="40dp" + android:layout_height="40dp" android:stateListAnimator="@null" app:backgroundTint="#00FFFFFF" app:icon="@drawable/ic_baseline_add_a_photo_24" @@ -123,8 +165,10 @@ app:iconTint="#1C7696" app:layout_constraintBottom_toTopOf="@+id/btnActivityCapturePostCapture" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.48" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.503" /> <LinearLayout android:id="@+id/llTagsCap" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_password.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_password.xml new file mode 100644 index 0000000..1ef0be6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_change_password.xml @@ -0,0 +1,179 @@ +<?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.ActivityChangePassword"> + + <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/tvActivityChangePasswordBack" + 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 lozinku" + 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/tvActivityChangePasswordBack"> + + <ImageView + + android:id="@+id/tvActivityChangeUserPasswordProfilePicture" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:elevation="10dp" + android:scaleType="centerCrop" + android:src="@mipmap/ic_launcher_round" + tools:ignore="ContentDescription" /> + + + </androidx.cardview.widget.CardView> + + <TextView + android:id="@+id/changeDataOldPassword" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="60dp" + android:text="Trenutna lozinka" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.003" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile" /> + + <EditText + android:id="@+id/tvActivityChangePasswordCurrentPass" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Unesi trenutnu lozinku" + android:inputType="textPassword" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataOldPassword" /> + + <TextView + android:id="@+id/tvActivityChangePasswordNewPassText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + + android:layout_marginTop="20dp" + android:text="Nova lozinka" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/btnActivityChangePasswordForgottenPass" /> + + <EditText + android:id="@+id/tvActivityChangePasswordNewPass" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Unesi novu lozinku" + android:inputType="textPassword" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangePasswordNewPassText" /> + + <Button + android:id="@+id/ActivityChangePasswordChangePassword" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="Izmeni lozinku" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:shapeAppearanceOverlay="@style/Circular" /> + + <TextView + android:id="@+id/btnActivityChangePasswordNewError" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ErrorMessage" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangePasswordNewPass" /> + + <TextView + android:id="@+id/btnActivityChangePasswordForgottenPass" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + android:visibility="invisible" + android:text="Zaboravljena lozinka?" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangePasswordCurrentPass" /> + + + <TextView + android:id="@+id/changeDataNewPasswordConfirmInputt" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="40dp" + android:layout_marginEnd="270dp" + android:text="Potvrdi novu lozinku" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvActivityChangePasswordNewPass" /> + + <EditText + android:id="@+id/ActivityChangePasswordNewPasswordConfirm" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Unesi novu lozinku" + android:inputType="textPassword" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/changeDataNewPasswordConfirmInputt" /> + + <TextView + android:id="@+id/btnActivityChangePasswordConfirmError" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:hint="ErrorMessage" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/ActivityChangePasswordNewPasswordConfirm" /> + + <TextView + android:id="@+id/ActivityChangePasswordOldError" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="ErrorMessage" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/btnActivityChangePasswordForgottenPass" /> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file 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 index 2ade677..648e4ef 100644 --- 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 @@ -126,19 +126,6 @@ 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 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 0b4a589..3b92058 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat.xml @@ -6,18 +6,6 @@ android:layout_height="match_parent" tools:context=".Activities.ChatActivity"> - <ImageButton - android:id="@+id/addNewMessage" - android:layout_width="60dp" - android:layout_height="60dp" - android:clickable="true" - android:elevation="50dp" - android:focusable="true" - android:backgroundTint="@color/unfollow" - android:src="@drawable/ic_baseline_add_message_24" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" /> - <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:id="@+id/llHeader" @@ -61,23 +49,27 @@ <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeContainer" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginTop="8dp" + android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toBottomOf="@+id/llHeader" - app:layout_constraintVertical_bias="1.0" - tools:layout_editor_absoluteX="-27dp"> + app:layout_constraintTop_toBottomOf="@id/llHeader" + app:layout_constraintVertical_bias="0.0" + tools:layout_editor_absoluteX="0dp"> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/rvMain" + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="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="wrap_content" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + </androidx.recyclerview.widget.RecyclerView> + </androidx.constraintlayout.widget.ConstraintLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> + </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_chat_conversation.xml index 4dcab31..f6b767c 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 @@ -30,6 +30,7 @@ <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:id="@+id/llHeader" + android:clickable="true" android:layout_height="50dp"> <ImageView android:id="@+id/ivUserImage" @@ -44,34 +45,9 @@ 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> @@ -92,16 +68,19 @@ </androidx.recyclerview.widget.RecyclerView> </androidx.constraintlayout.widget.ConstraintLayout> +<androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content"> <androidx.cardview.widget.CardView android:id="@+id/cvParentMessageEdit" - android:layout_width="match_parent" - android:layout_height="40dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1" + android:minHeight="40dp" android:layout_marginBottom="5dp" - android:layout_marginStart="16dp" - android:layout_marginTop="10dp" - android:layout_marginEnd="16dp" - android:elevation="0dp" + android:layout_marginHorizontal="10dp" + android:elevation="16dp" app:cardCornerRadius="20dp"> @@ -109,24 +88,37 @@ android:id="@+id/etNewMessage" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/rounded_white_button_login" - android:hint=" poruka" - android:inputType="textPersonName" - android:paddingLeft="15dp" + android:backgroundTint="@color/white" + android:hint="Ukucajte poruku..." + android:paddingLeft="10dp" tools:ignore="TouchTargetSizeCheck" - android:autofillHints="emailAddress"/> + android:inputType="textCapSentences|textMultiLine"/> + + </androidx.cardview.widget.CardView> + <androidx.cardview.widget.CardView + android:id="@+id/cvParentSendButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:minHeight="40dp" + android:backgroundTint="@color/purple_500" + android:layout_marginBottom="5dp" + android:layout_marginEnd="5dp" + android:elevation="16dp" + app:cardCornerRadius="20dp"> + <ImageButton android:id="@+id/btnSendMessage" android:layout_width="25dp" android:layout_height="25dp" - android:layout_gravity="right|center_vertical" - android:scaleType="centerCrop" - android:layout_marginEnd="10dp" + android:layout_gravity="center" + android:layout_margin="10dp" android:background="@null" - android:src="@drawable/post_comment" + android:scaleType="fitCenter" + android:src="@drawable/ic_baseline_send_white_24" app:cornerRadius="16dp" tools:ignore="SpeakableTextPresentCheck" /> - </androidx.cardview.widget.CardView> +</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password.xml index 5841b49..95545c2 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password.xml @@ -5,10 +5,12 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activities.ActivityForgottenPassword"> - +<androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> <LinearLayout - android:layout_width="399dp" - android:layout_height="556dp" + android:layout_width="350dp" + android:layout_height="570dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -71,5 +73,6 @@ android:layout_height="30dp" /> </LinearLayout> +</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password_verify.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password_verify.xml index c652469..0b8b7f0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password_verify.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password_verify.xml @@ -6,8 +6,11 @@ android:layout_height="match_parent" tools:context=".Activities.ActivityForgottenPassword"> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> <LinearLayout - android:layout_width="398dp" + android:layout_width="350dp" android:layout_height="match_parent" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" @@ -102,5 +105,6 @@ android:layout_height="30dp" /> </LinearLayout> + </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml index 0051893..6cb0f4e 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_maps.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Activities.MapsActivity"> + <org.osmdroid.views.MapView android:id="@+id/ActivityMapsMapView" android:layout_width="fill_parent" @@ -13,8 +14,7 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - /> - + app:layout_constraintTop_toTopOf="parent" /> <com.google.android.material.floatingactionbutton.FloatingActionButton @@ -22,9 +22,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" + android:layout_marginEnd="32dp" + android:layout_marginBottom="32dp" android:backgroundTint="#FFFFFF" - android:layout_marginRight="10dp" - android:layout_marginBottom="80dp" android:clickable="true" android:focusable="true" android:tint="#FFFFFF" @@ -39,17 +39,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" - android:layout_marginBottom="80dp" - android:layout_marginLeft="10dp" + android:layout_marginStart="32dp" + android:layout_marginBottom="32dp" android:backgroundTint="#FFFFFF" android:clickable="true" android:focusable="true" android:tint="#FFFFFF" + android:visibility="invisible" app:layout_constraintBottom_toBottomOf="@+id/ActivityMapsMapView" app:layout_constraintStart_toStartOf="parent" app:rippleColor="#FFFFFF" - app:srcCompat="@drawable/ic_baseline_check_24" - android:visibility="invisible"/> + app:srcCompat="@drawable/ic_baseline_check_24" /> <androidx.cardview.widget.CardView android:id="@+id/ActivityMapsCardViewSearch" @@ -69,7 +69,7 @@ android:id="@+id/ActivityMapsSearchBar" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/rounded_white_button_login" + android:background="@drawable/rounded_picture_background" android:hint=" Pretraga" android:inputType="textPersonName" android:paddingLeft="15dp" /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml index afe1bbf..f86ba9e 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml @@ -19,10 +19,11 @@ <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottomNavigationView" android:layout_width="match_parent" - android:layout_height="75dp" + android:layout_height="60dp" + app:labelVisibilityMode="unlabeled" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:menu="@menu/bottom_nav_menu"/> + app:menu="@menu/bottom_nav_menu" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_opened_images.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_opened_images.xml new file mode 100644 index 0000000..53bed93 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_opened_images.xml @@ -0,0 +1,48 @@ +<?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=".Activities.ActivityOpenedImages" + android:background="@color/design_default_color_background"> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="50dp" + android:elevation="5dp" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + android:background="@color/unfollow_transparent" + android:id="@+id/clImageHeader"> + + <ImageButton + android:id="@+id/btnBackToPost" + android:layout_width="50dp" + android:layout_height="50dp" + android:background="@null" + android:src="@drawable/ic_baseline_arrow_back" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageButton + android:id="@+id/btnDownload" + android:layout_width="50dp" + android:layout_height="50dp" + android:background="@null" + android:src="@drawable/ic_baseline_download_24" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:id="@+id/rvParent"> + + <androidx.recyclerview.widget.RecyclerView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/rvImages"/> + </androidx.appcompat.widget.LinearLayoutCompat> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ 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 cf5327a..fd7c119 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,196 +1,266 @@ <?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" - android:orientation="vertical" +<androidx.swiperefreshlayout.widget.SwipeRefreshLayout 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" + tools:context=".Activities.ActivitySinglePost" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto" - tools:context=".Activities.ActivitySinglePost"> - - <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" - 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_toTopOf="parent" - app:layout_constraintVertical_bias="0.0" /> + android:elevation="10dp" + android:id="@+id/PostSwipeRefresh"> <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/linearLayout2" android:layout_width="match_parent" - 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="0.0" - app:layout_constraintStart_toStartOf="parent"> - - - <TextView - android:id="@+id/tvTitle" - style="@style/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - 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" /> - - <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" /> - - <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" /> - - <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" /> - - <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" - 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" - 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" /> + android:layout_height="match_parent" + android:orientation="vertical"> - <org.osmdroid.views.MapView - android:id="@+id/MapDialogueMapView" + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvMain" android:layout_width="match_parent" - android:layout_height="150dp" - android:layout_marginTop="8dp" + android:layout_height="0dp" + android:layout_margin="0dp" + android:paddingBottom="@dimen/component_padding" + 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/tvUser" /> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/singlePostDetail" + android:id="@+id/linearLayout2" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginTop="8dp" + android:layout_height="340dp" + android:background="@drawable/view_top_corner_radius" + android:elevation="30dp" + android:paddingHorizontal="16dp" + android:paddingTop="16dp" + android:paddingBottom="0dp" + android:textSize="15dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/MapDialogueMapView"> + tools:backgroundTint="@color/white"> + - <Button - android:id="@+id/btnActivitySinglePostDescription" - android:layout_width="150dp" + <TextView + android:id="@+id/tvTitle" + style="@style/title" + android:layout_width="0dp" android:layout_height="wrap_content" - 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" + android:layout_marginTop="24dp" + android:ellipsize="end" + android:gravity="top|start" + android:maxLines="1" + android:padding="@dimen/text_padding" + android:paddingRight="20dp" + android:text="Naslov" + app:layout_constraintEnd_toStartOf="@+id/ivFavourite" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <Button - android:id="@+id/btnActivitySinglePostComments" - android:layout_width="150dp" + <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" /> + + <TextView + android:id="@+id/tvLocationParent" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginEnd="8dp" - android:layout_marginBottom="8dp" - android:backgroundTint="#FFFFFF" - android:stateListAnimator="@null" - android:text="Komentari" - android:textColor="@color/cardview_dark_background" + android:gravity="top|start" + android:padding="@dimen/text_padding" + android:text="Drzava, grad" + android:textSize="15dp" + app:layout_constraintStart_toEndOf="@+id/imageView12" + app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> + + <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" /> + + <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" + android:textColor="#FF03DAC5" + android:textSize="20dp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvLocationType" /> + + <TextView + android:id="@+id/tvDatePosted" + 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="Timestamp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvLocationType" /> + + <LinearLayout + android:id="@+id/llTags" + android:layout_width="match_parent" + android:layout_height="20dp" + android:orientation="horizontal" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvUser"></LinearLayout> + + <ImageView + android:id="@+id/ivFavourite" + android:layout_width="30dp" + android:layout_height="30dp" + android:layout_marginRight="5dp" + android:clickable="true" + android:src="@drawable/ic_baseline_favorite_border_24" + app:layout_constraintBottom_toBottomOf="@+id/tvRating" + app:layout_constraintEnd_toStartOf="@+id/tvRating" + app:layout_constraintTop_toTopOf="@+id/tvRating" /> + + <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:textSize="15dp" + android:textStyle="bold" + app:layout_constraintEnd_toStartOf="@+id/tvNumberOfRatings" + 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)" + android:textSize="15dp" + app:layout_constraintEnd_toEndOf="parent" + 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" /> - <FrameLayout - android:id="@+id/flSinglePostFragmentContainer" + <androidx.cardview.widget.CardView + android:id="@+id/MapDialogueMapView" + android:layout_width="match_parent" + android:layout_height="150dp" + android:layout_marginHorizontal="3dp" + + android:layout_marginTop="8dp" + android:elevation="15dp" + app:cardCornerRadius="10dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/llTags"> + + <org.osmdroid.views.MapView + android:id="@+id/MapDialogueMap" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + </androidx.cardview.widget.CardView> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/singlePostDetail" android:layout_width="match_parent" android:layout_height="0dp" - android:paddingHorizontal="16dp" + android:layout_marginTop="8dp" 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> + app:layout_constraintTop_toBottomOf="@+id/MapDialogueMapView"> + + <Button + android:id="@+id/btnActivitySinglePostDescription" + android:layout_width="150dp" + android:layout_height="wrap_content" + 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" /> + + <Button + android:id="@+id/btnActivitySinglePostComments" + android:layout_width="150dp" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:text="Komentari" + android:textColor="@color/cardview_dark_background" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <FrameLayout + android:id="@+id/flSinglePostFragmentContainer" + android:layout_width="match_parent" + android:layout_height="0dp" + android:paddingHorizontal="5dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/divider5" + app:layout_constraintVertical_bias="1.0"></FrameLayout> + + <View + android:id="@+id/divider5" + android:layout_width="376dp" + android:layout_height="1dp" + android:background="?android:attr/listDivider" + android:elevation="10dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/btnActivitySinglePostDescription" /> + </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.constraintlayout.widget.ConstraintLayout> -</androidx.constraintlayout.widget.ConstraintLayout> + </androidx.constraintlayout.widget.ConstraintLayout> +</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> 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 5c0ceb8..f6d2b69 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 @@ -6,254 +6,260 @@ android:layout_height="match_parent" tools:context=".Activities.ActivityUserProfile"> - - <androidx.constraintlayout.widget.ConstraintLayout + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:id="@+id/ProfileSwipeRefresh"> - <ImageView - android:scaleType="centerCrop" - android:id="@+id/imageView3" + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" - android:layout_height="180dp" - android:foreground="@drawable/b3" - android:foregroundGravity="center_vertical|center|center_horizontal|fill" - android:src="@drawable/b3" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - - <com.google.android.material.imageview.ShapeableImageView - - android:id="@+id/tvFragmentProfileInfoContainer" - android:layout_width="0dp" - android:layout_height="199dp" - android:layout_marginStart="20dp" - android:layout_marginTop="90dp" - android:layout_marginEnd="20dp" - android:adjustViewBounds="true" - 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" - app:layout_constraintTop_toTopOf="@+id/imageView3" - app:shapeAppearanceOverlay="@style/imageViewRoundedEdge" /> - - - <androidx.cardview.widget.CardView - android:id="@+id/cvFragmentHomePageProfile" - android:layout_width="120dp" - android:layout_height="120dp" - 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_toTopOf="parent"> + android:layout_height="match_parent"> <ImageView - - android:id="@+id/tvActivityProfileProfilePicture" + android:scaleType="centerCrop" + android:id="@+id/imageView3" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="180dp" + android:foreground="@drawable/b3" + android:foregroundGravity="center_vertical|center|center_horizontal|fill" + android:src="@drawable/b3" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + <com.google.android.material.imageview.ShapeableImageView + + android:id="@+id/tvFragmentProfileInfoContainer" + android:layout_width="0dp" + android:layout_height="199dp" + android:layout_marginStart="20dp" + android:layout_marginTop="90dp" + android:layout_marginEnd="20dp" + android:adjustViewBounds="true" + 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" + app:layout_constraintTop_toTopOf="@+id/imageView3" + app:shapeAppearanceOverlay="@style/imageViewRoundedEdge" /> + + + <androidx.cardview.widget.CardView + android:id="@+id/cvFragmentHomePageProfile" + android:layout_width="120dp" + android:layout_height="120dp" + android:layout_gravity="center" + android:layout_marginTop="24dp" android:elevation="10dp" - android:scaleType="centerCrop" - android:src="@drawable/ic_baseline_person_24" - tools:ignore="ContentDescription" /> - </androidx.cardview.widget.CardView> - - <View - android:id="@+id/divider" - android:layout_width="409dp" - android:layout_height="1dp" - android:background="?android:attr/listDivider" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/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="120dp" - android:layout_height="wrap_content" - android:backgroundTint="#FFFFFF" - android:stateListAnimator="@null" - android:text="Objave" - android:textColor="@color/cardview_dark_background" - /> - - <Button - android:layout_weight="1" - android:id="@+id/btnFragmentUserProfileShowData" - android:layout_width="110dp" - android:layout_height="wrap_content" - android:backgroundTint="#FFFFFF" - android:stateListAnimator="@null" - android:text="Nalog" - android:textColor="@color/cardview_dark_background" - /> - - <Button - android:id="@+id/btnFragmentUserProfileShowRecensions" - android:layout_width="120dp" - android:layout_height="wrap_content" - android:backgroundTint="#FFFFFF" - android:stateListAnimator="@null" - android:text="Recenzije" - android:textColor="@color/cardview_dark_background" - /> - </LinearLayout> - <FrameLayout - android:layout_weight="1" - android:id="@+id/flActivityProfileFragmentContainer" - 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" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/divider" - app:layout_constraintVertical_bias="0.0"></FrameLayout> - - <TableLayout - - android:layout_width="350dp" - android:layout_height="140dp" - android:layout_marginStart="35dp" - android:layout_marginEnd="35dp" - android:elevation="1dp" - android:numColumns="3" - app:layout_constraintBottom_toBottomOf="@+id/tvFragmentProfileInfoContainer" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/tvFragmentProfileInfoContainer" - app:layout_constraintVertical_bias="0.88"> - - <TableRow - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_column="1" - > - - <TextView - android:id="@+id/tvActivityUserProfileName" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center" - android:text="Petar Petrović" - android:textSize="23sp" - android:textStyle="bold" /> - </TableRow> + app:cardCornerRadius="250dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <ImageView + android:id="@+id/tvActivityProfileProfilePicture" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:elevation="10dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_baseline_person_24" + tools:ignore="ContentDescription" /> + </androidx.cardview.widget.CardView> + + <View + android:id="@+id/divider" + android:layout_width="409dp" + android:layout_height="1dp" + android:background="?android:attr/listDivider" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/buttons" /> - <TableRow - android:gravity="center" - android:layout_marginLeft="10dp" - android:layout_marginRight="10dp" - android:layout_marginTop="5dp"> <LinearLayout - android:orientation="horizontal" + android:id="@+id/buttons" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_width="wrap_content" android:weightSum="3" - > - <TextView - android:id="@+id/tvFragmentUserProfilePosts" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer"> + + <Button android:layout_weight="1" - android:backgroundTint="@color/white" - android:gravity="center" - android:layout_width="110dp" + android:id="@+id/btnActivityUserProfileShowPosts" + android:layout_width="125dp" android:layout_height="wrap_content" - android:textSize="14sp" + android:backgroundTint="#FFFFFF" android:stateListAnimator="@null" - android:text="OBJAVE" - - android:textColor="#757471" /> + android:text="Objave" + android:textColor="@color/cardview_dark_background" + /> <Button - android:id="@+id/tvActivityUserProfileFollowers" - android:layout_width="110dp" - 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:id="@+id/btnFragmentUserProfileShowData" + android:layout_width="100dp" + android:layout_height="wrap_content" + android:backgroundTint="#FFFFFF" android:stateListAnimator="@null" - android:text="PRATIOCI" - android:textColor="#757471" - android:textSize="14sp" - tools:ignore="TouchTargetSizeCheck" /> + android:text="Mapa" + android:textColor="@color/cardview_dark_background" + /> <Button - android:textSize="14sp" - android:id="@+id/tvActivityUserProfileFollow" - android:layout_width="110dp" - 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:id="@+id/btnFragmentUserProfileShowRecensions" + android:layout_width="125dp" + android:layout_height="wrap_content" + android:backgroundTint="#FFFFFF" android:stateListAnimator="@null" - android:text="PRAĆENJA" - android:textColor="#757471" - tools:ignore="TouchTargetSizeCheck" /> + android:text="Statistika" + android:textColor="@color/cardview_dark_background" + /> </LinearLayout> + <FrameLayout + android:layout_weight="1" + android:id="@+id/flActivityProfileFragmentContainer" + 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" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/divider" + app:layout_constraintVertical_bias="0.0"></FrameLayout> + + <TableLayout + + android:layout_width="350dp" + android:layout_height="140dp" + android:layout_marginStart="35dp" + android:layout_marginEnd="35dp" + android:elevation="1dp" + android:numColumns="3" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageProfile" + app:layout_constraintVertical_bias="0.88"> + + <TableRow + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:layout_column="1" + > + + <TextView + android:id="@+id/tvActivityUserProfileName" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="center" + android:text="Petar Petrović" + android:textSize="23sp" + android:textStyle="bold" /> + </TableRow> - </TableRow> - - <TableRow - 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:layout_width="110dp" - android:layout_height="wrap_content" - android:id="@+id/tvActivityUserProfileFollowersNo" - android:gravity="center" - android:text="50" - android:textSize="20dp" - android:textStyle="bold" /> - <TextView - android:id="@+id/tvActivityUserProfileFollowNo" - android:layout_width="110dp" - android:layout_height="wrap_content" + <TableRow android:gravity="center" - android:text="40" - android:textSize="20dp" - android:textStyle="bold" /> - </LinearLayout> - </TableRow> + 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_weight="1" + android:backgroundTint="@color/white" + android:gravity="center" + android:layout_width="110dp" + android:layout_height="wrap_content" + android:textSize="14sp" + android:stateListAnimator="@null" + android:text="OBJAVE" + + android:textColor="#757471" /> + + <Button + android:id="@+id/tvActivityUserProfileFollowers" + android:layout_width="110dp" + 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="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="PRATI" + android:textColor="#757471" + tools:ignore="TouchTargetSizeCheck" /> + </LinearLayout> + + </TableRow> + + <TableRow + 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:clickable="true" + 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" /> + + <TextView + android:clickable="true" + 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" /> + </LinearLayout> + </TableRow> @@ -263,7 +269,9 @@ android:layout_marginTop="10dp" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" - android:layout_gravity="center"> + android:layout_gravity="center" + android:id="@+id/clActivityUserProfileFollow_Chat_Row" + android:visibility="gone"> <Button @@ -319,9 +327,11 @@ tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" /> </androidx.constraintlayout.widget.ConstraintLayout> - </TableLayout> + </TableLayout> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> - </androidx.constraintlayout.widget.ConstraintLayout> </FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_add_new_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_add_new_post.xml index 10aa669..2fcf6dd 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_add_new_post.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_add_new_post.xml @@ -1,63 +1,55 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" +<com.google.android.material.circularreveal.CircularRevealLinearLayout 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/bottomSheetAddNewForNav" android:layout_width="match_parent" android:layout_height="wrap_content" -> + android:orientation="vertical" + android:background="@drawable/view_top_corner_radius"> + + <TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="16dp" + android:layout_gravity="center" + android:layout_marginTop="10dp" android:fontFamily="sans-serif-black" android:text="Dodaj novu objavu" android:textSize="20sp" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <ImageButton + <Button android:id="@+id/btnBottomSheetAddNewPostOpenAddPost" - android:layout_width="0dp" - android:layout_height="60dp" - android:layout_marginStart="30dp" - - android:layout_marginTop="16dp" - android:layout_marginEnd="40dp" - android:layout_marginBottom="24dp" - android:background="@drawable/button_choose_from_gallery" + style="@style/clean_button_margin" + android:layout_width="match_parent" + android:layout_marginTop="20dp" + android:gravity="left|center_vertical" + android:drawableLeft="@drawable/ic_outline_add_photo_alternate_24" + android:text="Izaberi fotografije iz galerije" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/btnBottomSheetAddNewPostOpenCapturePost" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView6" app:layout_constraintVertical_bias="0.0" /> - <ImageButton + <Button android:id="@+id/btnBottomSheetAddNewPostOpenCapturePost" - - android:layout_width="0dp" - android:layout_height="60dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="30dp" - android:layout_marginBottom="24dp" - android:background="@drawable/button_capture" + style="@style/clean_button_margin" + android:layout_width="match_parent" + android:drawableLeft="@drawable/ic_outline_add_a_photo_24" +android:layout_marginBottom="16dp" + android:text="Fotografiši" + android:gravity="left|center_vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="1.0" - app:layout_constraintStart_toEndOf="@+id/btnBottomSheetAddNewPostOpenAddPost" - app:layout_constraintTop_toBottomOf="@+id/textView6" - app:layout_constraintVertical_bias="1.0" /> - - <ImageButton - android:id="@+id/btnBottomSheetAddNewPostClose" - android:layout_width="65dp" - android:layout_height="17dp" - app:cornerRadius="50dp" - app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@+id/btnBottomSheetAddNewPostOpenAddPost" + app:shapeAppearance="@style/imageViewRoundedEdge" /> -</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file +</com.google.android.material.circularreveal.CircularRevealLinearLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_filter.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_filter.xml index 249c654..85915f0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_filter.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_filter.xml @@ -17,7 +17,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - <TextView + <!-- <TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -32,8 +32,8 @@ app:layout_constraintTop_toBottomOf="@+id/textView7" /> <EditText - android:id="@+id/dateFromBSF" - android:layout_width="140dp" + android:id="@+id/filterDateFrom" + android:layout_width="150dp" android:layout_height="48dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" @@ -43,105 +43,294 @@ app:layout_constraintTop_toBottomOf="@+id/textView8" tools:ignore="SpeakableTextPresentCheck" /> + <TextView + android:id="@+id/textView9" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="20dp" + android:text="Od:" + app:layout_constraintStart_toStartOf="parent" + app:layout_constrain_toBottomOf="@+id/textView8" /> + + <TextView + android:id="@+id/textView10" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:layout_marginEnd="8dp" + android:text="Do:" + app:layout_constraintEnd_toStartOf="@+id/filterDateTo" + app:layout_constraintTop_toBottomOf="@+id/textView8" /> + + <EditText + android:id="@+id/filterDateTo" + android:layout_width="150dp" + android:layout_height="48dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="16dp" + android:ems="10" + android:inputType="date" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView8" + tools:ignore="SpeakableTextPresentCheck" />--> + + <RadioGroup + android:id="@+id/radioGroupFilter" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView8"> + + <RadioButton + android:id="@+id/filterLastweek" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="12dp" + android:text="Prethodna nedelja" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" /> + + <RadioButton + android:id="@+id/filterLastMonth" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:text="Prethodni mesec" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/radioButton" /> + + <RadioButton + android:id="@+id/filterLastThreeMonths" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:text="Prethodna tri meseca" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/radioButton4" /> + + + <RadioButton + android:id="@+id/filterLastYear" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:text="Prethodna godina" + app:layout_constraintTop_toBottomOf="@+id/radioButton3" + tools:layout_editor_absoluteX="16dp" /> + + </RadioGroup> + <TextView - android:id="@+id/textView9" + android:id="@+id/textView15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" - android:layout_marginTop="20dp" - android:text="@string/od" + android:text="Rejting" + android:textSize="17sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView8" /> + app:layout_constraintTop_toBottomOf="@+id/radioGroupFilter" /> <TextView - android:id="@+id/textView10" + android:id="@+id/ratingFromtxt" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="20dp" + android:text="Od:" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView15" /> + + <TextView + android:id="@+id/ratingTotxt" + android:layout_width="wrap_content" + android:layout_height="19dp" android:layout_marginTop="20dp" android:layout_marginEnd="8dp" - android:text="Do" - app:layout_constraintEnd_toStartOf="@+id/dateToBSF" - app:layout_constraintTop_toBottomOf="@+id/textView8" /> + android:text="Do:" + app:layout_constraintEnd_toStartOf="@+id/filterRatingTo" + app:layout_constraintTop_toBottomOf="@+id/textView15" /> - <EditText - android:id="@+id/dateToBSF" - android:layout_width="140dp" - android:layout_height="48dp" + <!-- <View + android:id="@+id/divider2" + android:layout_width="409dp" + android:layout_height="1dp" + android:background="?android:attr/listDivider" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/filterDateFrom" /> +--> + <View + android:id="@+id/divider4" + android:layout_width="409dp" + android:layout_height="1dp" + android:background="?android:attr/listDivider" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/filterViewsFrom" /> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" + android:layout_marginBottom="16dp" + android:orientation="horizontal" + android:weightSum="1" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/divider4" + app:layout_constraintVertical_bias="1.0"> + + <Button + android:id="@+id/btnBSFFilter" + android:layout_width="10dp" + android:layout_height="39dp" + android:layout_marginHorizontal="10dp" + android:layout_marginTop="16dp" + android:layout_weight="1" + android:background="@drawable/view_corner_radius" + android:text="Primeni" + + tools:ignore="TouchTargetSizeCheck" /> + + </LinearLayout> + + <EditText + android:id="@+id/filterRatingFrom" + android:layout_width="111dp" + android:layout_height="51dp" + android:layout_marginStart="8dp" android:ems="10" - android:inputType="date" + android:inputType="number" + app:layout_constraintStart_toEndOf="@+id/ratingFromtxt" + app:layout_constraintTop_toBottomOf="@+id/textView15" /> + + <ImageView + android:id="@+id/imageView18" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="20dp" + app:layout_constraintStart_toEndOf="@+id/filterRatingFrom" + app:layout_constraintTop_toBottomOf="@+id/textView15" + app:srcCompat="@drawable/ic_baseline_star_rate_24" /> + + + <EditText + android:id="@+id/filterRatingTo" + android:layout_width="111dp" + android:layout_height="51dp" + android:layout_marginEnd="12dp" + android:ems="10" + android:inputType="number" + app:layout_constraintEnd_toStartOf="@+id/imageView19" + app:layout_constraintTop_toBottomOf="@+id/textView15" /> + + <ImageView + android:id="@+id/imageView19" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:layout_marginEnd="20dp" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView8" - tools:ignore="SpeakableTextPresentCheck" /> + app:layout_constraintTop_toBottomOf="@+id/textView15" + app:srcCompat="@drawable/ic_baseline_star_rate_24" /> <TextView - android:id="@+id/textView11" + android:id="@+id/textView20" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:text="Lokacija" + android:layout_marginStart="17dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="292dp" + android:text="Broj pregleda" android:textSize="17sp" android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/divider8" /> + + <TextView + android:id="@+id/viewsFromtxt" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="20dp" + android:text="Od:" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/divider2" /> + app:layout_constraintTop_toBottomOf="@+id/textView20" /> + + <TextView + android:id="@+id/viewsTotxt" + android:layout_width="wrap_content" + android:layout_height="19dp" + android:layout_marginTop="20dp" + android:layout_marginEnd="5dp" + android:text="Do:" + app:layout_constraintEnd_toStartOf="@+id/filterViewsTo" + app:layout_constraintTop_toBottomOf="@+id/textView20" /> <View - android:id="@+id/divider2" + android:id="@+id/divider8" android:layout_width="409dp" android:layout_height="1dp" android:background="?android:attr/listDivider" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/dateFromBSF" /> + app:layout_constraintTop_toBottomOf="@+id/filterRatingFrom" /> <EditText - android:id="@+id/locationBSF" - android:layout_width="0dp" + android:id="@+id/filterViewsFrom" + android:layout_width="150dp" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="24dp" + android:layout_marginStart="8dp" + android:layout_marginTop="5dp" android:ems="10" - android:inputType="textPersonName" - app:layout_constraintEnd_toStartOf="@+id/imageView8" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView11" - tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" /> + android:inputType="number" + app:layout_constraintStart_toEndOf="@+id/viewsFromtxt" + app:layout_constraintTop_toBottomOf="@+id/textView20" /> - <ImageView - android:id="@+id/imageView8" - android:layout_width="50dp" - android:layout_height="40dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" + <EditText + android:id="@+id/filterViewsTo" + android:layout_width="150dp" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:layout_marginEnd="12dp" + android:ems="10" + android:inputType="number" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@+id/textView11" - app:srcCompat="@drawable/button_find_on_map" /> + app:layout_constraintTop_toBottomOf="@+id/textView20" /> + + <TextView + android:id="@+id/textView8" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="Datum" + android:textSize="17sp" + android:textStyle="bold" + android:layout_marginStart="16dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView7" /> <View - android:id="@+id/divider4" - android:layout_width="409dp" + android:id="@+id/divider2" + android:layout_width="match_parent" android:layout_height="1dp" android:background="?android:attr/listDivider" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/locationBSF" /> + app:layout_constraintTop_toBottomOf="@+id/radioGroupFilter" /> - <Button - android:id="@+id/btnBSFFilter" - android:layout_width="169dp" - android:layout_height="39dp" - android:layout_marginTop="16dp" - android:layout_marginBottom="24dp" - android:background="@drawable/rounded_cyan_button" - android:text="Primeni" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/divider4" - app:layout_constraintVertical_bias="1.0" - tools:ignore="TouchTargetSizeCheck" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_sort.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_sort.xml index fb06308..72fac70 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_sort.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/bottom_sheet_sort.xml @@ -6,6 +6,7 @@ android:layout_height="wrap_content"> <RadioGroup + android:id="@+id/radioGroup" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" @@ -13,7 +14,7 @@ app:layout_constraintTop_toBottomOf="@+id/textView12"> <RadioButton - android:id="@+id/radioButton" + android:id="@+id/sortLatest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" @@ -21,38 +22,56 @@ android:text="Najnovije" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintStart_toStartOf="parent" - /> + app:layout_constraintStart_toStartOf="parent" /> <RadioButton - android:id="@+id/radioButton2" + android:id="@+id/sortOldest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" - android:text="Najbolje ocenjeno" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintTop_toBottomOf="@+id/radioButton4" /> + android:text="Najstarije" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/radioButton" /> <RadioButton - android:id="@+id/radioButton3" + android:id="@+id/sortBest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" - android:text="Najstarije" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/radioButton" /> + android:text="Najbolje ocenjeno" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/radioButton4" /> + <RadioButton - android:id="@+id/radioButton4" + android:id="@+id/sortMostViewed" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" - android:text="Najviše pregleda" app:layout_constraintTop_toBottomOf="@+id/radioButton3" tools:layout_editor_absoluteX="16dp" /> + </RadioGroup> + <Button + android:id="@+id/btnSortPosts" + android:layout_width="match_parent" + android:layout_height="39dp" + android:layout_marginHorizontal="10dp" + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp" + android:layout_weight="1" + android:background="@drawable/view_corner_radius" + android:text="Primeni" + 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/radioGroup" + app:layout_constraintVertical_bias="0.0" + tools:ignore="TouchTargetSizeCheck" /> + <TextView android:id="@+id/textView12" android:layout_width="wrap_content" 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 f7ef08c..0642a58 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_message.xml @@ -24,7 +24,7 @@ android:id="@+id/cvContainer" android:layout_width="wrap_content" android:minWidth="40dp" - android:layout_height="30dp" + android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" android:backgroundTint="@color/unfollow" @@ -38,10 +38,12 @@ android:id="@+id/tvMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:maxLines="50" + android:maxWidth="300dp" android:backgroundTint="@color/unfollow" android:padding="5dp" android:paddingHorizontal="15dp" - android:text="blabla" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" /> </androidx.cardview.widget.CardView> 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 b076cf8..a396f07 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 @@ -23,10 +23,10 @@ android:id="@+id/cvContainer" android:layout_width="wrap_content" android:minWidth="40dp" - android:layout_height="30dp" + android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" - android:backgroundTint="#eef1f6" + android:backgroundTint="@color/purple_500" android:background="@drawable/view_corner_radius" app:cardCornerRadius="15dp" app:layout_constraintStart_toStartOf="parent" @@ -37,10 +37,12 @@ android:id="@+id/tvMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:backgroundTint="#eef1f6" + android:maxLines="50" + android:maxWidth="300dp" + android:textColor="@color/white" android:padding="5dp" android:paddingHorizontal="15dp" - android:text="blabla" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" /> </androidx.cardview.widget.CardView> 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 c995b4b..694cabe 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/chat_preview.xml @@ -8,6 +8,8 @@ android:layout_width="5dp" android:id="@+id/readIndicator" android:layout_height="5dp" + android:background="@drawable/rounded_picture_background" + android:backgroundTint="@null" android:layout_gravity="center_vertical"/> <ImageView android:id="@+id/ivUserImage" @@ -40,15 +42,23 @@ android:textSize="@dimen/header2_size" android:textColor="@color/unfollow"/> </androidx.appcompat.widget.LinearLayoutCompat> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginEnd="10dp"> <TextView - android:layout_width="match_parent" + android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/tvLastMessage" - android:text="hej, sta ima novo?" + android:maxLines="1" + android:ellipsize="end" android:layout_weight="1" android:gravity="center_vertical" android:textAlignment="gravity" android:textSize="@dimen/header2_size" - android:textColor="@color/unfollow"/> + android:textColor="@color/unfollow" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent"/> + </androidx.constraintlayout.widget.ConstraintLayout> </androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml index d0c6a2d..b295b43 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/follower_item.xml @@ -20,8 +20,8 @@ <androidx.cardview.widget.CardView android:id="@+id/cvFragmentHomePageProfile" - android:layout_width="80dp" - android:layout_height="80dp" + android:layout_width="70dp" + android:layout_height="70dp" android:layout_gravity="center" android:elevation="10dp" @@ -47,11 +47,11 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="15dp" android:layout_marginStart="24dp" - android:layout_marginTop="28dp" + android:layout_marginTop="20dp" android:text="Petar Petrovic" android:textSize="17sp" android:textStyle="bold" - app:layout_constraintEnd_toStartOf="@+id/materialButton" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toEndOf="@+id/cvFragmentHomePageProfile" app:layout_constraintTop_toTopOf="parent"> @@ -63,27 +63,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Petar Petrovic" + android:layout_marginStart="24dp" android:textSize="15sp" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/materialButton" - app:layout_constraintHorizontal_bias="0.597" - app:layout_constraintStart_toStartOf="parent" + app:layout_constraintStart_toEndOf="@id/cvFragmentHomePageProfile" app:layout_constraintTop_toBottomOf="@+id/tvFollowerItemName" app:layout_constraintVertical_bias="0.0" /> - <ImageButton - - android:id="@+id/materialButton" - android:layout_width="101dp" - android:layout_height="39dp" - android:layout_marginEnd="16dp" - android:background="@drawable/rounded_transparent_button" - android:foreground="@drawable/button_follow" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.508" - tools:ignore="TouchTargetSizeCheck" /> - </androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml index 9e6dd9d..911b2b9 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml @@ -18,17 +18,18 @@ /> - <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/FragmentBrowseMyLocation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentStart="true" - android:backgroundTint="#FFFFFF" + android:layout_marginEnd="16dp" android:layout_marginBottom="80dp" + android:backgroundTint="#FFFFFF" android:clickable="true" android:focusable="true" android:tint="#FFFFFF" + android:elevation="10dp" app:layout_constraintBottom_toBottomOf="@+id/FragmentBrowseMapView" app:layout_constraintEnd_toEndOf="parent" app:rippleColor="#FFFFFF" @@ -52,7 +53,7 @@ android:id="@+id/FragmentBrowseSearchBar" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/rounded_white_button_login" + android:backgroundTint="@color/white" android:hint=" Pretraga" android:inputType="textPersonName" android:paddingLeft="15dp" /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_followers.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_followers.xml index 6092e01..073cd91 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_followers.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_followers.xml @@ -31,7 +31,8 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvFragmentShowFollowers" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="match_parent" + android:orientation="vertical"/> </LinearLayout> </FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_following.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_following.xml index 424094f..a673bd5 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_following.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_following.xml @@ -31,7 +31,8 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvFragmentShowFollowing" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="match_parent" + android:orientation="vertical"/> </LinearLayout> </FrameLayout>
\ 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 12c37e8..889b5b2 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page.xml @@ -4,7 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="#f6f6f6" + android:background="#FFFCFCFC" tools:context=".Fragments.FragmentHomePage"> <TextView @@ -48,6 +48,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:scaleType="centerCrop" + android:clickable="true" android:src="@drawable/ic_baseline_person_24" tools:ignore="ContentDescription" tools:layout_editor_absoluteX="9dp" @@ -73,7 +74,7 @@ android:layout_width="0dp" android:layout_height="40dp" android:layout_marginStart="16dp" - android:layout_marginTop="45dp" + android:layout_marginTop="35dp" android:layout_marginEnd="16dp" android:elevation="0dp" app:cardCornerRadius="20dp" @@ -111,7 +112,7 @@ android:layout_height="40dp" android:layout_marginTop="8dp" android:clickable="true" - android:src="@drawable/ic_baseline_arrow_back_24" + android:src="@drawable/ic_baseline_arrow_back" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/cvFragmentHomePageSearch" /> @@ -119,7 +120,6 @@ android:id="@+id/flFragmentHomePageMainContent" android:layout_width="match_parent" android:layout_height="0dp" - android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml index 07d34a3..3666635 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home_page_main_scroll.xml @@ -1,240 +1,233 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.swiperefreshlayout.widget.SwipeRefreshLayout 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" + tools:context=".Fragments.FragmentHomePageMainScroll" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto" - tools:context=".Fragments.FragmentHomePageMainScroll"> - -<LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - - <androidx.cardview.widget.CardView - android:backgroundTint="#f6f6f6" - android:layout_marginStart="10dp" - android:layout_marginEnd="16dp" -app:cardElevation="0dp" - android:id="@+id/cvFragmentHomePageText2" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:stateListAnimator="@null" - android:elevation="0dp" - android:layout_marginTop="16dp"> - - <TextView - android:id="@+id/tvFragmentHomePageNewest" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="left" - android:text="Najnovije" - android:clickable="true" - android:textStyle="bold" /> - - - <TextView - android:id="@+id/tvFragmentHomePageNewestShowAll" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:clickable="true" - android:text="Prikaži sve" /> - </androidx.cardview.widget.CardView> - - <androidx.recyclerview.widget.RecyclerView - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:id="@+id/rvFragmentHomePageNewest" - android:layout_marginBottom="20dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - <HorizontalScrollView - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:id="@+id/hsvFragmentHomePageLocationButtonScroll" - android:layout_width="match_parent" - android:layout_height="wrap_content" + android:id="@+id/swipeContainer"> - > + <ScrollView - <LinearLayout - android:id="@+id/llFragmentHomePageLocationButtonLayout" - android:layout_width="wrap_content" - android:layout_height="match_parent"> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_city" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_city" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_beach" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_beach" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_mountain" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_mountain" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_lake" - android:layout_width="60dp" - android:layout_height="match_parent" - android:layout_marginRight="10dp" - android:background="@drawable/location_lake" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_spa" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_spa" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_waterfall" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_waterfall" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_amusement_park" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_amusement_park" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_attraction" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_attraction" - tools:ignore="SpeakableTextPresentCheck" /> - - <ImageButton - android:id="@+id/btnFragmentHomePagelocation_landmark" - android:layout_width="60dp" - android:layout_height="60dp" - android:layout_marginRight="10dp" - android:background="@drawable/location_landmark" - tools:ignore="SpeakableTextPresentCheck" /> - - </LinearLayout> - </HorizontalScrollView> - <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> + android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> -<LinearLayout - android:orientation="vertical" - android:id="@+id/ll1" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <androidx.cardview.widget.CardView - android:backgroundTint="#f6f6f6" - android:layout_marginTop="16dp" - android:id="@+id/cvFragmentHomePageText1" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:elevation="0dp" - app:cardElevation="0dp" - > - - <TextView - android:id="@+id/tvFragmentHomePagePopular" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="left" - android:text="Popularno" - android:textStyle="bold" /> - - <TextView - android:id="@+id/tvFragmentHomePagePopularShowAll" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:clickable="true" - android:text="Prikaži sve" - - tools:ignore="TouchTargetSizeCheck" /> - </androidx.cardview.widget.CardView> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/rvFragmentHomePagePopular" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" /> - - </LinearLayout> - <LinearLayout - android:id="@+id/ll2" - - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <androidx.cardview.widget.CardView - android:backgroundTint="#f6f6f6" -app:cardElevation="0dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:id="@+id/cvFragmentHomePageText3" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="16dp"> - <TextView - android:id="@+id/tvFragmentHomePageBestRated" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="left" - android:text="Najbolje ocenjeno" - android:textStyle="bold" /> - - <TextView - android:id="@+id/tvFragmentHomePageBestRatedShowAll" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:clickable="true" - android:text="Prikaži sve" /> - </androidx.cardview.widget.CardView> - - <androidx.recyclerview.widget.RecyclerView - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:id="@+id/rvFragmentHomePageBestRated" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - -</LinearLayout></LinearLayout> -</LinearLayout> -</LinearLayout> -</ScrollView>
\ No newline at end of file + <androidx.cardview.widget.CardView + android:id="@+id/cvFragmentHomePageText2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="5dp" + android:backgroundTint="#FFFCFCFC" + android:elevation="0dp" + android:stateListAnimator="@null" + app:cardElevation="0dp"> + + <TextView + android:id="@+id/tvFragmentHomePageNewest" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="left" + android:clickable="true" + android:text="Najnovije" + android:textSize="16dp" + android:textStyle="bold" /> + + + </androidx.cardview.widget.CardView> + + <androidx.recyclerview.widget.RecyclerView + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:id="@+id/rvFragmentHomePageNewest" + android:layout_marginBottom="20dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + <HorizontalScrollView + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:id="@+id/hsvFragmentHomePageLocationButtonScroll" + android:layout_width="match_parent" + android:layout_height="wrap_content" + + > + + <LinearLayout + android:id="@+id/llFragmentHomePageLocationButtonLayout" + android:layout_width="wrap_content" + android:layout_height="match_parent"> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_city" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_city" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_beach" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_beach" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_mountain" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_mountain" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_lake" + android:layout_width="60dp" + android:layout_height="match_parent" + android:layout_marginRight="10dp" + android:background="@drawable/location_lake" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_spa" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_spa" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_waterfall" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_waterfall" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_amusement_park" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_amusement_park" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_attraction" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_attraction" + tools:ignore="SpeakableTextPresentCheck" /> + + <ImageButton + android:id="@+id/btnFragmentHomePagelocation_landmark" + android:layout_width="60dp" + android:layout_height="60dp" + android:layout_marginRight="10dp" + android:background="@drawable/location_landmark" + tools:ignore="SpeakableTextPresentCheck" /> + + </LinearLayout> + </HorizontalScrollView> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + <LinearLayout + android:orientation="vertical" + android:id="@+id/ll1" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <androidx.cardview.widget.CardView + android:id="@+id/cvFragmentHomePageText1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:backgroundTint="#FFFCFCFC" + android:elevation="0dp" + android:layout_marginBottom="5dp" + + app:cardElevation="0dp"> + + <TextView + android:id="@+id/tvFragmentHomePagePopular" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="left" + android:text="Popularno" + android:textSize="16dp" + android:textStyle="bold" /> + + + </androidx.cardview.widget.CardView> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvFragmentHomePagePopular" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="8dp" /> + + </LinearLayout> + <LinearLayout + android:id="@+id/ll2" + + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <androidx.cardview.widget.CardView + android:layout_marginBottom="5dp" + + android:id="@+id/cvFragmentHomePageText3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:backgroundTint="#FFFCFCFC" + app:cardElevation="0dp"> + + <TextView + android:id="@+id/tvFragmentHomePageBestRated" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left" + android:text="Najbolje ocenjeno" + android:textStyle="bold" /> + + + </androidx.cardview.widget.CardView> + + <androidx.recyclerview.widget.RecyclerView + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:id="@+id/rvFragmentHomePageBestRated" + android:layout_width="match_parent" + android:layout_height="wrap_content" /> + + </LinearLayout></LinearLayout> + </LinearLayout> + </LinearLayout> + </ScrollView> +</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml index c45051b..8db797c 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml @@ -54,6 +54,7 @@ android:layout_marginTop="0dp" android:ems="10" android:hint="*********" + android:nextFocusDown="@+id/btnFragmentLoginLogin" android:inputType="textPassword" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="1.0" 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 eaf014d..eee59aa 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 @@ -6,7 +6,9 @@ android:layout_height="match_parent" android:orientation="vertical" tools:context=".Fragments.FragmentMyProfileInfo"> - +<ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" @@ -46,6 +48,7 @@ android:drawableLeft="@drawable/ic_outline_share_24" android:text="Pozovite prijatelje" /> </LinearLayout> +</ScrollView> <Button android:id="@+id/buttonLogOut" @@ -55,7 +58,7 @@ android:layout_gravity="bottom" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" + android:layout_marginBottom="0dp" android:drawableLeft="@drawable/ic_baseline_logout_24" android:text="Izlogujte se" android:drawableTint="@color/white" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_recensions.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_recensions.xml index 72706e0..76690e9 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_recensions.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_recensions.xml @@ -23,6 +23,8 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/materialDivider" - android:layout_marginHorizontal="16dp"/> + android:layout_marginHorizontal="16dp" + android:paddingBottom="50dp"/> + </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 8fe6ee6..b5988e0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml @@ -6,314 +6,324 @@ android:layout_height="match_parent" tools:context=".Fragments.FragmentProfile"> - - <androidx.constraintlayout.widget.ConstraintLayout + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ImageView - - android:id="@+id/imageView3" - android:layout_width="match_parent" - android:layout_height="190dp" - android:foreground="@drawable/b3" - android:foregroundGravity="center_vertical|center|center_horizontal|fill" - android:src="@drawable/b3" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <ImageView + android:layout_height="match_parent" + android:id="@+id/ProfileSwipeRefresh"> - android:id="@+id/imageView4" + <androidx.constraintlayout.widget.ConstraintLayout 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" - app:layout_constraintStart_toStartOf="@+id/imageView3" - app:layout_constraintTop_toTopOf="@+id/imageView3" - app:layout_constraintVertical_bias="0.0" /> - - <com.google.android.material.imageview.ShapeableImageView - - android:id="@+id/tvFragmentProfileInfoContainer" - android:layout_width="0dp" - android:layout_height="199dp" - android:layout_marginStart="20dp" - android:layout_marginTop="90dp" - android:layout_marginEnd="20dp" - android:adjustViewBounds="true" - android:background="#E8FFFFFF" - android:elevation="1dp" - android:scaleType="fitEnd" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.494" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@+id/imageView3" - app:shapeAppearanceOverlay="@style/imageViewRoundedEdge" /> - - - <androidx.cardview.widget.CardView - android:id="@+id/cvFragmentHomePageProfile" - android:layout_width="120dp" - android:layout_height="120dp" - android:layout_gravity="center" - android:elevation="10dp" - app:cardCornerRadius="250dp" - app:layout_constraintBottom_toTopOf="@+id/tableLayout" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.498" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.65999997"> + android:layout_height="match_parent"> <ImageView - android:id="@+id/tvFragmentProfileProfilePicture" - android:layout_width="120dp" - android:layout_height="120dp" - android:elevation="20dp" - android:scaleType="centerCrop" - android:src="@drawable/ic_baseline_person_24" - tools:ignore="ContentDescription" /> - </androidx.cardview.widget.CardView> - - <com.google.android.material.button.MaterialButton - android:id="@+id/btnFragmentProfileProfilePicturePlus" - android:layout_width="54dp" - android:layout_height="54dp" - android:layout_marginEnd="32dp" - android:layout_marginBottom="4dp" - app:backgroundTint="#FFFFFF" - app:cornerRadius="100dp" - app:icon="@drawable/ic_baseline_add_a_photo_24" - app:iconGravity="start" - app:iconTint="#3C5C6E" - app:layout_constraintBottom_toTopOf="@+id/tableLayout" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.72" - app:layout_constraintStart_toStartOf="parent" - tools:ignore="SpeakableTextPresentCheck" /> - - <TableLayout - android:id="@+id/tableLayout" - android:layout_width="0dp" - android:layout_height="120dp" - android:elevation="20dp" - android:gravity="center" - android:stretchColumns="1" - 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_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> - - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content" - - android:gravity="center"> + android:id="@+id/imageView3" + android:layout_width="match_parent" + android:layout_height="190dp" + android:foreground="@drawable/b3" + android:foregroundGravity="center_vertical|center|center_horizontal|fill" + android:src="@drawable/b3" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - <TextView - android:id="@+id/tvFragmentProfileUserName" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:text="PetarP" - android:textSize="17sp" /> - </TableRow> + <ImageView - <TableRow + android:id="@+id/imageView4" android:layout_width="match_parent" - android:layout_height="100dp"> + android:layout_height="190dp" + app:layout_constraintBottom_toBottomOf="@+id/imageView3" + app:layout_constraintEnd_toEndOf="@id/imageView3" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="@+id/imageView3" + app:layout_constraintTop_toTopOf="@+id/imageView3" + app:layout_constraintVertical_bias="0.0" /> + + <com.google.android.material.imageview.ShapeableImageView + + android:id="@+id/tvFragmentProfileInfoContainer" + android:layout_width="0dp" + android:layout_height="199dp" + android:layout_marginStart="20dp" + android:layout_marginTop="90dp" + android:layout_marginEnd="20dp" + android:adjustViewBounds="true" + android:background="#E8FFFFFF" + android:elevation="1dp" + android:scaleType="fitEnd" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.494" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/imageView3" + app:shapeAppearanceOverlay="@style/imageViewRoundedEdge" /> - <Button - android:layout_height="8dp" - android:background="@drawable/rounded_transparent_button" - android:clickable="false" - android:visibility="invisible" /> - </TableRow> + <androidx.cardview.widget.CardView + android:id="@+id/cvFragmentHomePageProfile" + android:layout_width="120dp" + android:layout_height="120dp" + android:layout_gravity="center" + android:elevation="10dp" + app:cardCornerRadius="250dp" + app:layout_constraintBottom_toTopOf="@+id/tableLayout" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.498" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.65999997"> + + <ImageView + + android:id="@+id/tvFragmentProfileProfilePicture" + android:layout_width="120dp" + android:layout_height="120dp" + android:elevation="20dp" + android:scaleType="centerCrop" + android:src="@drawable/ic_baseline_person_24" + tools:ignore="ContentDescription" /> + </androidx.cardview.widget.CardView> + + <com.google.android.material.button.MaterialButton + android:id="@+id/btnFragmentProfileProfilePicturePlus" + android:layout_width="54dp" + android:layout_height="54dp" + android:layout_marginEnd="32dp" + android:layout_marginBottom="4dp" + app:backgroundTint="#FFFFFF" + app:cornerRadius="100dp" + app:icon="@drawable/ic_baseline_add_a_photo_24" + app:iconGravity="start" + app:iconTint="#3C5C6E" + app:layout_constraintBottom_toTopOf="@+id/tableLayout" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.72" + app:layout_constraintStart_toStartOf="parent" + tools:ignore="SpeakableTextPresentCheck" /> - <TableRow - android:layout_width="match_parent" - android:layout_height="wrap_content" + <TableLayout + android:id="@+id/tableLayout" + android:layout_width="0dp" + android:layout_height="120dp" + android:elevation="20dp" android:gravity="center" - android:weightSum="1"> - - <LinearLayout - android:layout_width="wrap_content" + android:stretchColumns="1" + 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_constraintTop_toTopOf="@+id/tvFragmentProfileInfoContainer" + app:layout_constraintVertical_bias="0.87"> + + <TableRow + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="horizontal" - android:weightSum="3"> + android:gravity="center"> <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:id="@+id/tvFragmentProfileName" + android:textSize="23sp" + android:textStyle="bold" + android:layout_width="match_parent" + android:layout_height="match_parent" android:gravity="center" - android:text="OBJAVE" /> + android:layout_marginBottom="10dp" + android:text="Petar Petrović" /> + </TableRow> - <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" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content" + + android:gravity="center"> <TextView - android:id="@+id/tvFragmentProfileFollow" - android:layout_width="110dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:width="100dp" + android:id="@+id/tvFragmentProfileUserName" + android:layout_width="match_parent" + android:layout_height="match_parent" android:gravity="center" - android:textSize="15sp" - android:textColor="#757471" - android:text="PRAĆENJA" /> - </LinearLayout> - </TableRow> + android:text="PetarP" + android:textSize="17sp" /> + </TableRow> - <TableRow - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:weightSum="1"> + <TableRow + android:layout_width="match_parent" + android:layout_height="100dp"> - <LinearLayout> + <Button + android:layout_height="8dp" + android:background="@drawable/rounded_transparent_button" + android:clickable="false" + android:visibility="invisible" /> + </TableRow> - <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" /> + <TableRow + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:weightSum="1"> - <TextView - android:id="@+id/tvFragmentProfileFollowNo" - android:layout_width="110dp" + <LinearLayout + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:text="40" - android:textSize="20dp" - android:textStyle="bold" /> - </LinearLayout> - </TableRow> - </TableLayout> - - - <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:id="@+id/btnFragmentProfileShowMyPosts" - android:layout_width="110dp" + 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="PRATI" /> + </LinearLayout> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="wrap_content" + 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:clickable="true" + 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:clickable="true" + 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> + + + <LinearLayout + android:id="@+id/buttons" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - 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/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" + <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" /> - android:text="Nalog" - android:textColor="@color/cardview_dark_background" + <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: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" /> + + </LinearLayout> + + <FrameLayout + android:id="@+id/flFragmentProfileFragmentContainer" + 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_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_constraintHorizontal_bias="1.0" - app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyRecensions" - app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/buttons" /> + </androidx.constraintlayout.widget.ConstraintLayout> - </LinearLayout> + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> - <FrameLayout - android:id="@+id/flFragmentProfileFragmentContainer" - 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_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> </FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml new file mode 100644 index 0000000..797e2b7 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml @@ -0,0 +1,253 @@ +<?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=".FragmentProfileStatistics" + android:paddingHorizontal="16dp" + android:paddingTop="16dp" + > + + <LinearLayout + android:id="@+id/linearLayout8" + android:layout_width="match_parent" + android:layout_height="wrap_content" + + android:orientation="vertical" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginBottom="5dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + <ImageView + android:id="@+id/imageView13" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_total_views" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView5" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:gravity="center" + android:text="Broj pregleda" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView13" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tvProfileStatisticsViews" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginEnd="16dp" + android:gravity="center" + android:text="0" + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout4" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginBottom="5dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout3"> + + <ImageView + android:id="@+id/imageView14" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_star_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView13" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:gravity="center" + android:text="Broj ocena" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView14" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tvProfileStatisticsRatingNumber" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginEnd="16dp" + android:gravity="center" + android:text="0" + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout5" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout4"> + + <ImageView + android:id="@+id/imageView15" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_star_half_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView14" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:gravity="center" + android:text="Prosečna ocena po objavi" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView15" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tvProfileStatisticsAverageRating" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginEnd="16dp" + android:gravity="center" + android:text="0" + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout7" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_marginBottom="5dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout5"> + + <ImageView + android:id="@+id/imageView16" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_favorite_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/textView15" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:gravity="center" + android:text="Broj omiljenih objava" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView16" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tvProfileStatisticsFavouriteNumber" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginEnd="16dp" + android:gravity="center" + android:text="0" + android:textSize="20dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + </androidx.constraintlayout.widget.ConstraintLayout> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout6" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout7"> + + <ImageView + android:id="@+id/imageView17" + android:layout_width="30dp" + android:layout_height="30dp" + android:src="@drawable/ic_baseline_calendar_month_24" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:gravity="center" + android:text="Pregledi po mesecima" + android:textAllCaps="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@+id/imageView17" + app:layout_constraintTop_toTopOf="parent" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <View + android:id="@+id/divider7" + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="?android:attr/listDivider" /> + + + </LinearLayout> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvFragmentProfileStatisticsMonths" + android:layout_width="match_parent" + android:layout_height="0dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout8" /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file 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 e3db4bc..f2b0ca3 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 @@ -1,20 +1,22 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" - xmlns:app="http://schemas.android.com/apk/res-auto" + + android:background="#FFFCFCFC" + android:orientation="vertical" tools:context=".Fragments.FragmentShowPosts"> <androidx.cardview.widget.CardView android:id="@+id/cvSearch" android:layout_width="match_parent" android:layout_height="40dp" - android:layout_marginTop="10dp" android:layout_marginStart="16dp" + android:layout_marginTop="10dp" android:layout_marginEnd="16dp" - android:elevation="0dp" + android:elevation="10dp" app:cardCornerRadius="20dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -25,10 +27,11 @@ android:id="@+id/etFragmentShowPostsSearch" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/rounded_white_button_login" - android:hint=" Pretraga" - android:paddingLeft="15dp" - android:inputType="textPersonName" /> + + android:backgroundTint="@color/white" + android:hint="Pretraga" + android:inputType="textPersonName" + android:paddingHorizontal="20dp" /> <com.google.android.material.button.MaterialButton android:id="@+id/mbFragmentHomePageSearch" @@ -54,7 +57,7 @@ android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_marginStart="16dp" - android:background="@color/white" + android:background="#FFFCFCFC" android:padding="@dimen/component_padding" android:scaleType="centerCrop" android:src="@drawable/button_filter" @@ -66,36 +69,24 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_weight="1" - android:background="@color/white" + android:visibility="gone" + android:background="#FFFCFCFC" android:padding="@dimen/component_padding" android:scaleType="centerCrop" android:src="@drawable/button_sort" app:layout_constraintStart_toEndOf="@+id/btnSortType" app:layout_constraintTop_toTopOf="parent" /> - <ImageButton - android:id="@+id/btnChat" - android:layout_width="84dp" - android:layout_height="50dp" - android:layout_marginStart="8dp" - android:layout_weight="1" - android:background="@color/white" - android:padding="@dimen/component_padding" - android:scaleType="centerCrop" - android:src="@android:drawable/sym_action_chat" - app:layout_constraintStart_toEndOf="@+id/btnSortDirection" - app:layout_constraintTop_toTopOf="parent" /> <ImageButton android:id="@+id/btnLinearLayout" android:layout_width="50dp" android:layout_height="50dp" - android:layout_marginEnd="16dp" android:layout_weight="1" - android:background="@color/white" + android:background="#FFFCFCFC" android:padding="@dimen/component_padding" android:scaleType="centerCrop" - android:src="@drawable/list_empty" + android:src="@drawable/ic_round_view_list_24" app:layout_constraintEnd_toStartOf="@+id/btnGridLayout" app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toEndOf="@+id/btnSortDirection" @@ -106,29 +97,32 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_marginStart="220dp" + android:layout_marginEnd="16dp" android:layout_weight="1" - android:background="@color/white" + android:background="#FFFCFCFC" android:clickable="true" android:padding="@dimen/component_padding" android:scaleType="centerCrop" - android:src="@drawable/grid_full" + android:src="@drawable/ic_round_grid_view_24" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/btnSortDirection" app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout> -<androidx.swiperefreshlayout.widget.SwipeRefreshLayout - android:layout_height="match_parent" - android:layout_width="match_parent" - android:id="@+id/swipeContainer"> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/rvMain" + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout + android:id="@+id/swipeContainer" android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" > + android:layout_height="match_parent"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvMain" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - </androidx.recyclerview.widget.RecyclerView> -</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> + </androidx.recyclerview.widget.RecyclerView> + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </LinearLayout>
\ No newline at end of file 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 index 250f640..91f1fd7 100644 --- 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 @@ -6,7 +6,16 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".FragmentSinglePostComments"> - +<androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + > + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/constraintLayout2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent"> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/constraintLayout" android:layout_width="match_parent" @@ -50,29 +59,62 @@ app:layout_constraintTop_toBottomOf="@+id/postCommentLayout"> </androidx.recyclerview.widget.RecyclerView> - - <LinearLayout + <androidx.appcompat.widget.LinearLayoutCompat 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" + <androidx.cardview.widget.CardView + android:id="@+id/cvParentCommentEdit" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" - android:hint="Unesite komentar ovde" /> + android:minHeight="40dp" + android:layout_marginBottom="5dp" + android:layout_marginHorizontal="10dp" + android:elevation="16dp" + app:cardCornerRadius="20dp"> + - <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" /> + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/NewComment" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:backgroundTint="@color/white" + android:hint="Unesite komentar..." + android:paddingLeft="10dp" + tools:ignore="TouchTargetSizeCheck" + android:inputType="textCapSentences|textMultiLine"/> - </LinearLayout> + </androidx.cardview.widget.CardView> + <androidx.cardview.widget.CardView + android:id="@+id/cvParentSendButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:minHeight="40dp" + android:backgroundTint="@color/purple_500" + android:layout_marginBottom="5dp" + android:layout_marginEnd="5dp" + android:elevation="16dp" + app:cardCornerRadius="20dp"> + + + <ImageButton + android:id="@+id/btnPostComment" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_gravity="center" + android:layout_margin="10dp" + android:background="@null" + android:scaleType="fitCenter" + android:src="@drawable/ic_baseline_send_white_24" + app:cornerRadius="16dp" + tools:ignore="SpeakableTextPresentCheck" /> + </androidx.cardview.widget.CardView> + </androidx.appcompat.widget.LinearLayoutCompat> + </androidx.constraintlayout.widget.ConstraintLayout> +</androidx.core.widget.NestedScrollView> </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 index 5bbdb14..bf90b04 100644 --- 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 @@ -13,81 +13,136 @@ android:padding="@dimen/component_padding" tools:layout_editor_absoluteX="0dp"> - - <TextView - android:id="@+id/tvDescription" - android:layout_width="wrap_content" + <androidx.cardview.widget.CardView + android:id="@+id/cvDescription" + app:cardCornerRadius="10dp" + android:elevation="15dp" + android:layout_margin="3dp" + android:padding="5dp" + android:layout_width="match_parent" 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" /> + 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" /> + <TextView + android:layout_margin="5dp" + android:id="@+id/tvDescription" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="TextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextViewTextView" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + </androidx.cardview.widget.CardView> <LinearLayout + + android:id="@+id/linearLayout9" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="30dp" android:orientation="horizontal" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/title"> + app:layout_constraintTop_toBottomOf="@+id/cvDescription"> + <TextView + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="Oceni" + + style="@style/title" + android:gravity="center_vertical" + android:layout_weight="1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.005" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvDescription" /> <ImageView - android:clickable="true" android:id="@+id/rateStar1" android:layout_width="50dp" android:layout_height="50dp" + android:clickable="true" android:scaleType="centerCrop" - android:src="@drawable/ic_round_star_outline_24" /> + android:src="@drawable/ic_outline_star_border_24" /> <ImageView - android:clickable="true" android:id="@+id/rateStar2" android:layout_width="50dp" android:layout_height="50dp" + android:clickable="true" android:scaleType="centerCrop" - android:src="@drawable/ic_round_star_outline_24" /> + android:src="@drawable/ic_outline_star_border_24" /> <ImageView - android:clickable="true" android:id="@+id/rateStar3" android:layout_width="50dp" android:layout_height="50dp" + android:clickable="true" android:scaleType="centerCrop" - android:src="@drawable/ic_round_star_outline_24" /> + android:src="@drawable/ic_outline_star_border_24" /> <ImageView - android:clickable="true" android:id="@+id/rateStar4" android:layout_width="50dp" android:layout_height="50dp" + android:clickable="true" android:scaleType="centerCrop" - android:src="@drawable/ic_round_star_outline_24" /> + android:src="@drawable/ic_outline_star_border_24" /> <ImageView - android:clickable="true" android:id="@+id/rateStar5" android:layout_width="50dp" android:layout_height="50dp" + android:clickable="true" android:scaleType="centerCrop" - android:src="@drawable/ic_round_star_outline_24" /> + android:src="@drawable/ic_outline_star_border_24" /> </LinearLayout> + + <TextView + android:id="@+id/tvObrisi" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Sigurno? Brisanje je trajno." + android:visibility="gone" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/btnObrisi" /> + + <Button + android:id="@+id/btnObrisi" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="19dp" + android:text="Obrisi objavu" + android:visibility="gone" + android:backgroundTint="#8B0000" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/linearLayout9" /> + + <Button + android:id="@+id/btnObrisiN" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:backgroundTint="#FFFFFF" + android:textColor="@color/cardview_dark_background" + android:layout_marginStart="20dp" + android:text="Odustani" + android:visibility="gone" + app:layout_constraintStart_toEndOf="@+id/btnObrisiY" + app:layout_constraintTop_toBottomOf="@+id/tvObrisi" /> + + <Button + android:id="@+id/btnObrisiY" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Potvrdi" + android:visibility="gone" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvObrisi" /> + <!--<LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml index 8b820bc..579e402 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_followers.xml @@ -1,18 +1,58 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".Fragments.FragmentUserFollowers"> <!-- TODO: Update blank fragment layout --> <TextView + android:id="@+id/textView17" android:layout_width="match_parent" android:layout_height="match_parent" /> + <androidx.cardview.widget.CardView + android:id="@+id/FragmentBrowseCardViewSearch" + android:layout_width="0dp" + android:layout_height="40dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:elevation="10dp" + app:cardCornerRadius="20dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + <AutoCompleteTextView + android:id="@+id/FragmentFollowersSearchBar" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:backgroundTint="@color/white" + android:hint=" Pretraga" + android:inputType="textPersonName" + android:paddingLeft="15dp" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/FragmentFollowersSearchBButton" + android:layout_width="49dp" + android:layout_height="match_parent" + android:layout_gravity="right" + android:background="#00FFFFFF" + app:backgroundTint="#00FFFFFF" + app:cornerRadius="16dp" + app:icon="@drawable/ic_baseline_search_24" + app:iconTint="#333D70" /> + + </androidx.cardview.widget.CardView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvFragmentUserFollowers" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="wrap_content" + android:layout_marginTop="15dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/FragmentBrowseCardViewSearch" /> -</FrameLayout>
\ No newline at end of file +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml index 7558375..f7c07df 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_following.xml @@ -1,18 +1,58 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".Fragments.FragmentUserFollowing"> <!-- TODO: Update blank fragment layout --> <TextView + android:id="@+id/textView16" android:layout_width="match_parent" android:layout_height="match_parent" /> + <androidx.cardview.widget.CardView + android:id="@+id/FragmentBrowseCardViewSearch" + android:layout_width="0dp" + android:layout_height="40dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:elevation="10dp" + app:cardCornerRadius="20dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + + + <AutoCompleteTextView + android:id="@+id/FragmentFollowingSearchBar" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:backgroundTint="@color/white" + android:hint=" Pretraga" + android:inputType="textPersonName" + android:paddingLeft="15dp" /> + + <com.google.android.material.button.MaterialButton + android:id="@+id/FragmentFollowingSearchBButton" + android:layout_width="49dp" + android:layout_height="match_parent" + android:layout_gravity="right" + android:background="#00FFFFFF" + app:backgroundTint="#00FFFFFF" + app:cornerRadius="16dp" + app:icon="@drawable/ic_baseline_search_24" + app:iconTint="#333D70" /> + + </androidx.cardview.widget.CardView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rvFragmentUserFollowing" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="wrap_content" + android:layout_marginTop="15dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/FragmentBrowseCardViewSearch" /> -</FrameLayout>
\ No newline at end of file +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/opened_post_image.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/opened_post_image.xml new file mode 100644 index 0000000..e63a903 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/opened_post_image.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <com.github.piasy.biv.view.BigImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + app:initScaleType="centerInside" + app:optimizeDisplay="true" + android:id="@+id/ivOpenedImage"/> + +</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_grid_view.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_grid_view.xml new file mode 100644 index 0000000..4b5a03c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_grid_view.xml @@ -0,0 +1,39 @@ +<?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="wrap_content"> + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/postItemGridViewImage" + android:layout_width="match_parent" + android:layout_height="200dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" + android:elevation="5dp" + android:scaleType="centerCrop" + android:src="@color/white" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" + app:shapeAppearanceOverlay="@style/Circular" /> + + <ImageView + android:id="@+id/ivPostItemMultipleImagesIcon" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:elevation="10dp" + android:src="@drawable/ic_baseline_multiple_images_24" + android:visibility="invisible" + app:layout_constraintEnd_toEndOf="@+id/postItemGridViewImage" + app:layout_constraintTop_toTopOf="@+id/postItemGridViewImage" /> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml index 2d32b2d..6584d5c 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_home_page.xml @@ -7,8 +7,8 @@ <com.google.android.material.imageview.ShapeableImageView android:id="@+id/imageView9" - android:layout_width="170dp" - android:layout_height="240dp" + android:layout_width="165dp" + android:layout_height="223dp" android:layout_marginStart="8dp" android:layout_marginTop="4dp" android:layout_marginEnd="8dp" @@ -17,13 +17,27 @@ android:src="@color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0" app:shapeAppearanceOverlay="@style/Circular" /> + <ImageView + android:id="@+id/ivMultipleImagesIcon" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:elevation="10dp" + android:src="@drawable/ic_baseline_multiple_images_24" + android:visibility="invisible" + app:layout_constraintEnd_toEndOf="@+id/ivPIHPBackground" + app:layout_constraintTop_toTopOf="@+id/imageView9" /> + <com.google.android.material.imageview.ShapeableImageView android:id="@+id/ivPIHPBackground" - android:layout_width="172dp" + android:layout_width="165dp" android:layout_height="185dp" android:layout_marginStart="1dp" android:layout_marginEnd="1dp" @@ -39,52 +53,55 @@ <TextView android:id="@+id/tvPIHPLocationName" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="4dp" + android:layout_marginStart="12dp" + android:layout_marginBottom="2dp" + android:maxLines="1" + android:ellipsize="end" android:elevation="3dp" android:text="TextView" - android:textSize="14sp" + android:textSize="13sp" android:textStyle="bold" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground" /> + app:layout_constraintBottom_toTopOf="@+id/tvPIHPLocationDetail" + app:layout_constraintEnd_toStartOf="@+id/imageView10" + app:layout_constraintStart_toStartOf="parent" /> <TextView android:id="@+id/tvPIHPRecension" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginEnd="8dp" + android:layout_marginEnd="4dp" + android:layout_marginBottom="18dp" android:elevation="3dp" android:text="TextView" android:textSize="11dp" android:textStyle="bold" - app:layout_constraintEnd_toEndOf="@+id/imageView9" - app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground" /> + app:layout_constraintBottom_toBottomOf="@+id/imageView9" + app:layout_constraintEnd_toEndOf="@+id/imageView9" /> <ImageView android:id="@+id/imageView10" android:layout_width="15dp" android:layout_height="15dp" - android:layout_marginTop="8dp" + android:layout_marginBottom="18dp" android:elevation="3dp" + app:layout_constraintBottom_toBottomOf="@+id/imageView9" app:layout_constraintEnd_toStartOf="@+id/tvPIHPRecension" - app:layout_constraintTop_toBottomOf="@+id/ivPIHPBackground" app:srcCompat="@drawable/ic_baseline_star_rate_24" /> <ImageView android:id="@+id/imageView11" - android:layout_width="20dp" - android:layout_height="19dp" - android:layout_marginStart="12dp" - android:layout_marginTop="2dp" + android:layout_width="18dp" + android:layout_height="18dp" + android:layout_marginStart="8dp" + android:layout_marginBottom="3dp" android:elevation="3dp" + app:layout_constraintBottom_toBottomOf="@+id/imageView9" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/tvPIHPLocationName" app:srcCompat="@drawable/ic_baseline_location_on_24" /> <TextView @@ -92,15 +109,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="4dp" - android:layout_marginTop="4dp" + android:layout_marginBottom="3dp" android:elevation="3dp" android:text="TextView" android:textSize="11dp" + app:layout_constraintBottom_toBottomOf="@+id/imageView9" app:layout_constraintEnd_toEndOf="@+id/imageView9" app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintStart_toEndOf="@+id/imageView11" - app:layout_constraintTop_toBottomOf="@+id/tvPIHPLocationName" /> + app:layout_constraintStart_toEndOf="@+id/imageView11" /> " /> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml new file mode 100644 index 0000000..1b78ba9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_item_user_post.xml @@ -0,0 +1,122 @@ +<?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:padding="10dp" + android:layout_height="wrap_content"> + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/piupbackgroi" + android:layout_width="match_parent" + android:layout_height="210dp" + android:layout_marginTop="3dp" + android:layout_marginBottom="3dp" + android:layout_marginHorizontal="3dp" + android:elevation="3dp" + android:src="@color/white" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:shapeAppearanceOverlay="@style/Circular" /> + + <ImageView + android:id="@+id/ivMultipleImagesIcon" + android:layout_width="20dp" + android:layout_height="20dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:elevation="10dp" + android:src="@drawable/ic_baseline_multiple_images_24" + android:visibility="invisible" + app:layout_constraintEnd_toEndOf="@+id/piupbackground" + app:layout_constraintTop_toTopOf="@+id/piupbackgroi" /> + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/piupbackground" + android:layout_width="match_parent" + android:layout_height="170dp" + android:layout_marginStart="3dp" + android:layout_marginEnd="3dp" + android:layout_marginHorizontal="3dp" + android:elevation="3dp" + android:scaleType="centerCrop" + app:layout_constraintBottom_toBottomOf="@+id/piupbackgroi" + app:layout_constraintEnd_toEndOf="@id/piupbackgroi" + app:layout_constraintStart_toStartOf="@id/piupbackgroi" + app:layout_constraintTop_toTopOf="@id/piupbackgroi" + app:layout_constraintVertical_bias="0.0" + app:shapeAppearanceOverlay="@style/roundedTop" + app:srcCompat="@drawable/b1" /> + + <TextView + android:id="@+id/piupLocation" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="12dp" + android:layout_marginTop="2dp" + android:maxLines="1" + android:ellipsize="end" + android:elevation="3dp" + android:text="TextView" + android:textSize="13sp" + android:textStyle="bold" + app:layout_constraintEnd_toStartOf="@+id/imageView10" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" /> + + <TextView + android:id="@+id/piuprating" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="3dp" + + android:layout_marginEnd="4dp" + android:elevation="3dp" + android:text="TextView" + android:textSize="11dp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="@+id/piupbackgroi" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" /> + + <ImageView + android:id="@+id/imageView10" + + android:layout_width="15dp" + android:layout_height="15dp" + android:layout_marginTop="3dp" + android:elevation="3dp" + app:layout_constraintEnd_toStartOf="@+id/piuprating" + app:layout_constraintTop_toBottomOf="@+id/piupbackground" + app:srcCompat="@drawable/ic_baseline_star_rate_24" /> + + <ImageView + android:id="@+id/imageView11" + + android:layout_width="18dp" + android:layout_height="18dp" + android:layout_marginStart="8dp" + android:layout_marginTop="2dp" + android:elevation="3dp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/piupLocation" + app:srcCompat="@drawable/ic_baseline_location_on_24" /> + + <TextView + android:id="@+id/piupLocationDetail" + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:elevation="3dp" + android:text="TextView" + android:textSize="11dp" + app:layout_constraintEnd_toEndOf="@+id/piupbackgroi" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/imageView11" + app:layout_constraintTop_toBottomOf="@+id/piupLocation" /> + " /> + + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml index 73e546f..54b11b0 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/post_preview.xml @@ -17,24 +17,38 @@ tools:layout_editor_absoluteY="295dp" />--> <com.google.android.material.imageview.ShapeableImageView - app:shapeAppearanceOverlay="@style/roundedTop" android:id="@+id/locationImage" android:layout_width="match_parent" - android:layout_height="250dp" + android:layout_height="180dp" android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:layout_marginEnd="16dp" android:background="@drawable/b1" + android:elevation="10dp" android:scaleType="centerCrop" 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" + app:shapeAppearanceOverlay="@style/roundedTop" /> + + + <ImageView + android:id="@+id/ivMultipleImagesIcon" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_marginTop="7dp" + android:layout_marginRight="5dp" + android:elevation="10dp" + android:src="@drawable/ic_baseline_multiple_images_24" + android:visibility="invisible" + app:layout_constraintEnd_toEndOf="@+id/locationImage" + app:layout_constraintTop_toTopOf="@+id/locationImage" /> <View android:id="@+id/vBanner" android:layout_width="match_parent" - android:layout_height="70dp" + android:layout_height="55dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" @@ -46,36 +60,41 @@ app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/locationImage" - app:layout_constraintVertical_bias="0.0"> + app:layout_constraintVertical_bias="1.0"> </View> <TextView android:id="@+id/tvTitle" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="28dp" - android:layout_marginTop="8dp" + android:layout_marginTop="4dp" android:elevation="10dp" + android:ellipsize="end" android:gravity="top|left" + android:paddingLeft="5dp" + android:maxLines="1" + android:paddingRight="20dp" android:text="Naslov" - android:textSize="20sp" + android:textSize="18sp" android:textStyle="bold" - app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@+id/tvPostPreviewRating" + app:layout_constraintStart_toStartOf="@+id/locationImage" app:layout_constraintTop_toBottomOf="@+id/locationImage" /> <TextView - android:elevation="10dp" android:id="@+id/tvLocationParent" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_marginStart="28dp" - android:layout_marginTop="4dp" + android:layout_marginStart="24dp" + android:layout_marginTop="1dp" android:drawableLeft="@drawable/ic_baseline_location_on_24" + android:elevation="10dp" android:text="grad, drzava" android:textAlignment="viewEnd" + android:textSize="16sp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/tvTitle" /> @@ -83,13 +102,25 @@ android:id="@+id/tvPostPreviewRating" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="40dp" - android:layout_marginEnd="32dp" + android:layout_marginTop="6dp" + android:layout_marginEnd="24dp" android:drawableLeft="@drawable/ic_baseline_star_rate_24" android:elevation="10dp" android:text="TextView" - android:textSize="17dp" + android:textSize="16dp" android:textStyle="bold" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/locationImage" /> + + <TextView + android:id="@+id/tvPostPreviewDate" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:layout_marginEnd="24dp" + android:elevation="10dp" + + android:textSize="16sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvPostPreviewRating" /> </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 5e0dc03..33c40ae 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_comment.xml @@ -3,8 +3,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:id="@+id/llroot" android:orientation="vertical" - android:padding="@dimen/component_padding" xmlns:app="http://schemas.android.com/apk/res-auto"> <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" @@ -19,6 +19,7 @@ app:layout_constraintEnd_toStartOf="@+id/tvCommentText" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" + android:clickable="true" android:scaleType="centerCrop" tools:layout_editor_absoluteY="27dp" /> <androidx.appcompat.widget.LinearLayoutCompat @@ -26,14 +27,43 @@ android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1"> + <androidx.appcompat.widget.LinearLayoutCompat + android:layout_width="match_parent" + android:layout_height="wrap_content"> + <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"/> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" + android:id="@+id/clReplyCount"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/constraintLayout4" + android:layout_width="5dp" + android:layout_height="5dp" + android:background="@drawable/rounded_picture_background" + android:backgroundTint="@color/unfollow" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/etReplyCount" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + android:padding="@dimen/text_padding" + android:text="0 odgovora" + app:layout_constraintStart_toEndOf="@id/constraintLayout4" + tools:layout_editor_absoluteY="0dp" /> + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.appcompat.widget.LinearLayoutCompat> - <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" @@ -58,30 +88,78 @@ </androidx.appcompat.widget.LinearLayoutCompat> <androidx.appcompat.widget.LinearLayoutCompat + android:id="@+id/llReply" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:id="@+id/llReply"> + android:layout_height="wrap_content"> - <EditText - android:layout_width="match_parent" + <androidx.cardview.widget.CardView + android:id="@+id/cvParentCommentEdit" + android:layout_width="wrap_content" 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" /> + android:minHeight="40dp" + android:layout_marginBottom="5dp" + android:layout_marginHorizontal="10dp" + android:elevation="16dp" + app:cardCornerRadius="20dp"> + + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/etReply" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:backgroundTint="@color/white" + android:hint="Unesite komentar..." + android:paddingLeft="10dp" + tools:ignore="TouchTargetSizeCheck" + android:inputType="textCapSentences|textMultiLine"/> + + </androidx.cardview.widget.CardView> + <androidx.cardview.widget.CardView + android:id="@+id/cvParentSendReplyButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:minHeight="40dp" + android:backgroundTint="@color/purple_500" + android:layout_marginBottom="5dp" + android:layout_marginEnd="5dp" + android:elevation="16dp" + app:cardCornerRadius="20dp"> + + + <ImageButton + android:id="@+id/btnPostReply" + android:layout_width="25dp" + android:layout_height="25dp" + android:layout_gravity="center" + android:layout_margin="10dp" + android:background="@null" + android:scaleType="fitCenter" + android:src="@drawable/ic_baseline_send_white_24" + app:cornerRadius="16dp" + tools:ignore="SpeakableTextPresentCheck" /> + </androidx.cardview.widget.CardView> </androidx.appcompat.widget.LinearLayoutCompat> - <androidx.recyclerview.widget.RecyclerView + <androidx.appcompat.widget.LinearLayoutCompat android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/rvReplies"/> + android:visibility="gone" + android:id="@+id/llReplies"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="2dp" + android:layout_height="match_parent" + android:backgroundTint="@color/unfollow" + android:layout_marginHorizontal="23dp" + android:background="@drawable/rounded_picture_background" + /> + + <androidx.recyclerview.widget.RecyclerView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:id="@+id/rvReplies"/> + </androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml new file mode 100644 index 0000000..f2726db --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_date_view.xml @@ -0,0 +1,31 @@ +<?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:layout_width="match_parent" + android:padding="10dp" + android:layout_height="50dp"> + + <TextView + android:id="@+id/tvMonth" + android:layout_width="80dp" + android:layout_height="match_parent" + android:gravity="left|center_vertical" + android:text="Mesec" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.0" /> + + <TextView + android:id="@+id/tvMonthViews" + android:layout_width="50dp" + android:layout_height="match_parent" + android:gravity="left|center_vertical" + android:text="5" + android:textStyle="bold" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/tvMonth" + 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/single_post_history.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml index 72ead29..16c5814 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/single_post_history.xml @@ -30,16 +30,19 @@ <TextView android:id="@+id/tvTitleSinglePostHistory" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="32dp" android:elevation="5dp" + android:ellipsize="end" android:gravity="top|left" + android:maxLines="1" + android:paddingRight="20dp" android:text="Naslov" android:textSize="20sp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toEndOf="@+id/vBannerSinglePostHistory" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@+id/vBannerSinglePostHistory" diff --git a/Client/BrzoDoLokacije/app/src/main/res/menu/bottom_nav_menu.xml b/Client/BrzoDoLokacije/app/src/main/res/menu/bottom_nav_menu.xml index c024570..533bf34 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/menu/bottom_nav_menu.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/menu/bottom_nav_menu.xml @@ -1,22 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + + > <item android:id="@+id/navHomePage" - android:title="Početna strana" + android:title="Početna" android:icon="@drawable/ic_nav_home"/> <item android:id="@+id/navAllPosts" android:icon="@drawable/ic_baseline_list_24" - android:title="Sve objave" /> + android:title="Objave" /> + <item + android:id="@+id/navAddPost" + android:title="Dodaj" + android:icon="@drawable/add_post_red_image" + android:iconTint="@color/button_main"/> <item android:id="@+id/navBrowse" android:title="Pretraga" android:icon="@drawable/ic_nav_browse"/> <item - android:id="@+id/navAddPost" - android:title="Dodaj" - android:icon="@drawable/ic_nav_addpost"/> - <item android:id="@+id/navProfile" android:title="Profil" android:icon="@drawable/ic_nav_profile"/> diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml index fe34814..e5ec888 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml @@ -8,6 +8,8 @@ <color name="black">#FF000000</color> <color name="white">#FFFFFFFF</color> <color name="unfollow">#c4c4c4</color> + <color name="unfollow_transparent">#66c4c4c4</color> <color name="dark_blue_transparent">#DE093A4C</color> <color name="button_main">#183e4b</color> + <color name="grey">#747474</color> </resources>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml index 0e53f9e..66591b7 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml @@ -45,4 +45,5 @@ <item name="android:layout_width">wrap_content</item> <item name="android:layout_marginTop">7dp</item> </style> + </resources>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/themes.xml b/Client/BrzoDoLokacije/app/src/main/res/values/themes.xml index 0b453e2..593f224 100644 --- a/Client/BrzoDoLokacije/app/src/main/res/values/themes.xml +++ b/Client/BrzoDoLokacije/app/src/main/res/values/themes.xml @@ -12,4 +12,4 @@ <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> </style> -</resources>
\ No newline at end of file + </resources>
\ No newline at end of file @@ -2,4 +2,10 @@ MongoDb 147.91.204.115:10081\ BackEnd 147.91.204.115:10082\ -Link za preuzimanje aplikacije http://147.91.204.115:10082/api/app/Download
\ No newline at end of file +Link za preuzimanje aplikacije http://147.91.204.115:10082/api/app/Download \ +Sifra za preuzimanje aplikacije: jabukakruska123 + +Nalozi za testiranje aplikacije: + + email: tamara.jerinic@gmail.com lozinka: testaplikacije1 + email: ciraboxkg@gmail.com lozinka: cirakg |