diff options
author | Tamara Jerinic <tamara.jerinic@gmail.com> | 2022-11-01 13:08:01 +0000 |
---|---|---|
committer | Tamara Jerinic <tamara.jerinic@gmail.com> | 2022-11-01 13:08:01 +0000 |
commit | 9376e25847ad481618f9d3e448f9a06e0809e8ac (patch) | |
tree | ebf8781816173f39b9ada8528e2eb55c784f267f | |
parent | 41eb14e56a1f0e59347d5d37cb39406ec1ee810a (diff) | |
parent | 55cdd5a31e9da8c50d1971861dca75fadfb63dc4 (diff) |
Merge branch 'develop' into 'master'
Merge dev->master
See merge request BrzoDoLokacije2022/odyssey/brzodolokacije!1
154 files changed, 4230 insertions, 0 deletions
diff --git a/Backend/Api/.gitignore b/Backend/Api/.gitignore new file mode 100644 index 0000000..2afa2e2 --- /dev/null +++ b/Backend/Api/.gitignore @@ -0,0 +1,454 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/Backend/Api/Api.sln b/Backend/Api/Api.sln new file mode 100644 index 0000000..006fcf6 --- /dev/null +++ b/Backend/Api/Api.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Api", "Api\Api.csproj", "{98D1F700-C988-4F19-89D1-9B7D002D702D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98D1F700-C988-4F19-89D1-9B7D002D702D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {98D1F700-C988-4F19-89D1-9B7D002D702D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {98D1F700-C988-4F19-89D1-9B7D002D702D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {98D1F700-C988-4F19-89D1-9B7D002D702D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E6AD5655-69C9-485B-9F63-FF2F67F42B51} + EndGlobalSection +EndGlobal diff --git a/Backend/Api/Api/Api.csproj b/Backend/Api/Api/Api.csproj new file mode 100644 index 0000000..93e31b7 --- /dev/null +++ b/Backend/Api/Api/Api.csproj @@ -0,0 +1,18 @@ +<Project Sdk="Microsoft.NET.Sdk.Web"> + + <PropertyGroup> + <TargetFramework>net6.0</TargetFramework> + <Nullable>enable</Nullable> + <ImplicitUsings>enable</ImplicitUsings> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.10" /> + <PackageReference Include="MongoDB.Driver" Version="2.18.0" /> + <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> + <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.24.0" /> + <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" /> + <PackageReference Include="MailKit" Version="3.4.2" /> + </ItemGroup> + +</Project> diff --git a/Backend/Api/Api/Controllers/AuthController.cs b/Backend/Api/Api/Controllers/AuthController.cs new file mode 100644 index 0000000..d835d97 --- /dev/null +++ b/Backend/Api/Api/Controllers/AuthController.cs @@ -0,0 +1,77 @@ +using Api.Interfaces; +using Api.Models; +using Microsoft.AspNetCore.Mvc; + +namespace Api.Controllers +{ + [Route("api/auth/")] + public class AuthController : Controller + { + private readonly IUserService _userService; + public AuthController(IUserService userService) + { + _userService = userService; + } + + [HttpPost("register")] + public async Task<ActionResult<string>> Register([FromBody] Register creds) + { + //this is beyond scuffed and will be cleaned up later, when users,login and controllers are made + User novi = new User(); + novi.email = creds.email; + novi.password = creds.password; + novi.username = creds.username; + novi.name = creds.name; + novi.verified = true; + novi.creationDate = DateTime.Now.ToUniversalTime(); + novi._id = ""; + + int ret= await _userService.createUser(novi); + if (ret == -1) + return BadRequest("email already exists"); + if (ret == -2) + return BadRequest("username already exists"); + + return Ok(); + } + [HttpPost("login")] + public async Task<ActionResult<string>> Login([FromBody] Login creds) + { + var id = await _userService.UserIdFromJwt(); + if (id != null) return Forbid(); + + var jwt= await _userService.Login(creds); + if (jwt != null) + { + return Ok(jwt); + } + return BadRequest("Pogresno uneti podaci"); + } + [HttpPost("registeractual")] + public async Task<ActionResult<string>> RegisterActual([FromBody] Register creds) + { + var msg = await _userService.Register(creds); + if (msg == "Email Exists") + return Forbid(msg); + if (msg == "Username Exists") + return Forbid(msg); + return Ok(msg); + } + [HttpPost("verify")] + public async Task<ActionResult<string>> VerifyEmail([FromBody] VerifyUser creds) + { + var uspeh = await _userService.VerifyUser(creds); + if (!uspeh) + return BadRequest("Kod netacan ili istekao"); + return Ok("Uspesno verifikovan"); + } + [HttpPost("resetpass")] + public async Task<ActionResult<string>> ResetPass([FromBody] ResetPass creds) + { + var uspeh = await _userService.ResetPassword(creds); + if (!uspeh) + return BadRequest("Kod netacan ili istekao"); + return Ok("Sifra uspesno resetovana"); + } + } +} diff --git a/Backend/Api/Api/Database/DatabaseConnection.cs b/Backend/Api/Api/Database/DatabaseConnection.cs new file mode 100644 index 0000000..65f4f52 --- /dev/null +++ b/Backend/Api/Api/Database/DatabaseConnection.cs @@ -0,0 +1,11 @@ +using Api.Interfaces; + +namespace Api.Database +{ + public class DatabaseConnection : IDatabaseConnection + { + public string ConnectionString { get; set; } = String.Empty; + public string DatabaseName { get; set; } = String.Empty; + public string UserCollectionName { get; set; } = String.Empty; + } +} diff --git a/Backend/Api/Api/Interfaces/IDatabaseConnection.cs b/Backend/Api/Api/Interfaces/IDatabaseConnection.cs new file mode 100644 index 0000000..8938127 --- /dev/null +++ b/Backend/Api/Api/Interfaces/IDatabaseConnection.cs @@ -0,0 +1,9 @@ +namespace Api.Interfaces +{ + public interface IDatabaseConnection + { + string ConnectionString { get; set; } + string DatabaseName { get; set; } + string UserCollectionName { get; set; } + } +} diff --git a/Backend/Api/Api/Interfaces/IJwtService.cs b/Backend/Api/Api/Interfaces/IJwtService.cs new file mode 100644 index 0000000..6274bf9 --- /dev/null +++ b/Backend/Api/Api/Interfaces/IJwtService.cs @@ -0,0 +1,13 @@ +using Api.Models; + +namespace Api.Interfaces +{ + public interface IJwtService + { + string GenToken(User user); + string TokenToId(string token); + public string GenEmailToken(User user); + public string EmailTokenToId(string token); + public string EmailTokenToKod(string token); + } +}
\ No newline at end of file diff --git a/Backend/Api/Api/Interfaces/IUserService.cs b/Backend/Api/Api/Interfaces/IUserService.cs new file mode 100644 index 0000000..5205028 --- /dev/null +++ b/Backend/Api/Api/Interfaces/IUserService.cs @@ -0,0 +1,26 @@ +using Api.Models; + +namespace Api.Interfaces +{ + public interface IUserService + { + Task<int> createUser(User user); + Task<List<User>> getUsers(); + Task<User> getUserByEmail(String email); + Task<User> getUserByUsername(String username); + Task<long> updateUser(User user); + Task<User> deleteUser(String email); + Task<User> getUserById(string id); + + Task<string> RenewToken(string existingToken); + Task<string> Login(Login login); + Task<string> Register(Register register); + Task<Boolean> VerifyUser(VerifyUser login); + Task<string> UserIdFromJwt(); + Task<Boolean> ResendVerifyKod(Login login); + Boolean SendEmailKod(User user); + Task<Boolean> ForgotPassword(JustMail jm); + Task<Boolean> ResetPassword(ResetPass rp); + + } +} diff --git a/Backend/Api/Api/Models/User.cs b/Backend/Api/Api/Models/User.cs new file mode 100644 index 0000000..a1fe149 --- /dev/null +++ b/Backend/Api/Api/Models/User.cs @@ -0,0 +1,51 @@ +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + +namespace Api.Models +{ + public class User + { + [BsonId] + [BsonRepresentation(BsonType.ObjectId)] + public String _id { get; set; } + public String name { get; set; } + public String username { get; set; } + public String email { get; set; } + public String emailToken { get; set; } + public Boolean verified { get; set; } + public String password { get; set; } + public DateTime creationDate { get; set; } + } + + public class Login + { + public String email { get; set; } + public String password { get; set; } + } + + public class Register + { + public String name { get; set; } + public String username { get; set; } + public String email { get; set; } + public String password { get; set; } + } + + public class JustMail + { + public String email { get; set; } + } + + public class ResetPass + { + public String email { get; set; } + public String newpass { get; set; } + public String kod { get; set; } + } + public class VerifyUser + { + public String email { get; set; } + public String password { get; set; } + public String kod { get; set; } + } +} diff --git a/Backend/Api/Api/Program.cs b/Backend/Api/Api/Program.cs new file mode 100644 index 0000000..4643937 --- /dev/null +++ b/Backend/Api/Api/Program.cs @@ -0,0 +1,78 @@ +using System.Text; +using Api.Database; +using Api.Interfaces; +using Api.Services; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.Extensions.Options; +using Microsoft.IdentityModel.Tokens; +using MongoDB.Driver; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.Configure<DatabaseConnection>( + builder.Configuration.GetSection("DatabaseSettings")); + +builder.Services.AddSingleton<IDatabaseConnection>(sp => + sp.GetRequiredService<IOptions<DatabaseConnection>>().Value); + +builder.Services.AddSingleton<IMongoClient>(s => + new MongoClient(builder.Configuration.GetValue<string>("DatabaseSettings:ConnectionString"))); + +builder.Services.AddScoped<IUserService, UserService>(); +builder.Services.AddScoped<IJwtService, JwtService>(); + +builder.Services.AddHttpContextAccessor(); + + + + +//Add Authentication +builder.Services.AddAuthentication( + JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options => { + options.TokenValidationParameters = new TokenValidationParameters + { + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(builder.Configuration.GetSection("AppSettings:JwtToken").Value)), + ValidateIssuer = false, + ValidateAudience = false + }; + + }); + + + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +builder.Services.AddCors(options => +{ + options.AddPolicy("CorsPolicy", + builder => + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials()); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseAuthorization(); + +//Add Authentication +app.UseAuthentication(); + +app.MapControllers(); + +app.Run(); diff --git a/Backend/Api/Api/Properties/launchSettings.json b/Backend/Api/Api/Properties/launchSettings.json new file mode 100644 index 0000000..8ad1068 --- /dev/null +++ b/Backend/Api/Api/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61217", + "sslPort": 0 + } + }, + "profiles": { + "Api": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5279", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Backend/Api/Api/Services/JwtService.cs b/Backend/Api/Api/Services/JwtService.cs new file mode 100644 index 0000000..9d928f7 --- /dev/null +++ b/Backend/Api/Api/Services/JwtService.cs @@ -0,0 +1,130 @@ +using System.Data; +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using System.Text; +using System.Xml.Linq; +using Api.Interfaces; +using Api.Models; +using Microsoft.Extensions.Configuration; +using Microsoft.IdentityModel.Tokens; + +namespace Api.Services +{ + public class JwtService : IJwtService + { + private readonly IConfiguration _config; + public JwtService(IConfiguration config) + { + _config = config; + } + + public string GenToken(User user) + { + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.ASCII.GetBytes(_config.GetSection("AppSettings:JwtToken").Value); + var tokenDescriptor = new SecurityTokenDescriptor + { + Subject = new ClaimsIdentity(new[] { new Claim("id", user._id) }), + Expires = DateTime.UtcNow.AddDays(7), + SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) + }; + var token = tokenHandler.CreateToken(tokenDescriptor); + return tokenHandler.WriteToken(token); + } + public string TokenToId(string token) + { + if (token == null) + return null; + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.ASCII.GetBytes(_config.GetSection("AppSettings:JwtToken").Value); + try + { + tokenHandler.ValidateToken(token, new TokenValidationParameters + { + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(key), + ValidateIssuer = false, + ValidateAudience = false, + }, out SecurityToken validatedToken); + + var jwtToken = (JwtSecurityToken)validatedToken; + return jwtToken.Claims.First(x => x.Type == "id").Value; + } + catch + { + return null; + } + + } + public string GenEmailToken(User user) + { + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.ASCII.GetBytes(_config.GetSection("AppSettings:EmailToken").Value); + Random rand = new Random((int)DateTime.Now.Ticks); + int kod = rand.Next(100000, 999999); + var tokenDescriptor = new SecurityTokenDescriptor + { + Subject = new ClaimsIdentity(new[] { new Claim("username", user.username), new Claim("kod",kod.ToString()), new Claim("id", user._id) }), + Expires = DateTime.UtcNow.AddMinutes(30), + SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) + }; + var token = tokenHandler.CreateToken(tokenDescriptor); + return tokenHandler.WriteToken(token); + } + + public string EmailTokenToId(string token) + { + if (token == null) + return null; + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.ASCII.GetBytes(_config.GetSection("AppSettings:EmailToken").Value.ToString()); + try + { + tokenHandler.ValidateToken(token, new TokenValidationParameters + { + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(key), + ValidateIssuer = false, + ValidateAudience = false, + ClockSkew = TimeSpan.Zero + }, + out SecurityToken validatedToken); + var jwtToken = (JwtSecurityToken)validatedToken; + var username = (jwtToken.Claims.First(x => x.Type == "username").Value.ToString()); + return username; + } + catch + { + return null; + } + } + + public string EmailTokenToKod(string token) + { + if (token == null) + return null; + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.ASCII.GetBytes(_config.GetSection("AppSettings:EmailToken").Value.ToString()); + try + { + tokenHandler.ValidateToken(token, new TokenValidationParameters + { + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(key), + ValidateIssuer = false, + ValidateAudience = false, + ClockSkew = TimeSpan.Zero + }, + out SecurityToken validatedToken); + var jwtToken = (JwtSecurityToken)validatedToken; + var kod = (jwtToken.Claims.First(x => x.Type == "kod").Value.ToString()); + return kod; + } + catch + { + return null; + } + } + + } +} diff --git a/Backend/Api/Api/Services/UserService.cs b/Backend/Api/Api/Services/UserService.cs new file mode 100644 index 0000000..3002f34 --- /dev/null +++ b/Backend/Api/Api/Services/UserService.cs @@ -0,0 +1,271 @@ +using Api.Interfaces; +using Api.Models; +using MongoDB.Driver; +using Microsoft.AspNetCore.Http; +using System.Security.Claims; +using MimeKit; +using MailKit.Net.Smtp; + +namespace Api.Services +{ + public class UserService : IUserService + { + private readonly IHttpContextAccessor _httpContext; + private readonly IMongoCollection<User> _users; + private readonly IJwtService _jwtService; + private IConfiguration _configuration; + public UserService(IDatabaseConnection settings, IMongoClient mongoClient, IJwtService jwtService, IHttpContextAccessor httpContextAccessor, IConfiguration configuration) + { + var database = mongoClient.GetDatabase(settings.DatabaseName); + _users = database.GetCollection<User>(settings.UserCollectionName); + _jwtService = jwtService; + this._httpContext = httpContextAccessor; + this._configuration = configuration; + } + + public async Task<int> createUser(User user) + { + if (await _users.Find(x => x.email == user.email).FirstOrDefaultAsync() != null) + return -1; //email already exists + if (await _users.Find(x => x.username == user.username).FirstOrDefaultAsync() != null) + return -2; //username already + // + user.password = hashPassword(user.password); + await _users.InsertOneAsync(user); + return 1; + } + + public async Task<User> deleteUser(string email) + { + return await _users.FindOneAndDeleteAsync(x => x.email == email); + } + + public async Task<User> getUserByEmail(string email) + { + return await _users.Find(x => x.email == email).SingleOrDefaultAsync(); + } + + public async Task<User> getUserByUsername(string username) + { + return await _users.Find(x => x.username == username).SingleOrDefaultAsync(); + } + + public async Task<List<User>> getUsers() + { + return await _users.Find(_=>true).ToListAsync(); + } + + public async Task<User> getUserById(string id) + { + return await _users.Find(user => user._id == id).SingleOrDefaultAsync(); + + } + + public async Task<long> updateUser(User user) + { + /* vraca broj izmenjenih korisnika + * ovako je odradjeno da bi radilo i kada se posalje potpuno novi objekat User-a bez generisanog _id polja + */ + User foundUser = await _users.Find(x => x.email == user.email).SingleOrDefaultAsync(); + if (foundUser!=null && user._id==null) + { + user._id = foundUser._id; + } + ReplaceOneResult res=await _users.ReplaceOneAsync(x => x.email == user.email, user); + if(res.IsAcknowledged) + return res.ModifiedCount; + return 0; + } + + private static int difficulty = 10; + + public static String hashPassword(String password) + { + String salt = BCrypt.Net.BCrypt.GenerateSalt(difficulty); + String passwordHash = BCrypt.Net.BCrypt.HashPassword(password, salt); + + return passwordHash; + } + + public static Boolean checkPassword(String plainText, String hash) + { + Boolean verified = false; + + if (hash == null || !hash.StartsWith("$2a$")) + return false; + + verified = BCrypt.Net.BCrypt.Verify(plainText, hash); + + return verified; + + } + + public async Task<string> Register(Register register) + { + if (await _users.FindAsync(x => x.email == register.email && x.verified==true).Result.AnyAsync()) + return "Email Exists"; + else if (await _users.FindAsync(x => x.username == register.username && x.verified==true).Result.AnyAsync()) + return "Username Exists"; + else + { + List<User> unverified = await _users.Find(x => (x.username == register.username || x.email == register.email) && x.verified == false).ToListAsync(); + if (unverified.Count > 0) + { + foreach(var usr in unverified) + { + //ako user nema validan emailtoken, a nije verifikovan prethodno, onda se brise iz baze + if (_jwtService.EmailTokenToId(usr.emailToken) == null) + await _users.FindOneAndDeleteAsync(x => x._id == usr._id); + } + } + } + + var user = new User(); + user.email = register.email; + user.username = register.username; + user.name = register.name; + user.verified = false; + user.password = hashPassword(register.password); + user.creationDate = DateTime.Now.ToUniversalTime(); + user.emailToken = ""; + + await _users.InsertOneAsync(user); + + user.emailToken = _jwtService.GenEmailToken(user); + await _users.ReplaceOneAsync(x => x._id == user._id, user); + SendEmailKod(user); + + return "User Registered"; + } + + public async Task<Boolean> VerifyUser(VerifyUser login) + { + User user = await _users.FindAsync(x => x.email == login.email).Result.FirstOrDefaultAsync(); + if (user != null && checkPassword(login.password, user.password)) + { + var basekod = _jwtService.EmailTokenToKod(user.emailToken); + if (basekod != null) + if (String.Compare(login.kod,basekod) == 0) + { + user.verified = true; + await _users.ReplaceOneAsync(x => x._id == user._id, user); + return true; + } + } + return false; + } + + public async Task<string> RenewToken(string existingToken) + { + var id = _jwtService.TokenToId(existingToken); + if (id == null) + return null; + var user = await getUserById(id); + + return _jwtService.GenToken(user); + } + + public async Task<string> Login(Login login) + { + User user = await _users.FindAsync(x => x.email == login.email && x.verified == true).Result.FirstOrDefaultAsync(); + if (user != null && checkPassword(login.password, user.password)) + { + return _jwtService.GenToken(user); + } + return null; + } + + public async Task<string> UserIdFromJwt() + { + string id = null; + if (_httpContext.HttpContext.User.FindFirstValue("id") != null) + { + id = _httpContext.HttpContext.User.FindFirstValue("id").ToString(); + var _id = await _users.FindAsync(x => x._id == id).Result.FirstOrDefaultAsync(); + if (_id == null) + id = null; + } + return id; + } + + public async Task<Boolean> ResendVerifyKod(Login login) + { + User user = await _users.FindAsync(x => x.email == login.email).Result.FirstOrDefaultAsync(); + if (user != null && checkPassword(login.password, user.password)) + { + user.emailToken = _jwtService.GenEmailToken(user); + await _users.ReplaceOneAsync(x => x._id == user._id, user); + SendEmailKod(user); + + return true; + } + return false; + } + + public Boolean SendEmailKod(User user) + { + MimeMessage message = new MimeMessage(); + message.From.Add(new MailboxAddress("Tim Oddyssey", _configuration.GetSection("EmailCfg:Email").Value)); + message.To.Add(MailboxAddress.Parse(user.email)); + message.Subject = "Vas Oddyssey verifikacioni kod"; //think of something better yeah? + + var kod = _jwtService.EmailTokenToKod(user.emailToken); + if (kod == null) + return false; + + var bodybuilder = new BodyBuilder(); + bodybuilder.HtmlBody = String.Format(@"<h3>Verfikacioni kod:</h3><h2>"+kod+"</h2><br><p>Kod traje <b>30</b> minuta</p>"); + message.Body = bodybuilder.ToMessageBody(); + + SmtpClient client = new SmtpClient(); + try + { + client.Connect(_configuration.GetSection("EmailCfg:SmtpServer").Value, 465, true); + client.Authenticate(_configuration.GetSection("EmailCfg:Email").Value, _configuration.GetSection("EmailCfg:Password").Value); + client.Send(message); + + } + catch (Exception ex) + { + return false; + } + finally + { + client.Disconnect(true); + client.Dispose(); + } + return true; + } + + public async Task<Boolean> ForgotPassword(JustMail jm) + { + User user = await _users.FindAsync(x => x.email == jm.email && x.verified == true).Result.FirstOrDefaultAsync(); + if (user != null) + { + user.emailToken = _jwtService.GenEmailToken(user); + await _users.ReplaceOneAsync(x => x._id == user._id, user); + SendEmailKod(user); + + return true; + } + return false; + } + + public async Task<Boolean> ResetPassword(ResetPass rp) + { + User user = await _users.FindAsync(x => x.email == rp.email && x.verified == true).Result.FirstOrDefaultAsync(); + if (user != null) + { + var basekod = _jwtService.EmailTokenToKod(user.emailToken); + if (basekod != null) + if (String.Compare(rp.kod, basekod) == 0) + { + user.password = hashPassword(rp.newpass); + await _users.ReplaceOneAsync(x => x._id == user._id, user); + return true; + } + } + return false; + } + } +} diff --git a/Backend/Api/Api/appsettings.Development.json b/Backend/Api/Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Backend/Api/Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Backend/Api/Api/appsettings.json b/Backend/Api/Api/appsettings.json new file mode 100644 index 0000000..48086f3 --- /dev/null +++ b/Backend/Api/Api/appsettings.json @@ -0,0 +1,26 @@ +{ + "AppSettings": { + "JwtToken": "PjrVqQJ1P2VOkuWLw7NaZUluT4z7bkau", + "EmailToken": "e8X8c0lm9KS7itWi3wgE6BiPXR21WPvO" + }, + + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "DatabaseSettings": { + + "ConnectionString": "mongodb://127.0.0.1:27017/", + "DatabaseName": "Odyssey", + "UserCollectionName": "users" + + }, + "EmailCfg": { + "Email": "oddyssey.brzodolokacije@gmail.com", + "SmtpServer": "smtp.gmail.com", + "Password": "nrokhfcwahfbqnpp" //msbs#556 + } +} diff --git a/Client/.gitkeep b/Client/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/.gitkeep diff --git a/Client/BrzoDoLokacije/.gitignore b/Client/BrzoDoLokacije/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/Client/BrzoDoLokacije/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/Client/BrzoDoLokacije/.idea/.gitignore b/Client/BrzoDoLokacije/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Client/BrzoDoLokacije/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Client/BrzoDoLokacije/.idea/compiler.xml b/Client/BrzoDoLokacije/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/Client/BrzoDoLokacije/.idea/compiler.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="CompilerConfiguration"> + <bytecodeTargetLevel target="11" /> + </component> +</project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/.idea/gradle.xml b/Client/BrzoDoLokacije/.idea/gradle.xml new file mode 100644 index 0000000..a2d7c21 --- /dev/null +++ b/Client/BrzoDoLokacije/.idea/gradle.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <option name="testRunner" value="GRADLE" /> + <option name="distributionType" value="DEFAULT_WRAPPED" /> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="modules"> + <set> + <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/app" /> + </set> + </option> + </GradleProjectSettings> + </option> + </component> +</project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/.idea/misc.xml b/Client/BrzoDoLokacije/.idea/misc.xml new file mode 100644 index 0000000..bdd9278 --- /dev/null +++ b/Client/BrzoDoLokacije/.idea/misc.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/build/classes" /> + </component> + <component name="ProjectType"> + <option name="id" value="Android" /> + </component> +</project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/.idea/vcs.xml b/Client/BrzoDoLokacije/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/Client/BrzoDoLokacije/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/.gitignore b/Client/BrzoDoLokacije/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/Client/BrzoDoLokacije/app/.gitignore @@ -0,0 +1 @@ +/build
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/build.gradle b/Client/BrzoDoLokacije/app/build.gradle new file mode 100644 index 0000000..f6faf0d --- /dev/null +++ b/Client/BrzoDoLokacije/app/build.gradle @@ -0,0 +1,55 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} + +android { + namespace 'com.example.brzodolokacije' + compileSdk 32 + + defaultConfig { + applicationId "com.example.brzodolokacije" + minSdk 21 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + buildFeatures { + viewBinding true + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.5.1' + implementation 'com.google.android.material:material:1.7.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + //Retrofit + implementation 'com.squareup.retrofit2:retrofit:2.7.2' + implementation 'com.squareup.retrofit2:converter-gson:2.7.2' + + //JWT + implementation 'com.auth0.android:jwtdecode:2.0.1' +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/proguard-rules.pro b/Client/BrzoDoLokacije/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/Client/BrzoDoLokacije/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/androidTest/java/com/example/brzodolokacije/ExampleInstrumentedTest.kt b/Client/BrzoDoLokacije/app/src/androidTest/java/com/example/brzodolokacije/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..ac8d356 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/androidTest/java/com/example/brzodolokacije/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.brzodolokacije + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.example.brzodolokacije", appContext.packageName) + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/debug/ic_launcher-playstore.png b/Client/BrzoDoLokacije/app/src/debug/ic_launcher-playstore.png Binary files differnew file mode 100644 index 0000000..3e623b5 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/ic_launcher-playstore.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_addpost.xml b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_addpost.xml new file mode 100644 index 0000000..768552f --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_addpost.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="#333333" + android:alpha="0.6"> + <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/debug/res/drawable-anydpi/ic_nav_browse.xml b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_browse.xml new file mode 100644 index 0000000..8beebb7 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_browse.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="#333333" + android:alpha="0.6"> + <path + android:fillColor="@android:color/white" + android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2 0,0.68 0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2 0,-0.68 0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2 0,0.68 -0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2 0,-0.68 -0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_home.xml b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_home.xml new file mode 100644 index 0000000..cd6cfd6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_home.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="#333333" + android:alpha="0.6"> + <path + android:fillColor="@android:color/white" + android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_profile.xml b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_profile.xml new file mode 100644 index 0000000..198e013 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-anydpi/ic_nav_profile.xml @@ -0,0 +1,11 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="#333333" + android:alpha="0.6"> + <path + android:fillColor="@android:color/white" + android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_addpost.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_addpost.png Binary files differnew file mode 100644 index 0000000..5a45901 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_addpost.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_browse.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_browse.png Binary files differnew file mode 100644 index 0000000..79684b3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_browse.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_home.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_home.png Binary files differnew file mode 100644 index 0000000..c6da75f --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_home.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_profile.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_profile.png Binary files differnew file mode 100644 index 0000000..d065a96 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-hdpi/ic_nav_profile.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_addpost.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_addpost.png Binary files differnew file mode 100644 index 0000000..6ab5495 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_addpost.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_browse.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_browse.png Binary files differnew file mode 100644 index 0000000..4356671 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_browse.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_home.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_home.png Binary files differnew file mode 100644 index 0000000..cb1f92f --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_home.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_profile.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_profile.png Binary files differnew file mode 100644 index 0000000..9de92dc --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-mdpi/ic_nav_profile.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/b1.jpg b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/b1.jpg Binary files differnew file mode 100644 index 0000000..6c86a45 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/b1.jpg diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_addpost.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_addpost.png Binary files differnew file mode 100644 index 0000000..d58180b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_addpost.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_browse.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_browse.png Binary files differnew file mode 100644 index 0000000..26b1bf3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_browse.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_home.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_home.png Binary files differnew file mode 100644 index 0000000..f6c17d5 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_home.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_profile.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_profile.png Binary files differnew file mode 100644 index 0000000..8c2ff94 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xhdpi/ic_nav_profile.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_addpost.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_addpost.png Binary files differnew file mode 100644 index 0000000..573a645 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_addpost.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_browse.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_browse.png Binary files differnew file mode 100644 index 0000000..90f6390 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_browse.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_home.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_home.png Binary files differnew file mode 100644 index 0000000..40d14fb --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_home.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_profile.png b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_profile.png Binary files differnew file mode 100644 index 0000000..99793cc --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/drawable-xxhdpi/ic_nav_profile.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..4ae7d12 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@mipmap/ic_launcher_background"/> + <foreground android:drawable="@mipmap/ic_launcher_foreground"/> +</adaptive-icon>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..4ae7d12 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@mipmap/ic_launcher_background"/> + <foreground android:drawable="@mipmap/ic_launcher_foreground"/> +</adaptive-icon>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..3ab4acb --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_background.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_background.png Binary files differnew file mode 100644 index 0000000..a8a6cb9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_background.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 0000000..ce57665 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_foreground.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 0000000..54c4f06 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..4dfe37c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_background.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_background.png Binary files differnew file mode 100644 index 0000000..4465788 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_background.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 0000000..2093171 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_foreground.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 0000000..e394809 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..960bf6a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.png Binary files differnew file mode 100644 index 0000000..1934227 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_background.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 0000000..bc70fc1 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_foreground.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 0000000..6508da3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..73df669 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.png Binary files differnew file mode 100644 index 0000000..b2edcde --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_background.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 0000000..920c97d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_foreground.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 0000000..7c5c954 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..8a1b252 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.png Binary files differnew file mode 100644 index 0000000..09cca42 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_background.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png Binary files differnew file mode 100644 index 0000000..2452c55 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_foreground.png diff --git a/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png Binary files differnew file mode 100644 index 0000000..bc9a0c6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..edf65a2 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/AndroidManifest.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + + <uses-permission android:name="android.permission.INTERNET" /> + + <application + android:allowBackup="true" + android:dataExtractionRules="@xml/data_extraction_rules" + android:fullBackupContent="@xml/backup_rules" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/Theme.BrzoDoLokacije" + android:usesCleartextTraffic="true" + tools:targetApi="31"> + <activity android:name=".Activities.ActivityForgottenPasswordVerify" /> + <activity android:name=".Activities.ActivityForgottenPassword" /> + <activity android:name=".Activities.ActivityLoginRegister" /> + <activity android:name=".Activities.NavigationActivity" /> + <activity + android:name=".MainActivity" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + + <meta-data + android:name="android.app.lib_name" + android:value="" /> + </activity> + </application> + +</manifest>
\ No newline at end of file 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 new file mode 100644 index 0000000..e7c9836 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPassword.kt @@ -0,0 +1,27 @@ +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.Toast +import com.example.brzodolokacije.R + +class ActivityForgottenPassword : AppCompatActivity() { + private lateinit var sendCode: Button + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_forgotten_password) + + sendCode=findViewById<View>(R.id.forgottenPasswordSendCode) as Button + + sendCode.setOnClickListener{ + intent= Intent(this, ActivityForgottenPasswordVerify::class.java) + startActivity(intent) + } + + } + + +}
\ No newline at end of file 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 new file mode 100644 index 0000000..6533237 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityForgottenPasswordVerify.kt @@ -0,0 +1,28 @@ +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.Toast +import com.example.brzodolokacije.MainActivity +import com.example.brzodolokacije.R + +class ActivityForgottenPasswordVerify : AppCompatActivity() { + private lateinit var changePassword: Button + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_forgotten_password_verify) + + changePassword=findViewById<View>(R.id.btnChangePassword) as Button + changePassword.setOnClickListener{ + Toast.makeText( + this, "Lozinka je uspešno promenjena.", Toast.LENGTH_LONG + ).show(); + + intent= Intent(this, ActivityLoginRegister::class.java) + startActivity(intent) + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityLoginRegister.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityLoginRegister.kt new file mode 100644 index 0000000..f5843aa --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/ActivityLoginRegister.kt @@ -0,0 +1,65 @@ +package com.example.brzodolokacije.Activities + +import android.graphics.drawable.Drawable +import android.os.Build +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.Button +import android.widget.Toast +import androidx.annotation.RequiresApi +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentTransaction +import com.example.brzodolokacije.Fragments.FragmentLogin +import com.example.brzodolokacije.Fragments.FragmentRegister +import com.example.brzodolokacije.R +import com.google.android.material.internal.ContextUtils.getActivity + +class ActivityLoginRegister : AppCompatActivity() { + + private lateinit var login: Button + private lateinit var register: Button + + + + @RequiresApi(Build.VERSION_CODES.M) + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_login_register) + Log.d("main","123456") + login=findViewById<View>(R.id.btnFragmentActivityLRLogin) as Button + register=findViewById<View>(R.id.btnFragmentActivityLRRegister) as Button + //var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + //fm.replace(R.id.flFragmentActivityLRFragmentsView,FragmentLogin()) + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentActivityLRFragmentsView,FragmentLogin()) + fm.commit() + login.setOnClickListener{ + login.setTextColor(getColor(R.color.white)) + register.setTextColor(getColor(R.color.teal_700)) + login.setBackgroundResource(R.drawable.rounded_cyan_button) + register.setBackgroundResource(R.drawable.rounded_transparent_button) + Log.d("main","prijavi se") + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentActivityLRFragmentsView,FragmentLogin()) + fm.commit() + } + + register.setOnClickListener{ + Log.d("main","prijavi se") + register.setTextColor(getColor(R.color.white)) + login.setTextColor(getColor(R.color.teal_700)) + register.setBackgroundResource(R.drawable.rounded_cyan_button) + login.setBackgroundResource(R.drawable.rounded_transparent_button) + var fm: FragmentTransaction =supportFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentActivityLRFragmentsView, FragmentRegister()) + fm.commit() + } + } + +} 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 new file mode 100644 index 0000000..0933460 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Activities/NavigationActivity.kt @@ -0,0 +1,46 @@ +package com.example.brzodolokacije.Activities + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.View +import android.widget.Button +import androidx.fragment.app.Fragment +import com.example.brzodolokacije.Fragments.FragmentAddPost +import com.example.brzodolokacije.Fragments.FragmentBrowse +import com.example.brzodolokacije.Fragments.FragmentHome +import com.example.brzodolokacije.Fragments.FragmentProfile +import com.example.brzodolokacije.R +import com.google.android.material.bottomnavigation.BottomNavigationView + +class NavigationActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_navigation) + + val homeFragment=FragmentHome() + val browseFragment=FragmentBrowse() + val addPostFragment=FragmentAddPost() + val profileFragment=FragmentProfile() + val bottomNav=findViewById<View>(R.id.bottomNavigationView) as BottomNavigationView + setCurrentFragment(homeFragment) + bottomNav.setOnNavigationItemSelectedListener { + when(it.itemId){ + R.id.navHome->setCurrentFragment(homeFragment) + R.id.navAddPost->setCurrentFragment(addPostFragment) + R.id.navBrowse->setCurrentFragment(browseFragment) + R.id.navProfile->setCurrentFragment(profileFragment) + + } + true + } + + + } + private fun setCurrentFragment(fragment: Fragment)= + supportFragmentManager.beginTransaction().apply { + replace(R.id.flNavigationFragment,fragment) + commit() + } + + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/SampleAdapter.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/SampleAdapter.kt new file mode 100644 index 0000000..c4ebbbb --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Adapters/SampleAdapter.kt @@ -0,0 +1,32 @@ +package com.example.brzodolokacije.Adapters + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView +import com.example.brzodolokacije.Models.ListItemModel +import com.example.brzodolokacije.databinding.ListItemBinding + +class SampleAdapter (val items : MutableList<ListItemModel>) + : RecyclerView.Adapter<SampleAdapter.ViewHolder>(){ + //constructer has one argument - list of objects that need to be displayed + //it is bound to xml of single item + private lateinit var binding: ListItemBinding + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val inflater = LayoutInflater.from(parent.context) + binding=ListItemBinding.inflate(inflater,parent,false) + return ViewHolder(binding) + } + override fun onBindViewHolder(holder: ViewHolder, position: Int){ + //sets components of particular item + holder.bind(items[position]) + } + override fun getItemCount() = items.size + inner class ViewHolder(itemView : ListItemBinding) : RecyclerView.ViewHolder(itemView.root){ + fun bind(item : ListItemModel){ + binding.apply { + tvId.text=item.id.toString() + tvName.text=item.name + } + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddPost.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddPost.kt new file mode 100644 index 0000000..b6452e9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentAddPost.kt @@ -0,0 +1,48 @@ +package com.example.brzodolokacije.Fragments + +import android.content.Intent +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import com.example.brzodolokacije.Activities.ActivityLoginRegister +import com.example.brzodolokacije.Activities.NavigationActivity +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.SharedPreferencesHelper + + +class FragmentAddPost : Fragment(R.layout.fragment_add_post) { + + + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view:View=inflater.inflate(R.layout.fragment_add_post, container, false) + // Inflate the layout for this fragment + val logOutButton=view.findViewById<View>(R.id.btnFragmentAddLogOut) as Button + logOutButton.setOnClickListener{ + logOut() + } + return view; + } + + fun logOut(){ + if(SharedPreferencesHelper.removeValue("jwt",requireActivity())) + { + val intent= Intent(requireActivity(), ActivityLoginRegister::class.java) + startActivity(intent) + } + } + + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt new file mode 100644 index 0000000..1bd98a0 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentBrowse.kt @@ -0,0 +1,60 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.example.brzodolokacije.R + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentBrowse.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentBrowse : Fragment(R.layout.fragment_browse) { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_browse, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment FragmentBrowse. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + FragmentBrowse().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt new file mode 100644 index 0000000..fd5aa33 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentHome.kt @@ -0,0 +1,61 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import android.util.Log +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.example.brzodolokacije.Adapters.SampleAdapter +import com.example.brzodolokacije.Models.ListItemModel +import com.example.brzodolokacije.R +import com.example.brzodolokacije.databinding.FragmentHomeBinding + +/** + * A simple [Fragment] subclass. + * Use the [FragmentHome.newInstance] factory method to + * create an instance of this fragment. + */ + +class FragmentHome : Fragment(R.layout.fragment_home) { + + private lateinit var binding: FragmentHomeBinding + private var nameList : MutableList<ListItemModel> = mutableListOf() + private var layoutManagerVar: RecyclerView.LayoutManager? = null + private var adapterVar: RecyclerView.Adapter<SampleAdapter.ViewHolder>? = null + private var recyclerView:RecyclerView?=null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + //load data for the list + loadData() + //instantiate adapter and linearLayout + adapterVar=SampleAdapter(nameList) + layoutManagerVar=LinearLayoutManager(activity) + } + + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val rootView = inflater?.inflate(R.layout.fragment_home, container, false) + recyclerView = rootView?.findViewById(R.id.rvMain) + // set recyclerView attributes + recyclerView?.setHasFixedSize(true) + recyclerView?.layoutManager = layoutManagerVar + recyclerView?.adapter = adapterVar + return rootView + } + fun loadData(){ + nameList.add(ListItemModel(1,"Sample 1")) + nameList.add(ListItemModel(2,"Sample 2")) + nameList.add(ListItemModel(3,"Sample 3")) + nameList.add(ListItemModel(4,"Sample 4")) + nameList.add(ListItemModel(5,"Sample 5")) + nameList.add(ListItemModel(6,"Sample 6")) + } +} 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 new file mode 100644 index 0000000..6e9d75f --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentLogin.kt @@ -0,0 +1,151 @@ +package com.example.brzodolokacije.Fragments + +import android.content.Intent +import android.graphics.Color +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import android.widget.Toast + +import com.example.brzodolokacije.Activities.ActivityLoginRegister +import com.example.brzodolokacije.Activities.NavigationActivity + +import com.example.brzodolokacije.Activities.ActivityForgottenPassword + + +import com.example.brzodolokacije.Interfaces.IAuthApi +import com.example.brzodolokacije.Models.Auth.Login +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import com.example.brzodolokacije.Services.SharedPreferencesHelper +import retrofit2.Call +import retrofit2.Response + + +class FragmentLogin : Fragment() { + // TODO: Rename and change types of parameters + private lateinit var password: EditText + private lateinit var email: EditText + private lateinit var forgottenPassword: TextView + private lateinit var login: Button + private lateinit var passwordString:String + private lateinit var emailString:String + + + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + val view:View=inflater.inflate(R.layout.fragment_login, container, false) + + + email = view.findViewById<View>(R.id.etFragmentLoginEmail) as EditText + password = view.findViewById<View>(R.id.etFragmentLoginPassword) as EditText + forgottenPassword = view.findViewById<View>(R.id.tvFragmentLoginForgottenPassword) as TextView + login=view.findViewById<View>(R.id.btnFragmentLoginLogin) as Button + + //osluskivanje unosa + + login.setOnClickListener{ + emailString=email.text.toString().trim() + passwordString=password.text.toString().trim() + //prazan unos? + if(emailString.isEmpty()) + { + email.hint="Unesite Email adresu" + email.setHintTextColor(Color.RED) + }/* + else{ + if(checkEmail(emailString)==false){ + email.hint="Pogrešan unos, unesite ispravnu Email adresu" + email.setHintTextColor(Color.RED) + } + }*/ + if(passwordString.isEmpty()) + { + password.hint = "Unesite lozinku" + password.setHintTextColor(Color.RED) + + }/* + else{ + if(checkPassword(passwordString)==false) { + password.hint = "Lozinka mora imati najmanje 6 karaktera" + password.setHintTextColor(Color.RED) + } + } +*/ + if(!emailString.isEmpty() && !passwordString.isEmpty()&& checkPassword(passwordString)==true && checkEmail(emailString)==true) { + + var loginData= Login(emailString,passwordString) + val authApi= RetrofitHelper.getInstance().create(IAuthApi::class.java) + val request=authApi.login(loginData) + + request.enqueue(object : retrofit2.Callback<String?> { + 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(); + //TODO(navigate to main page) + SharedPreferencesHelper.addValue("jwt",token,activity!!) + val intent= Intent(activity!!, NavigationActivity::class.java) + startActivity(intent) + }else{ + if(response.errorBody()!=null) + Toast.makeText(activity, response.errorBody()!!.string(), Toast.LENGTH_LONG).show(); + } + + + } + + override fun onFailure(call: Call<String?>, t: Throwable) { + Toast.makeText( + activity, t.toString(), Toast.LENGTH_LONG + ).show(); + } + }) + + } + } + + // zaboravljena lozinka + forgottenPassword.setOnClickListener{ + val intent = Intent (getActivity(), ActivityForgottenPassword::class.java) + getActivity()?.startActivity(intent) + } + + + + + + return view + + } + fun checkEmail(emailString:String):Boolean{ + val emailRegex = "^[A-Za-z](.*)([@]{1})(.{1,})(\\.)(.{1,})" + if(!(emailRegex.toRegex().matches(emailString))){ + email.hint="Pogrešan unos, unesite ispravnu Email adresu" + email.setHintTextColor(Color.RED) + return false + } + else{ + return true + } + } + + fun checkPassword(passwordString:String):Boolean{ + if(passwordString.length<6){ + return false + } + return true + } + +}
\ No newline at end of file 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 new file mode 100644 index 0000000..9c4c370 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyProfileInfo.kt @@ -0,0 +1,60 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.example.brzodolokacije.R + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentMyProfileInfo.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentMyProfileInfo : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_my_profile_info, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment FragmentMyProfileInfo. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + FragmentMyProfileInfo().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyRecensions.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyRecensions.kt new file mode 100644 index 0000000..ce8679a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentMyRecensions.kt @@ -0,0 +1,60 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.example.brzodolokacije.R + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentMyRecensions.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentMyRecensions : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_my_recensions, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment FragmentMyRecensions. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + FragmentMyRecensions().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt new file mode 100644 index 0000000..a8176b0 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentProfile.kt @@ -0,0 +1,93 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import android.util.Log +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import androidx.fragment.app.FragmentTransaction +import com.example.brzodolokacije.R +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentProfile.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentProfile : Fragment(R.layout.fragment_profile) { + // TODO: Rename and change types of parameters + private lateinit var username: TextView + private lateinit var name: TextView + private lateinit var postsCount: TextView + private lateinit var followersCount: TextView + private lateinit var followingCount:TextView + private lateinit var usernameString: String + private lateinit var nameString: String + private lateinit var postsCountString: String + private lateinit var followersCountString: String + private lateinit var followingCountString:String + private lateinit var showMyPosts: Button + private lateinit var showMyData: Button + private lateinit var showMyRecensions: Button + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + val view:View= inflater.inflate(R.layout.fragment_profile, container, false) + name = view.findViewById<View>(R.id.tvFragmentProfileName) as TextView + username = view.findViewById<View>(R.id.tvFragmentProfileUserName) as TextView + postsCount = view.findViewById<View>(R.id.tvFragmentProfilePostsNo) as TextView + followersCount = view.findViewById<View>(R.id.tvFragmentProfileFollowersNo) as TextView + followingCount = view.findViewById<View>(R.id.tvFragmentProfileFollowNo) as TextView + + showMyPosts=view.findViewById<View>(R.id.btnFragmentProfileShowMyPosts) as Button + showMyData=view.findViewById<View>(R.id.btnFragmentProfileShowMyData) as Button + showMyRecensions=view.findViewById<View>(R.id.btnFragmentProfileShowMyRecensions) as Button + //podaci iz baze + + + + showMyPosts.setOnClickListener{ + + var fm: FragmentTransaction =childFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentProfileFragmentContainer,FragmentUserPosts()) + fm.commit() + } + + + showMyData.setOnClickListener{ + + var fm: FragmentTransaction =childFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentProfileFragmentContainer,FragmentMyProfileInfo()) + fm.commit() + } + + showMyRecensions.setOnClickListener{ + + var fm: FragmentTransaction =childFragmentManager.beginTransaction() + + fm.replace(R.id.flFragmentProfileFragmentContainer,FragmentMyRecensions()) + fm.commit() + } + + return view + } + + +}
\ No newline at end of file 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 new file mode 100644 index 0000000..9f028dc --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentRegister.kt @@ -0,0 +1,143 @@ +package com.example.brzodolokacije.Fragments + +import android.graphics.BitmapFactory +import android.graphics.Color +import android.os.Bundle +import android.util.Base64 +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.EditText +import android.widget.Toast +import com.example.brzodolokacije.Interfaces.IAuthApi +import com.example.brzodolokacije.Models.Auth.Register +import com.example.brzodolokacije.R +import com.example.brzodolokacije.Services.RetrofitHelper +import okhttp3.ResponseBody +import retrofit2.Call +import retrofit2.Response +import javax.security.auth.callback.Callback + +class FragmentRegister : Fragment() { + // TODO: Rename and change types of parameters + private lateinit var password: EditText + private lateinit var email: EditText + private lateinit var username: EditText + private lateinit var name: EditText + private lateinit var register: Button + private lateinit var usernameString:String + private lateinit var nameString:String + private lateinit var passwordString:String + private lateinit var emailString:String + + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + val view:View=inflater.inflate(R.layout.fragment_register, container, false) + + email = view.findViewById<View>(R.id.etFragmentRegisterEmail) as EditText + password = view.findViewById<View>(R.id.etFragmentRegisterPassword) as EditText + username = view.findViewById<View>(R.id.etFragmentRegisterUser) as EditText + name = view.findViewById<View>(R.id.etFragmentRegisterName) as EditText + register=view.findViewById<View>(R.id.btnFragmentRegisterRegister) as Button + + //osluskivanje unosa + + register.setOnClickListener{ + emailString=email.text.toString().trim() + usernameString=username.text.toString().trim() + nameString=name.text.toString().trim() + passwordString=password.text.toString().trim() + + //prazan unos? neispravan email + if(emailString.isEmpty()) + { + email.hint="Unesite Email adresu" + email.setHintTextColor(Color.RED) + } + if(passwordString.isEmpty()) + { + password.hint = "Unesite lozinku" + password.setHintTextColor(Color.RED) + } + if(usernameString.isEmpty()) + { + username.hint = "Unesite korisničko ime" + username.setHintTextColor(Color.RED) + } + if(nameString.isEmpty()) + { + name.hint = "Unesite ime i prezime" + name.setHintTextColor(Color.RED) + } + if(!emailString.isEmpty() && !passwordString.isEmpty() && !nameString.isEmpty() && !usernameString.isEmpty()) { + + var registerData=Register(nameString,usernameString,emailString,passwordString) + + val authApi=RetrofitHelper.getInstance().create(IAuthApi::class.java) + + val request=authApi.register(registerData) + + request.enqueue(object : retrofit2.Callback<ResponseBody?> { + override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) { + if(response.isSuccessful()){ + Toast.makeText( + activity, "Uspesna registracija. Verifikujte email.", Toast.LENGTH_LONG + ).show(); + //TODO(navigate to login) + }else{ + if(response.errorBody()!=null) { + Toast.makeText( + activity, + response.errorBody()!!.string(), + Toast.LENGTH_LONG + ).show() + } + } + + + } + + override fun onFailure(call: Call<ResponseBody?>, t: Throwable) { + Toast.makeText( + activity, "Greska, pokusajte ponovo.", Toast.LENGTH_LONG + ).show(); + } + }) + + + + //***DODATI broj karaktera lozinke, provera da li je email sa @ i .com + + } + } + + + return view + } +/* + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment fragmentRegister. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + fragmentRegister().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + }*/ +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt new file mode 100644 index 0000000..561de10 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Fragments/FragmentUserPosts.kt @@ -0,0 +1,60 @@ +package com.example.brzodolokacije.Fragments + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.example.brzodolokacije.R + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [FragmentUserPosts.newInstance] factory method to + * create an instance of this fragment. + */ +class FragmentUserPosts : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_user_posts, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment FragmentUserPosts. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + FragmentUserPosts().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IAuthApi.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IAuthApi.kt new file mode 100644 index 0000000..bd430a8 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Interfaces/IAuthApi.kt @@ -0,0 +1,15 @@ +package com.example.brzodolokacije.Interfaces + +import com.example.brzodolokacije.Models.Auth.Login +import com.example.brzodolokacije.Models.Auth.Register +import okhttp3.ResponseBody +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.POST + +interface IAuthApi { + @POST("/api/auth/login") + fun login(@Body obj:Login): Call<String> + @POST("/api/auth/register") + fun register(@Body obj:Register):Call<ResponseBody> +}
\ 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 new file mode 100644 index 0000000..1208564 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/MainActivity.kt @@ -0,0 +1,42 @@ +package com.example.brzodolokacije + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import com.auth0.android.jwt.JWT +import com.example.brzodolokacije.Activities.ActivityLoginRegister +import com.example.brzodolokacije.Activities.NavigationActivity +import com.example.brzodolokacije.Services.SharedPreferencesHelper + + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + val intent:Intent + + if(checkLoggedIn()) + intent= Intent(this, NavigationActivity::class.java) + else + intent= Intent(this, ActivityLoginRegister::class.java) + + + startActivity(intent) + } + + fun checkLoggedIn():Boolean{ + var jwtString=SharedPreferencesHelper.getValue("jwt",this) + if(jwtString==null) + return false + var jwt:JWT=JWT(jwtString) + if(jwt.isExpired(30)) + return false + return true + + + + + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Login.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Login.kt new file mode 100644 index 0000000..136b8dd --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Login.kt @@ -0,0 +1,6 @@ +package com.example.brzodolokacije.Models.Auth + +data class Login( + var email:String, + var password:String +) diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Register.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Register.kt new file mode 100644 index 0000000..bcb0d2b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Auth/Register.kt @@ -0,0 +1,8 @@ +package com.example.brzodolokacije.Models.Auth + +data class Register( + var name:String, + var username:String, + var email:String, + var password:String +) diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/ListItemModel.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/ListItemModel.kt new file mode 100644 index 0000000..48e519e --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/ListItemModel.kt @@ -0,0 +1,6 @@ +package com.example.brzodolokacije.Models + +data class ListItemModel ( + val id:Int , + val name: String + )
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/LocationTypes.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/LocationTypes.kt new file mode 100644 index 0000000..c599dae --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/LocationTypes.kt @@ -0,0 +1,4 @@ +package com.example.brzodolokacije.Models + +enum class LocationTypes { +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt new file mode 100644 index 0000000..9c0eae1 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/Post.kt @@ -0,0 +1,12 @@ +package com.example.brzodolokacije.Models + +import java.util.* + +data class Post ( + var _id:String, + var creationDate: Date, + var country:String,//drzava + var city:String, + var location:String,//naziv grada/naziv planine/naziv jezera/....... + var type:LocationTypes //tip lokacije + )
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt new file mode 100644 index 0000000..52090f9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Models/User.kt @@ -0,0 +1,23 @@ +package com.example.brzodolokacije.Models + +import java.util.Date + +data class User ( + var _id:String, + var name:String, + var username:String, + var email:String, + var emailToken:String, + var verified:Boolean, + var password:String, + var creationDate:Date, + + //profil + var followers:List<User>, + var followersNumber:Int, + var following:List<User>, + var followingNumber:Int, + var postIds:List<Int>, + var postNumber:Int + +)
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/RetrofitHelper.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/RetrofitHelper.kt new file mode 100644 index 0000000..cc7eb56 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/RetrofitHelper.kt @@ -0,0 +1,20 @@ +package com.example.brzodolokacije.Services + +import com.google.gson.GsonBuilder +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory + + +object RetrofitHelper { + val baseUrl="http://10.0.2.2:5279" + fun getInstance():Retrofit{ + val gson = GsonBuilder() + .setLenient() + .create() + return Retrofit.Builder().baseUrl(baseUrl) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() + } +} +//Usage +//Api = RetrofitHelper.getInstance().create(class)
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/SharedPreferencesHelper.kt b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/SharedPreferencesHelper.kt new file mode 100644 index 0000000..a6da94a --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/java/com/example/brzodolokacije/Services/SharedPreferencesHelper.kt @@ -0,0 +1,42 @@ +package com.example.brzodolokacije.Services + +import android.app.Activity +import android.content.Context +import android.content.SharedPreferences +import android.content.SharedPreferences.Editor +import androidx.fragment.app.FragmentActivity + +object SharedPreferencesHelper { + val prefName:String="OdysseyPreferences" + + fun getValue(key:String,act: FragmentActivity):String?{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + return pref.getString(key,null) + } + fun getValue(key:String,act: Activity):String?{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + return pref.getString(key,null) + } + fun addValue(key:String,value:String,act:FragmentActivity):Boolean{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + var editor:Editor=pref.edit() + editor.putString(key,value) + return editor.commit() + } + fun addValue(key:String,value:String,act:Activity):Boolean{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + var editor:Editor=pref.edit() + editor.putString(key,value) + return editor.commit() + } + fun removeValue(key:String,act: FragmentActivity):Boolean{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + return pref.edit().remove(key).commit() + } + fun removeValue(key:String,act: Activity):Boolean{ + var pref:SharedPreferences=act.getSharedPreferences(prefName,Context.MODE_PRIVATE) + return pref.edit().remove(key).commit() + } + + +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="85.84757" + android:endY="92.4963" + android:startX="42.9492" + android:startY="49.59793" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> +</vector>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/b3.jpg b/Client/BrzoDoLokacije/app/src/main/res/drawable/b3.jpg Binary files differnew file mode 100644 index 0000000..f04899d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/b3.jpg diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_left_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_left_radius.xml new file mode 100644 index 0000000..8ab5223 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_left_radius.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#CCFFFFFF"/> + <stroke android:width="2dp" android:color="#FF1C789A"/> + + <corners + android:topLeftRadius="100dp" + android:topRightRadius="0dp" + android:bottomLeftRadius="100dp" + android:bottomRightRadius="0dp" + /> +</shape>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/button_right_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_right_radius.xml new file mode 100644 index 0000000..9b1ac29 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/button_right_radius.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#CCFFFFFF"/> + <stroke android:width="2dp" android:color="#FF1C789A"/> + + <corners + android:topLeftRadius="0dp" + android:topRightRadius="100dp" + android:bottomLeftRadius="0dp" + android:bottomRightRadius="100dp" + /> +</shape>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient.xml new file mode 100644 index 0000000..0e20af4 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/gradient.xml @@ -0,0 +1,12 @@ +<shape + xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + + <gradient + android:type="linear" + android:startColor="#260D62A9" + android:endColor="#D9063739" + android:angle="270" + /> + +</shape> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_launcher_background.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#3DDC84" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> +</vector> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_bottom_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_bottom_radius.xml new file mode 100644 index 0000000..ac29f68 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_bottom_radius.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#CCFFFFFF"/> + + <padding android:left="2dp" + android:top="2dp" + android:right="2dp" + android:bottom="2dp"/> + + <corners + android:topLeftRadius="0dp" + android:topRightRadius="0dp" + android:bottomLeftRadius="30dp" + android:bottomRightRadius="30dp" + /> +</shape>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_top_radius.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_top_radius.xml new file mode 100644 index 0000000..5d71138 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/login_register_background_top_radius.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#CCFFFFFF"/> + <padding android:left="2dp" + android:top="2dp" + android:right="2dp" + android:bottom="2dp"/> + + <corners + android:topLeftRadius="30dp" + android:topRightRadius="30dp" + android:bottomLeftRadius="0dp" + android:bottomRightRadius="0dp" + /> +</shape>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_cyan_button.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_cyan_button.xml new file mode 100644 index 0000000..c2c005d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_cyan_button.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="100dp"/> + <solid android:color="#FF1C789A"></solid> +</shape> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_transparent_button.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_transparent_button.xml new file mode 100644 index 0000000..5b420a0 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_transparent_button.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="100dp"/> + <solid android:color="#00FFFFFF"></solid> +</shape> diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_white_button_login.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_white_button_login.xml new file mode 100644 index 0000000..1a4c57d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/rounded_white_button_login.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <solid android:color="#FFFFFF"/> + <corners android:radius="100dp"/> + <stroke android:width="2dp" android:color="#FF1C789A"/> + +</shape>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/switch_login_register_on.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/switch_login_register_on.xml new file mode 100644 index 0000000..6bf62c6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/switch_login_register_on.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="100dp"/> + <solid android:color="#FFFFFF"></solid> + <stroke android:width="2dp" android:color="#FF1C789A"/> +</shape> 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 new file mode 100644 index 0000000..5841b49 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password.xml @@ -0,0 +1,75 @@ +<?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.ActivityForgottenPassword"> + + <LinearLayout + android:layout_width="399dp" + android:layout_height="556dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.154"> + + <ImageView + android:id="@+id/imageView" + android:layout_width="match_parent" + android:layout_height="300dp" + app:srcCompat="@mipmap/ic_launcher_foreground" /> + + <TextView + android:id="@+id/tvActivityForgottenPasswordText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Zaboravljena lozinka?" + android:textSize="25dp" /> + + + <TextView + android:id="@+id/textView2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Unesi Email adresu na koju ćemo ti poslati kod za resetovanje." /> + + <Space + android:layout_width="match_parent" + android:layout_height="30dp" /> + + <TextView + android:id="@+id/textView4" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Email" /> + + <EditText + android:id="@+id/editTextTextPersonName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Unesi Email" + android:inputType="textPersonName" /> + + <Space + android:layout_width="match_parent" + android:layout_height="30dp" /> + + <Button + android:id="@+id/forgottenPasswordSendCode" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/rounded_cyan_button" + android:gravity="center" + android:text="Pošalji Email za promenu lozinke" /> + + <Space + android:layout_width="match_parent" + android:layout_height="30dp" /> + + </LinearLayout> + +</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 new file mode 100644 index 0000000..c652469 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_forgotten_password_verify.xml @@ -0,0 +1,106 @@ +<?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.ActivityForgottenPassword"> + + <LinearLayout + android:layout_width="398dp" + android:layout_height="match_parent" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.154"> + + <ImageView + android:id="@+id/imageView" + android:layout_width="match_parent" + android:layout_height="300dp" + app:srcCompat="@mipmap/ic_launcher_foreground" /> + + <TextView + android:id="@+id/tvActivityForgottenPasswordText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Verifikuj novu lozinku" + android:textSize="25dp" /> + + <Space + android:layout_width="match_parent" + android:layout_height="20dp" /> + + <TextView + android:id="@+id/textView2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Unesi kod koji je poslat na email." /> + + + <EditText + android:id="@+id/editTextTextPersonName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Unesi kod" + android:inputType="textPersonName" /> + + <Space + android:layout_width="match_parent" + android:layout_height="20dp" /> + + <TextView + android:id="@+id/textViewoldpass" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Nova lozinka" /> + + <EditText + android:hint="*********" + android:id="@+id/editTextoldPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPassword" /> + + <Space + android:layout_width="match_parent" + android:layout_height="20dp" /> + + <TextView + android:id="@+id/textViewnewpass" + android:layout_width="match_parent" + android:layout_height="wrap_content" + + android:text="Potvrdi novu lozinku" /> + + <EditText + android:hint="*********" + android:id="@+id/editTextTextPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPassword" /> + + <Space + android:layout_width="match_parent" + android:layout_height="20dp" /> + + <Button + android:id="@+id/btnChangePassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/rounded_cyan_button" + android:gravity="center" + android:text="Promeni lozinku" /> + + <Space + android:layout_width="match_parent" + android:layout_height="30dp" /> + + </LinearLayout> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_login_register.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_login_register.xml new file mode 100644 index 0000000..0f82285 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_login_register.xml @@ -0,0 +1,101 @@ +<?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:elevation="0dp" + android:background="@drawable/b1" + tools:context=".Activities.ActivityLoginRegister"> + + <ImageView + android:id="@+id/imageView2" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0" + app:srcCompat="@drawable/gradient" /> + + <androidx.constraintlayout.widget.ConstraintLayout + android:background="@drawable/login_register_background_top_radius" + + android:id="@+id/linearLayout" + android:layout_width="0dp" + android:layout_height="65dp" + android:layout_marginStart="50dp" + android:layout_marginEnd="50dp" + android:gravity="center|center_horizontal" + android:orientation="horizontal" + app:layout_constraintBottom_toTopOf="@+id/flFragmentActivityLRFragmentsView" + app:layout_constraintEnd_toEndOf="@+id/imageView2" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0"> + + <ImageView + android:id="@+id/imageView5" + android:layout_width="280dp" + android:layout_height="40dp" + android:background="@drawable/rounded_white_button_login" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0"></ImageView> + + <android.widget.Button + android:id="@+id/btnFragmentActivityLRLogin" + android:layout_width="139dp" + android:layout_height="40dp" + android:background="@drawable/rounded_cyan_button" + android:elevation="25dp" + android:padding="0dp" + + android:text="Prijavi se" + android:textColor="@color/white" + app:layout_constraintBottom_toBottomOf="@+id/imageView5" + app:layout_constraintEnd_toStartOf="@+id/btnFragmentActivityLRRegister" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="@+id/imageView5" + app:layout_constraintTop_toTopOf="@+id/imageView5" /> + + <android.widget.Button + android:id="@+id/btnFragmentActivityLRRegister" + android:layout_width="140dp" + android:layout_height="40dp" + android:textColor="#FF1C789A" + android:background="@drawable/rounded_transparent_button" + android:elevation="25dp" + android:padding="0dp" + android:text="Registruj se" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/imageView5" + app:layout_constraintTop_toTopOf="@+id/imageView5" + app:layout_constraintVertical_bias="0.0" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + <FrameLayout + android:id="@+id/flFragmentActivityLRFragmentsView" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="50dp" + android:layout_marginEnd="50dp" + android:background="@drawable/login_register_background_bottom_radius" + android:elevation="20dp" + android:foregroundGravity="center_vertical|center" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/imageView2" + app:layout_constraintVertical_bias="0.411"> + + + </FrameLayout> + + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_main.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..312e35d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,13 @@ +<?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=".MainActivity"> +<TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="MAIN" + /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml new file mode 100644 index 0000000..afe1bbf --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/activity_navigation.xml @@ -0,0 +1,28 @@ +<?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.NavigationActivity"> + + <FrameLayout + android:id="@+id/flNavigationFragment" + android:layout_width="match_parent" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.google.android.material.bottomnavigation.BottomNavigationView + android:id="@+id/bottomNavigationView" + android:layout_width="match_parent" + android:layout_height="75dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.5" + app:layout_constraintStart_toStartOf="parent" + 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/fragment_add_post.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_add_post.xml new file mode 100644 index 0000000..2cf3c8c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_add_post.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentAddPost"> + + <!-- TODO: Update blank fragment layout --> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="Post Add" /> + + <Button + android:id="@+id/btnFragmentAddLogOut" + android:layout_width="200dp" + android:layout_height="40dp" + android:layout_marginTop="40dp" + android:background="@drawable/rounded_cyan_button" + android:backgroundTint="#1C789A" + android:text="Log Out" /> + +</FrameLayout>
\ 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 new file mode 100644 index 0000000..3287683 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_browse.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentBrowse"> + + <!-- TODO: Update blank fragment layout --> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="Browse" /> + +</FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home.xml new file mode 100644 index 0000000..f548fe3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_home.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentHome"> + <!-- + RecyclerView holds the items of the list + --> + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/rvMain" + android:layout_height="match_parent" + android:layout_width="match_parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent"/> + +</FrameLayout> diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml new file mode 100644 index 0000000..c45051b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_login.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center_horizontal" + tools:context=".Fragments.FragmentLogin"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + + android:padding="20dp"> + + <TextView + android:id="@+id/tvFragimentLoginEmail" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:text="Email" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <EditText + android:id="@+id/etFragmentLoginEmail" + android:layout_width="match_parent" + android:layout_height="50dp" + android:layout_marginTop="0dp" + android:ems="10" + android:hint="primer@gmail.com" + android:inputType="textEmailAddress" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragimentLoginEmail" /> + + <TextView + android:id="@+id/tvFragmentLoginPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="24dp" + android:text="Lozinka" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/etFragmentLoginEmail" /> + + <EditText + android:id="@+id/etFragmentLoginPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="0dp" + android:ems="10" + android:hint="*********" + android:inputType="textPassword" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="1.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentLoginPassword" /> + + <Button + android:id="@+id/btnFragmentLoginLogin" + android:layout_width="200dp" + android:layout_height="40dp" + android:layout_marginTop="40dp" + android:background="@drawable/rounded_cyan_button" + android:backgroundTint="#1C789A" + android:text="Prijavi se" + app:layout_constraintDimensionRatio="w,1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentLoginForgottenPassword" /> + + <TextView + android:id="@+id/tvFragmentLoginForgottenPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="20dp" + android:clickable="true" + android:text="Zaboravljena lozinka?" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.498" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/etFragmentLoginPassword" /> + + </androidx.constraintlayout.widget.ConstraintLayout> +</FrameLayout>
\ No newline at end of file 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 new file mode 100644 index 0000000..d20c569 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_profile_info.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentMyProfileInfo"> + + <!-- TODO: Update blank fragment layout --> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="Moji podaci" /> + +</FrameLayout>
\ No newline at end of file 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 new file mode 100644 index 0000000..d5452b9 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_my_recensions.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentMyRecensions"> + + <!-- TODO: Update blank fragment layout --> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="Moje recenzije" /> + +</FrameLayout>
\ 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 new file mode 100644 index 0000000..e7cccff --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile.xml @@ -0,0 +1,226 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentProfile"> + + + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ImageView + + android:id="@+id/imageView3" + android:layout_width="match_parent" + android:layout_height="290dp" + 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:id="@+id/imageView4" + android:layout_width="411dp" + android:layout_height="287dp" + 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="156dp" + android:layout_marginEnd="20dp" + android:adjustViewBounds="true" + android:background="#E8FFFFFF" + android:elevation="20dp" + 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" /> + + + <com.google.android.material.imageview.ShapeableImageView + android:id="@+id/tvFragmentProfileProfilePicture" + android:layout_width="150dp" + android:layout_height="150dp" + android:layout_gravity="center" + android:layout_margin="5dp" + android:layout_marginTop="4dp" + android:layout_marginEnd="108dp" + android:adjustViewBounds="true" + android:elevation="21dp" + android:scaleType="fitCenter" + android:src="@drawable/ic_launcher_background" + app:layout_constraintBottom_toTopOf="@+id/tableLayout" + app:layout_constraintEnd_toEndOf="@+id/imageView3" + app:layout_constraintHorizontal_bias="0.483" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/imageView3" + app:layout_constraintVertical_bias="1.0" + app:shapeAppearanceOverlay="@style/imageViewCircle" /> + + <TableLayout + android:id="@+id/tableLayout" + android:layout_width="323dp" + 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"> + + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content" + + android:gravity="center"> + + <TextView + android:id="@+id/tvFragmentProfileName" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="Petar Petrović" /> + </TableRow> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content" + + android:gravity="center"> + + <TextView + android:id="@+id/tvFragmentProfileUserName" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:text="#PetarP" /> + </TableRow> + <Space android:layout_height="20dp"></Space> + + <TableRow + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center"> + + <TextView + android:id="@+id/tvFragmentProfilePosts" + android:gravity="center" + android:text="OBJAVE" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowers" + android:gravity="center" + android:text="PRATIOCI" /> + + <TextView + android:id="@+id/tvFragmentProfileFollow" + android:gravity="center" + android:text="PRAĆENJA" /> + </TableRow> + + <TableRow + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center"> + + <TextView + android:id="@+id/tvFragmentProfilePostsNo" + android:gravity="center" + android:text="156" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowersNo" + android:gravity="center" + android:text="50" /> + + <TextView + android:id="@+id/tvFragmentProfileFollowNo" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:text="40" /> + </TableRow> + </TableLayout> + + <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/btnFragmentProfileShowMyPosts" /> + + <Button + android:id="@+id/btnFragmentProfileShowMyPosts" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="20dp" + android:layout_marginTop="4dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:text="Objave" + + android:textColor="@color/cardview_dark_background" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + + <Button + android:id="@+id/btnFragmentProfileShowMyData" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:layout_marginEnd="20dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:text="Podaci" + + 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" /> + + <FrameLayout + android:id="@+id/flFragmentProfileFragmentContainer" + android:layout_width="409dp" + android:layout_height="319dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/divider"> + + </FrameLayout> + + <Button + android:id="@+id/btnFragmentProfileShowMyRecensions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="36dp" + android:layout_marginTop="4dp" + android:backgroundTint="#FFFFFF" + android:stateListAnimator="@null" + android:textColor="@color/cardview_dark_background" + android:text="Recenzije" + app:layout_constraintStart_toEndOf="@+id/btnFragmentProfileShowMyPosts" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentProfileInfoContainer" /> + + </androidx.constraintlayout.widget.ConstraintLayout> +</FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_register.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_register.xml new file mode 100644 index 0000000..c9d50a0 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_register.xml @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentRegister" + android:layout_gravity="center_horizontal" + +> + + + <!-- TODO: Update blank fragment layout --> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="432dp" + android:layout_gravity="center_horizontal" + android:padding="20dp"> + + <EditText + android:id="@+id/etFragmentRegisterPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="*********" + android:inputType="textPassword" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentRegisterPassword" /> + + <EditText + android:id="@+id/etFragmentRegisterEmail" + android:layout_width="match_parent" + android:layout_height="50dp" + android:ems="10" + android:hint="primer@gmail.com" + android:inputType="textEmailAddress" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentRegisterEmail" /> + + <TextView + android:id="@+id/tvFragmentRegisterPassword" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="Lozinka +" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/etFragmentRegisterEmail" /> + + <TextView + android:id="@+id/tvFragmentRegisterEmail" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:backgroundTint="#00B8D4" + android:text="Email" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/etFragmentRegisterName" /> + + <EditText + android:id="@+id/etFragmentRegisterUser" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="PetarP" + android:inputType="textPersonName" + app:layout_constraintTop_toBottomOf="@+id/tvFragmentRegisterUser" + tools:layout_editor_absoluteX="-16dp" /> + + <EditText + android:id="@+id/etFragmentRegisterName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Petar Petrovic" + android:inputType="textPersonName" + + app:layout_constraintTop_toBottomOf="@+id/tvFragmentRegisterName" + tools:layout_editor_absoluteX="0dp" /> + + <TextView + android:id="@+id/tvFragmentRegisterName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="Ime i prezime" + app:layout_constraintTop_toBottomOf="@+id/etFragmentRegisterUser" + tools:layout_editor_absoluteX="0dp" /> + + <TextView + android:id="@+id/tvFragmentRegisterUser" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="4dp" + android:text="Korisničko ime" + app:layout_constraintTop_toTopOf="parent" + tools:layout_editor_absoluteX="20dp" /> + + <Button + android:id="@+id/btnFragmentRegisterRegister" + android:layout_width="200dp" + android:layout_height="45dp" + android:layout_marginTop="48dp" + android:background="@drawable/rounded_cyan_button" + android:text="Registruj se" + android:textSize="16dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/etFragmentRegisterPassword" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + + + /> +</FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml new file mode 100644 index 0000000..185719b --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_user_posts.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Fragments.FragmentUserPosts"> + + <!-- TODO: Update blank fragment layout --> + <TextView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:text="@string/hello_blank_fragment" /> + +</FrameLayout>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/list_item.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/list_item.xml new file mode 100644 index 0000000..4ce1a94 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/layout/list_item.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + single item component +--> +<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:layout_height="wrap_content" + android:background="#B3E5FC" + android:layout_margin="5dp" + android:padding="5dp"> + <TextView + android:id="@+id/tvId" + android:text="Id" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + <TextView + android:id="@+id/tvName" + android:text="Name" + android:layout_marginTop="5dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tvId" /> +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file 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 new file mode 100644 index 0000000..da6577e --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/menu/bottom_nav_menu.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:id="@+id/navHome" + android:title="Home" + android:icon="@drawable/ic_nav_home"/> + <item + android:id="@+id/navBrowse" + android:title="Browse" + android:icon="@drawable/ic_nav_browse"/> + <item + android:id="@+id/navAddPost" + android:title="Post" + android:icon="@drawable/ic_nav_addpost"/> + <item + android:id="@+id/navProfile" + android:title="Profile" + android:icon="@drawable/ic_nav_profile"/> +</menu>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher.webp Binary files differnew file mode 100644 index 0000000..c209e78 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp Binary files differnew file mode 100644 index 0000000..b2dfe3d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher.webp Binary files differnew file mode 100644 index 0000000..4f0f1d6 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp Binary files differnew file mode 100644 index 0000000..62b611d --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher.webp Binary files differnew file mode 100644 index 0000000..948a307 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp Binary files differnew file mode 100644 index 0000000..1b9a695 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp Binary files differnew file mode 100644 index 0000000..28d4b77 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp Binary files differnew file mode 100644 index 0000000..9287f50 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp Binary files differnew file mode 100644 index 0000000..aa7d642 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp Binary files differnew file mode 100644 index 0000000..9126ae3 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/Client/BrzoDoLokacije/app/src/main/res/values-night/themes.xml b/Client/BrzoDoLokacije/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..b963a50 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <!-- Base application theme. + <style name="Theme.BrzoDoLokacije" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + + <item name="colorPrimary">@color/white</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">#071935</item> + + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_200</item> + <item name="colorOnSecondary">#071935</item> + + <item name="android:statusBarColor">#143257</item> + + </style>--> +</resources>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..588b9cf --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/values/colors.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="purple_200">#FFBB86FC</color> + <color name="purple_500">#1C789A</color> + <color name="purple_700">#1C789A</color> + <color name="teal_200">#FF03DAC5</color> + <color name="teal_700">#FF018786</color> + <color name="black">#FF000000</color> + <color name="white">#FFFFFFFF</color> + +</resources>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml b/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..d7b376c --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ +<resources> + <string name="app_name">Brzo Do Lokacije</string> + <!-- TODO: Remove or change this placeholder text --> + <string name="hello_blank_fragment">Hello blank fragment</string> + <string name="dim">16dp</string> +</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 new file mode 100644 index 0000000..2dee0ab --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/values/styles.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="imageViewCircle" parent=""> + <item name="cornerFamily">rounded</item> + <item name="cornerSize">70dp</item> + <item name="color">@color/white</item> +</style> + <style name="imageViewRoundedEdge" parent=""> + <item name="cornerFamily">rounded</item> + <item name="cornerSize">15dp</item> + <item name="color">@color/white</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 new file mode 100644 index 0000000..6193009 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/values/themes.xml @@ -0,0 +1,15 @@ +<resources xmlns:tools="http://schemas.android.com/tools"> + <style name="Theme.BrzoDoLokacije" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> + + <item name="colorPrimary">@color/purple_500</item> + <item name="colorPrimaryVariant">@color/purple_700</item> + <item name="colorOnPrimary">@color/white</item> + + <item name="colorSecondary">@color/teal_200</item> + <item name="colorSecondaryVariant">@color/teal_700</item> + <item name="colorOnSecondary">@color/black</item> + + <item name="android:statusBarColor">?attr/colorPrimaryVariant</item> + + </style> +</resources>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml b/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 0000000..fa0f996 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Sample backup rules file; uncomment and customize as necessary. + See https://developer.android.com/guide/topics/data/autobackup + for details. + Note: This file is ignored for devices older that API 31 + See https://developer.android.com/about/versions/12/backup-restore +--> +<full-backup-content> + <!-- + <include domain="sharedpref" path="."/> + <exclude domain="sharedpref" path="device.xml"/> +--> +</full-backup-content>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/main/res/xml/data_extraction_rules.xml b/Client/BrzoDoLokacije/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..9ee9997 --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Sample data extraction rules file; uncomment and customize as necessary. + See https://developer.android.com/about/versions/12/backup-restore#xml-changes + for details. +--> +<data-extraction-rules> + <cloud-backup> + <!-- TODO: Use <include> and <exclude> to control what is backed up. + <include .../> + <exclude .../> + --> + </cloud-backup> + <!-- + <device-transfer> + <include .../> + <exclude .../> + </device-transfer> + --> +</data-extraction-rules>
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/app/src/test/java/com/example/brzodolokacije/ExampleUnitTest.kt b/Client/BrzoDoLokacije/app/src/test/java/com/example/brzodolokacije/ExampleUnitTest.kt new file mode 100644 index 0000000..3bc92cd --- /dev/null +++ b/Client/BrzoDoLokacije/app/src/test/java/com/example/brzodolokacije/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.example.brzodolokacije + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/build.gradle b/Client/BrzoDoLokacije/build.gradle new file mode 100644 index 0000000..c518bc1 --- /dev/null +++ b/Client/BrzoDoLokacije/build.gradle @@ -0,0 +1,6 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.3.0' apply false + id 'com.android.library' version '7.3.0' apply false + id 'org.jetbrains.kotlin.android' version '1.7.10' apply false +}
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/gradle.properties b/Client/BrzoDoLokacije/gradle.properties new file mode 100644 index 0000000..3c5031e --- /dev/null +++ b/Client/BrzoDoLokacije/gradle.properties @@ -0,0 +1,23 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true
\ No newline at end of file diff --git a/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.jar b/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..e708b1c --- /dev/null +++ b/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.jar diff --git a/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.properties b/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2a5837b --- /dev/null +++ b/Client/BrzoDoLokacije/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 26 22:36:41 CEST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/Client/BrzoDoLokacije/gradlew b/Client/BrzoDoLokacije/gradlew new file mode 100644 index 0000000..4f906e0 --- /dev/null +++ b/Client/BrzoDoLokacije/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/Client/BrzoDoLokacije/gradlew.bat b/Client/BrzoDoLokacije/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/Client/BrzoDoLokacije/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Client/BrzoDoLokacije/settings.gradle b/Client/BrzoDoLokacije/settings.gradle new file mode 100644 index 0000000..dc8bcc0 --- /dev/null +++ b/Client/BrzoDoLokacije/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +rootProject.name = "BrzoDoLokacije" +include ':app' diff --git a/Logo/logoaplikacije.png b/Logo/logoaplikacije.png Binary files differnew file mode 100644 index 0000000..d20cb6e --- /dev/null +++ b/Logo/logoaplikacije.png diff --git a/Logo/logoaplikacije1000dpi.png b/Logo/logoaplikacije1000dpi.png Binary files differnew file mode 100644 index 0000000..cdeada6 --- /dev/null +++ b/Logo/logoaplikacije1000dpi.png diff --git a/Logo/logotima.png b/Logo/logotima.png Binary files differnew file mode 100644 index 0000000..85137ac --- /dev/null +++ b/Logo/logotima.png diff --git a/Logo/logotima1000dpi.png b/Logo/logotima1000dpi.png Binary files differnew file mode 100644 index 0000000..dc9481b --- /dev/null +++ b/Logo/logotima1000dpi.png |