Commit 446e53dd authored by Chamod Ishankha's avatar Chamod Ishankha

dashboard, user profile designed and api connected

parent f5c98440
......@@ -15,7 +15,7 @@
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-17T19:35:30.624445300Z" />
<timeTargetWasSelectedWithDropDown value="2024-05-18T11:27:38.975164100Z" />
</State>
</entry>
</value>
......
......@@ -42,6 +42,7 @@ dependencies {
implementation(libs.android.spinkit)
implementation(libs.retrofit2)
implementation(libs.convertor.gson)
implementation(libs.jackson.databind)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
......
......@@ -6,16 +6,19 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:networkSecurityConfig="@xml/network_security_config"
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:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.BabyCare"
tools:targetApi="31">
<activity
android:name=".activities.UserProfileActivity"
android:exported="false" />
<activity
android:name=".activities.DashboardActivity"
android:exported="false" />
......
package com.kaluwa.enterprises.babycare;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.getToken;
import static com.kaluwa.enterprises.babycare.utils.Utils.animationChanger;
import android.content.Intent;
import android.os.Bundle;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import androidx.navigation.NavController;
......@@ -14,15 +19,21 @@ import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.kaluwa.enterprises.babycare.activities.DashboardActivity;
import com.kaluwa.enterprises.babycare.activities.auth.LoginActivity;
import com.kaluwa.enterprises.babycare.config.TokenSaver;
import com.kaluwa.enterprises.babycare.databinding.ActivityMainBinding;
import com.kaluwa.enterprises.babycare.dto.AuthenticationDto;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private final static String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -33,7 +44,32 @@ public class MainActivity extends AppCompatActivity {
startedBtn.setOnClickListener(v -> {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
animationChanger(this);
});
}
@Override
protected void onStart() {
super.onStart();
// auto login
autoLogin();
}
private void autoLogin() {
// check auth
try {
AuthenticationDto authDto = getToken(getApplicationContext());
if (authDto != null) {
Intent intent = new Intent(this, DashboardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Toast.makeText(this, "Successfully logged in.", Toast.LENGTH_SHORT).show();
finish();
animationChanger(this);
}
} catch (JsonProcessingException e) {
Log.e(TAG, "Error: "+e.getMessage());
Toast.makeText(this, "Auto login failed.", Toast.LENGTH_SHORT).show();
}
}
}
\ No newline at end of file
package com.kaluwa.enterprises.babycare.activities;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.clearToken;
import static com.kaluwa.enterprises.babycare.utils.Utils.animationChanger;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import com.kaluwa.enterprises.babycare.MainActivity;
import com.kaluwa.enterprises.babycare.R;
import com.kaluwa.enterprises.babycare.activities.auth.LoginActivity;
public class DashboardActivity extends AppCompatActivity {
......@@ -16,5 +26,67 @@ public class DashboardActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
// define actionbar
defineActionbar();
}
private void defineActionbar() {
Toolbar toolbar = findViewById(R.id.b_care_action_bar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
toolbar.setNavigationIcon(R.drawable.ico_menu_32);
toolbar.setNavigationOnClickListener(v -> {
// Initializing the popup menu and giving the reference as current context
PopupMenu popupMenu = new PopupMenu(this, toolbar);
popupMenu.setGravity(Gravity.BOTTOM);
popupMenu.getMenuInflater().inflate(R.menu.menu_main, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(item -> {
int id = item.getItemId();
if (id == R.id.mm_device_setting) {
Toast.makeText(this, "You Clicked " + item.getTitle(), Toast.LENGTH_SHORT).show();
} else if (id == R.id.mm_app_setting) {
Toast.makeText(this, "You Clicked " + item.getTitle(), Toast.LENGTH_SHORT).show();
} else if (id == R.id.mm_logout) {
clearToken(getApplicationContext());
Toast.makeText(this, "Logout successful.", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
animationChanger(this);
}
return true;
});
popupMenu.show();
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.user_action_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.user) {
Intent intent = new Intent(this, UserProfileActivity.class);
startActivity(intent);
animationChanger(this);
} else {
Toast.makeText(this, "No item.", Toast.LENGTH_SHORT).show();
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
animationChanger(this);
}
}
\ No newline at end of file
package com.kaluwa.enterprises.babycare.activities;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.clearToken;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.getToken;
import static com.kaluwa.enterprises.babycare.utils.Utils.animationChanger;
import static com.kaluwa.enterprises.babycare.utils.Utils.disableEditText;
import static com.kaluwa.enterprises.babycare.utils.Utils.loader;
import static com.kaluwa.enterprises.babycare.utils.Utils.mobileNumberValidation;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.ybq.android.spinkit.SpinKitView;
import com.google.gson.Gson;
import com.kaluwa.enterprises.babycare.MainActivity;
import com.kaluwa.enterprises.babycare.R;
import com.kaluwa.enterprises.babycare.config.ApiConfig;
import com.kaluwa.enterprises.babycare.dto.AuthenticationDto;
import com.kaluwa.enterprises.babycare.dto.UserDto;
import com.kaluwa.enterprises.babycare.error.ErrorDto;
import com.kaluwa.enterprises.babycare.service.UserApiService;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class UserProfileActivity extends AppCompatActivity {
private final static String TAG = "UserProfileActivity";
private EditText etFirstName, etLastName, etType, etEmail, etMobile;
private Button btnEdit, btnCancel;
private SpinKitView progressBar;
private View overlay;
private UserApiService userApiService;
private AuthenticationDto authDto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_profile);
// define actionbar
defineActionbar();
// initialize user api service
try {
authDto = getToken(getApplicationContext());
} catch (JsonProcessingException e) {
Log.e(TAG, "Error: "+e.getMessage());
Toast.makeText(this, "Error getting token, Please refresh", Toast.LENGTH_SHORT).show();
}
userApiService = ApiConfig.getInstance().getUserApi(authDto.getTokenDto().getToken());
// progress
progressBar = findViewById(R.id.progress_bar);
overlay = findViewById(R.id.overlay);
// variables
etFirstName = findViewById(R.id.up_et_firstname);
etLastName = findViewById(R.id.up_et_lastname);
etType = findViewById(R.id.up_et_type);
etEmail = findViewById(R.id.up_et_email);
etMobile = findViewById(R.id.up_et_mobile);
// buttons
btnEdit = findViewById(R.id.l_btn_edit);
btnCancel = findViewById(R.id.l_btn_cancel);
// disable all edit texts
disableET();
AtomicBoolean enableEdit = new AtomicBoolean(false);
btnCancel.setOnClickListener(v -> {
enableEdit.set(false);
disableET();
btnCancel.setVisibility(View.GONE);
btnEdit.setText(R.string.edit_btn_value);
btnEdit.setBackgroundResource(R.drawable.positive_btn_background);
});
btnEdit.setOnClickListener(v -> {
if (!enableEdit.get()) {
enableEdit.set(true);
enableET();
btnCancel.setVisibility(View.VISIBLE);
btnEdit.setText(R.string.update_btn_value);
btnEdit.setBackgroundResource(R.drawable.green_btn_background);
} else {
// validate text
UserDto user = validate();
// call update
if (!TextUtils.isEmpty(user.getFirstName())) {
updateUser(user, enableEdit);
}
}
});
}
private void updateUser(UserDto user, AtomicBoolean enableEdit) {
loader(overlay, progressBar, true);
Call<UserDto> call = userApiService.updateUserById(authDto.getUserId(), user);
call.enqueue(new Callback<UserDto>() {
@Override
public void onResponse(Call<UserDto> call, Response<UserDto> response) {
if (response.isSuccessful()) {
enableEdit.set(false);
disableET();
btnCancel.setVisibility(View.GONE);
btnEdit.setText(R.string.edit_btn_value);
btnEdit.setBackgroundResource(R.drawable.positive_btn_background);
Toast.makeText(UserProfileActivity.this, "User details successfully updated.", Toast.LENGTH_SHORT).show();
loader(overlay, progressBar, false);
} else {
try {
Gson gson = new Gson();
assert response.errorBody() != null;
String errorBodyString = response.errorBody().string();
// Check if the error body is in JSON format
if (errorBodyString.startsWith("{")) {
ErrorDto errorDto = gson.fromJson(errorBodyString, ErrorDto.class);
Toast.makeText(UserProfileActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
} else {
// If the error body is not in JSON format, display a generic error message
Log.e(TAG, errorBodyString);
Toast.makeText(UserProfileActivity.this, "An unexpected error occurred", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
Toast.makeText(UserProfileActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
loader(overlay, progressBar, false);
}
}
@Override
public void onFailure(Call<UserDto> call, Throwable t) {
Toast.makeText(UserProfileActivity.this, "Error to Failure", Toast.LENGTH_LONG).show();
loader(overlay, progressBar, false);
}
});
}
private UserDto validate() {
UserDto userDto = new UserDto();
String firstName, lastName, mobileNumber;
firstName = etFirstName.getText().toString();
lastName = etLastName.getText().toString();
mobileNumber = etMobile.getText().toString();
if (TextUtils.isEmpty(firstName)) {
etFirstName.setError("First name is required.");
etFirstName.requestFocus();
} else if (TextUtils.isEmpty(lastName)) {
etLastName.setError("Last name is required.");
etLastName.requestFocus();
} else if (TextUtils.isEmpty(mobileNumber)) {
etMobile.setError("Mobile number is required.");
etMobile.requestFocus();
} else if (!mobileNumberValidation(mobileNumber)) {
etMobile.setError("Invalid mobile number format, use - (+94*********)");
etMobile.requestFocus();
} else {
userDto.setUserId(authDto.getUserId());
userDto.setFirstName(firstName);
userDto.setLastName(lastName);
userDto.setPhone(mobileNumber);
}
return userDto;
}
private void loadData() {
loader(overlay, progressBar, true);
Call<UserDto> call = userApiService.getUserById(authDto.getUserId());
call.enqueue(new Callback<UserDto>() {
@Override
public void onResponse(Call<UserDto> call, Response<UserDto> response) {
if (response.isSuccessful()) {
UserDto user = response.body();
etFirstName.setText(user.getFirstName());
etLastName.setText(user.getLastName());
etType.setText(!Objects.equals(user.getRole(), "USER") ? user.getRole():"PARENT");
etEmail.setText(user.getEmail());
etMobile.setText(user.getPhone());
loader(overlay, progressBar, false);
} else {
try {
Gson gson = new Gson();
assert response.errorBody() != null;
String errorBodyString = response.errorBody().string();
// Check if the error body is in JSON format
if (errorBodyString.startsWith("{")) {
ErrorDto errorDto = gson.fromJson(errorBodyString, ErrorDto.class);
Toast.makeText(UserProfileActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
} else {
// If the error body is not in JSON format, display a generic error message
Log.e(TAG, errorBodyString);
Toast.makeText(UserProfileActivity.this, "An unexpected error occurred", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
Toast.makeText(UserProfileActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
loader(overlay, progressBar, false);
}
}
@Override
public void onFailure(Call<UserDto> call, Throwable t) {
Toast.makeText(UserProfileActivity.this, "Error to Failure", Toast.LENGTH_LONG).show();
loader(overlay, progressBar, false);
}
});
}
private void disableET() {
disableEditText(etFirstName, false, this);
disableEditText(etLastName, false, this);
disableEditText(etType, false, this);
disableEditText(etEmail, false, this);
disableEditText(etMobile, false, this);
}
private void enableET() {
disableEditText(etFirstName, true, this);
disableEditText(etLastName, true, this);
disableEditText(etMobile, true, this);
}
private void defineActionbar() {
Toolbar toolbar = findViewById(R.id.b_care_action_bar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
toolbar.setNavigationIcon(R.drawable.ico_menu_32);
toolbar.setNavigationOnClickListener(v -> {
// Initializing the popup menu and giving the reference as current context
PopupMenu popupMenu = new PopupMenu(this, toolbar);
popupMenu.setGravity(Gravity.BOTTOM);
popupMenu.getMenuInflater().inflate(R.menu.menu_main, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(item -> {
int id = item.getItemId();
if (id == R.id.mm_device_setting) {
Toast.makeText(this, "You Clicked " + item.getTitle(), Toast.LENGTH_SHORT).show();
} else if (id == R.id.mm_app_setting) {
Toast.makeText(this, "You Clicked " + item.getTitle(), Toast.LENGTH_SHORT).show();
} else if (id == R.id.mm_logout) {
clearToken(getApplicationContext());
Toast.makeText(this, "Logout successful.", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
animationChanger(this);
}
return true;
});
popupMenu.show();
});
}
@Override
protected void onStart() {
super.onStart();
// load data
loadData();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.user_action_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.user) {
Intent intent = getIntent();
finish();
startActivity(intent);
animationChanger(this);
} else {
Toast.makeText(this, "No item.", Toast.LENGTH_SHORT).show();
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
animationChanger(this);
}
}
\ No newline at end of file
package com.kaluwa.enterprises.babycare.activities.auth;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.getToken;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.setToken;
import static com.kaluwa.enterprises.babycare.utils.Utils.animationChanger;
import static com.kaluwa.enterprises.babycare.utils.Utils.emailAddressValidation;
import static com.kaluwa.enterprises.babycare.utils.Utils.loader;
......@@ -19,9 +22,12 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.ybq.android.spinkit.SpinKitView;
import com.google.gson.Gson;
import com.kaluwa.enterprises.babycare.R;
import com.kaluwa.enterprises.babycare.activities.DashboardActivity;
import com.kaluwa.enterprises.babycare.activities.UserProfileActivity;
import com.kaluwa.enterprises.babycare.config.ApiConfig;
import com.kaluwa.enterprises.babycare.dto.AuthenticationDto;
import com.kaluwa.enterprises.babycare.dto.LoginRequest;
......@@ -61,6 +67,7 @@ public class LoginActivity extends AppCompatActivity {
tvRegister.setOnClickListener(v -> {
Intent intent = new Intent(this, RegisterActivity.class);
startActivity(intent);
animationChanger(this);
});
etEmail = findViewById(R.id.l_et_username);
......@@ -79,15 +86,35 @@ public class LoginActivity extends AppCompatActivity {
public void onResponse(Call<AuthenticationDto> call, Response<AuthenticationDto> response) {
if (response.isSuccessful()) {
AuthenticationDto authDto = response.body();
Toast.makeText(LoginActivity.this, "Success: "+authDto.getTokenDto().getToken(), Toast.LENGTH_LONG).show();
try {
setToken(getApplicationContext(), authDto);
Toast.makeText(LoginActivity.this, "Successfully logged in.", Toast.LENGTH_LONG).show();
Intent intent = new Intent(LoginActivity.this, DashboardActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
} catch (JsonProcessingException e) {
Log.e(TAG, e.getMessage());
Toast.makeText(LoginActivity.this, "Token saver error.", Toast.LENGTH_LONG).show();
}
loader(overlay, progressBar, false);
} else {
try {
Gson gson = new Gson();
ErrorDto errorDto = gson.fromJson(response.errorBody().string(), ErrorDto.class);
Toast.makeText(LoginActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
assert response.errorBody() != null;
String errorBodyString = response.errorBody().string();
// Check if the error body is in JSON format
if (errorBodyString.startsWith("{")) {
ErrorDto errorDto = gson.fromJson(errorBodyString, ErrorDto.class);
Toast.makeText(LoginActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
} else {
// If the error body is not in JSON format, display a generic error message
Log.e(TAG, errorBodyString);
Toast.makeText(LoginActivity.this, "An unexpected error occurred", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e.getMessage());
Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
loader(overlay, progressBar, false);
......@@ -126,4 +153,10 @@ public class LoginActivity extends AppCompatActivity {
}
return request;
}
@Override
public void onBackPressed() {
super.onBackPressed();
animationChanger(this);
}
}
\ No newline at end of file
package com.kaluwa.enterprises.babycare.activities.auth;
import static com.kaluwa.enterprises.babycare.utils.Utils.animationChanger;
import static com.kaluwa.enterprises.babycare.utils.Utils.emailAddressValidation;
import static com.kaluwa.enterprises.babycare.utils.Utils.loader;
import static com.kaluwa.enterprises.babycare.utils.Utils.mobileNumberValidation;
......@@ -20,6 +21,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.github.ybq.android.spinkit.SpinKitView;
import com.google.gson.Gson;
import com.kaluwa.enterprises.babycare.R;
import com.kaluwa.enterprises.babycare.activities.UserProfileActivity;
import com.kaluwa.enterprises.babycare.config.ApiConfig;
import com.kaluwa.enterprises.babycare.dto.RegisterRequest;
import com.kaluwa.enterprises.babycare.dto.UserDto;
......@@ -78,13 +80,24 @@ public class RegisterActivity extends AppCompatActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
animationChanger(RegisterActivity.this);
} else {
try {
Gson gson = new Gson();
ErrorDto errorDto = gson.fromJson(response.errorBody().string(), ErrorDto.class);
Toast.makeText(RegisterActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
assert response.errorBody() != null;
String errorBodyString = response.errorBody().string();
// Check if the error body is in JSON format
if (errorBodyString.startsWith("{")) {
ErrorDto errorDto = gson.fromJson(errorBodyString, ErrorDto.class);
Toast.makeText(RegisterActivity.this, errorDto.getMessage(), Toast.LENGTH_LONG).show();
} else {
// If the error body is not in JSON format, display a generic error message
Log.e(TAG, errorBodyString);
Toast.makeText(RegisterActivity.this, "An unexpected error occurred", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e.getMessage());
Toast.makeText(RegisterActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
loader(overlay, progressBar, false);
......@@ -148,4 +161,10 @@ public class RegisterActivity extends AppCompatActivity {
}
return request;
}
@Override
public void onBackPressed() {
super.onBackPressed();
animationChanger(this);
}
}
\ No newline at end of file
package com.kaluwa.enterprises.babycare.config;
import static com.kaluwa.enterprises.babycare.config.TokenSaver.getToken;
import com.kaluwa.enterprises.babycare.service.AuthApiService;
import com.kaluwa.enterprises.babycare.service.UserApiService;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiConfig {
private static final String BASE_URL = "http://192.168.1.2:8080/api/v1/baby-care/";
private static ApiConfig instance;
private static Retrofit retrofit = null;
private static Retrofit retrofitAuth = null;
private static Retrofit retrofitOther = null;
private static String AUTH_TOKEN = "";
private ApiConfig() {
OkHttpClient httpClient = new OkHttpClient.Builder().build();
OkHttpClient authHttpClient = new OkHttpClient.Builder().build();
retrofitAuth = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(authHttpClient)
.build();
retrofit = new Retrofit.Builder()
OkHttpClient otherHttpClient = new OkHttpClient.Builder()
.addInterceptor(chain -> {
Request originalRequest = chain.request();
Request.Builder builder = originalRequest.newBuilder()
.header("Authorization", "Bearer " + AUTH_TOKEN);
Request newRequest = builder.build();
return chain.proceed(newRequest);
})
.build();
retrofitOther = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(httpClient)
.client(otherHttpClient)
.build();
}
......@@ -29,6 +49,11 @@ public class ApiConfig {
}
public AuthApiService getAuthApi() {
return retrofit.create(AuthApiService.class);
return retrofitAuth.create(AuthApiService.class);
}
public UserApiService getUserApi(String JWTToken) {
AUTH_TOKEN = JWTToken;
return retrofitOther.create(UserApiService.class);
}
}
package com.kaluwa.enterprises.babycare.config;
import android.content.Context;
import android.content.SharedPreferences;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kaluwa.enterprises.babycare.dto.AuthenticationDto;
public class TokenSaver {
private final static String SHARED_PREF_NAME = "net.kaluwa.SHARED_PREF_NAME";
private final static String TOKEN_KEY = "net.kaluwa.TOKEN_KEY";
private static ObjectMapper objectMapper = new ObjectMapper();
public static AuthenticationDto getToken(Context c) throws JsonProcessingException {
SharedPreferences prefs = c.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
String tokenDtoString = prefs.getString(TOKEN_KEY, null);
AuthenticationDto authDto;
if (tokenDtoString != null) {
authDto = objectMapper.readValue(tokenDtoString, AuthenticationDto.class);
} else {
authDto = null;
}
return authDto;
}
public static void setToken(Context c, AuthenticationDto authDto) throws JsonProcessingException {
SharedPreferences prefs = c.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
String tokenDtoString = objectMapper.writeValueAsString(authDto);
editor.putString(TOKEN_KEY, tokenDtoString);
editor.apply();
}
public static void clearToken(Context c) {
SharedPreferences prefs = c.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.remove(TOKEN_KEY);
editor.apply();
}
}
package com.kaluwa.enterprises.babycare.service;
import com.kaluwa.enterprises.babycare.dto.UserDto;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.PUT;
import retrofit2.http.Path;
public interface UserApiService {
@GET("user/{userId}")
Call<UserDto> getUserById(@Path("userId") Long userId);
@PUT("user/{userId}")
Call<UserDto> updateUserById(@Path("userId") Long userId, @Body UserDto user);
}
package com.kaluwa.enterprises.babycare.utils;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.EditText;
import com.github.ybq.android.spinkit.SpinKitView;
import com.kaluwa.enterprises.babycare.R;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -31,4 +35,21 @@ public class Utils {
return m.matches();
}
public static void animationChanger(Activity c) {
c.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
public static void disableEditText(EditText et, boolean action, Context c) {
et.setFocusable(action);
et.setClickable(action);
et.setCursorVisible(action);
if (action) {
et.setFocusableInTouchMode(true);
et.setKeyListener(new EditText(c).getKeyListener()); // Restoring the default key listener
} else {
et.setKeyListener(null);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0"/>
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromAlpha="1.0"
android:toAlpha="0.0"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/cancel_dark_red"/> <!-- Change this to a darker color or any other effect you want for pressed state -->
<corners android:radius="20dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/cancel_red"/>
<corners android:radius="20dp"/>
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="@color/transparent"/>
<stroke android:width="2dp" android:color="@color/purple"/>
<corners android:radius="10dp" />
</shape>
</item>
<item android:state_enabled="true">
<shape android:shape="rectangle">
<solid android:color="@color/transparent"/>
<stroke android:width="1dp" android:color="@color/line_outline"/>
<corners android:radius="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/success_dark_green"/> <!-- Change this to a darker color or any other effect you want for pressed state -->
<corners android:radius="20dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/success_green"/>
<corners android:radius="20dp"/>
</shape>
</item>
</selector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="500dp"
android:height="500dp"
android:viewportWidth="500"
android:viewportHeight="500">
<path
android:pathData="M236,41.6c-48.7,4.6 -91,23.8 -123.5,55.9 -21.1,20.9 -35.6,42.7 -45.6,68.4 -3.4,8.8 -3.9,9.6 -6.5,9.9 -10.1,0.9 -16.8,2.7 -25.3,6.8 -12.7,6.2 -21.9,15.2 -27.8,27.4 -5.5,11.2 -6.6,17.1 -6.1,31 0.3,8.5 1,13.1 2.6,17.4 8.4,23.1 28.7,39 52.7,41.4l6.7,0.7 3.7,9.5c8,20.3 18.4,37.6 33.4,55.6 21.5,25.6 52.6,46.9 84.9,58.2 10.2,3.6 10.9,4 13.8,8.4 7,10.5 20.8,20.3 34.5,24.4 8.2,2.5 24.8,2.5 33,-0 13.8,-4.1 27.7,-14 34.4,-24.4 2.9,-4.5 3.5,-4.9 13.1,-8.1 53.8,-18.2 98.2,-60.8 119.1,-114.1l3.7,-9.5 6.7,-0.7c15.5,-1.5 30.3,-9.1 40.4,-20.6 5.7,-6.4 12.3,-19 14.2,-27.2 1.7,-7.1 1.7,-20.9 0,-28 -0.7,-3 -3.1,-9.3 -5.4,-14 -9.5,-19.6 -28.7,-32 -53.1,-34.2 -2.6,-0.3 -3.1,-1.1 -6.5,-9.8 -23,-58.9 -72.9,-102.8 -134.6,-118.5 -7.1,-1.8 -15.2,-3.6 -18,-3.9l-5,-0.7 -19.5,30.2c-10.7,16.6 -20.7,32.3 -22.3,34.9 -7.4,12.9 -0.1,27 14,27 7,-0 10,-2.4 21.7,-16.9 10.7,-13.4 14,-15.7 20.8,-14.8 10.3,1.4 16,12.9 10.7,21.6 -5.2,8.5 -22,28 -27.1,31.4 -23.7,15.7 -55.4,7.5 -67.8,-17.6 -6.3,-12.9 -6.4,-28.7 -0.2,-40.6 1.6,-3.1 10.1,-16.7 18.7,-30.1 16.2,-25.1 17.3,-27.1 15.9,-26.8 -0.5,-0 -2.5,0.3 -4.4,0.4zM195.5,193.6c7.7,1.9 13.4,5.3 19.1,11.2 9.3,9.7 14,25.8 9.5,33 -3.3,5.2 -7.7,7.4 -13.9,6.9 -6.9,-0.5 -11.5,-4.7 -13.2,-11.9 -1.7,-6.7 -5.8,-10.8 -11.1,-10.8 -7.7,-0 -11.1,3.3 -12.8,12.2 -1.1,6.5 -3.5,9.6 -8.8,12 -5.1,2.2 -8.9,1.9 -13.9,-1.1 -7.3,-4.4 -8.3,-16.3 -2.5,-28.7 8.6,-18.4 28.4,-27.9 47.6,-22.8zM323.2,193.1c17,3.6 30.9,19 32.5,36.1 0.7,7.7 -1.3,13 -6.1,15.9 -5,3 -8.8,3.3 -14,1.1 -5.4,-2.4 -8.1,-6.4 -9,-13.2 -0.9,-7.1 -5,-11 -11.6,-11 -4,-0 -5.3,0.5 -7.8,3 -1.8,1.8 -3.4,4.9 -4.2,7.8 -1.7,7.2 -6.3,11.4 -13.2,11.9 -6.2,0.5 -10.6,-1.7 -13.9,-6.9 -4.5,-7.1 0.2,-23.3 9.4,-32.9 10.2,-10.6 23.7,-14.8 37.9,-11.8zM195,282.7c1.4,1 5,3.7 8,6.2 6.4,5.2 18.9,11.4 28,13.8 8.9,2.4 29.1,2.4 38,-0 9.1,-2.4 21.6,-8.6 28,-13.8 9,-7.3 10.1,-7.9 15.1,-7.9 6.2,-0 10.8,3.2 13.2,9.1 3.5,8.4 0.1,14.5 -13.8,24.4 -21.7,15.6 -52,22.7 -78.3,18.5 -25.2,-4.1 -55.9,-21.9 -59.3,-34.2 -1.5,-5.6 1.1,-12.2 6,-15.5 4.2,-2.8 11.5,-3.1 15.1,-0.6z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M20,9V7c0,-1.1 -0.9,-2 -2,-2h-3c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5H6C4.9,5 4,5.9 4,7v2c-1.66,0 -3,1.34 -3,3c0,1.66 1.34,3 3,3v4c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-4c1.66,0 3,-1.34 3,-3C23,10.34 21.66,9 20,9zM7.5,11.5C7.5,10.67 8.17,10 9,10s1.5,0.67 1.5,1.5S9.83,13 9,13S7.5,12.33 7.5,11.5zM16,17H8v-2h8V17zM15,13c-0.83,0 -1.5,-0.67 -1.5,-1.5S14.17,10 15,10s1.5,0.67 1.5,1.5S15.83,13 15,13z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M7.58,4.08L6.15,2.65C3.75,4.48 2.17,7.3 2.03,10.5h2c0.15,-2.65 1.51,-4.97 3.55,-6.42zM19.97,10.5h2c-0.15,-3.2 -1.73,-6.02 -4.12,-7.85l-1.42,1.43c2.02,1.45 3.39,3.77 3.54,6.42zM18,11c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2v-5zM12,22c0.14,0 0.27,-0.01 0.4,-0.04 0.65,-0.14 1.18,-0.58 1.44,-1.18 0.1,-0.24 0.15,-0.5 0.15,-0.78h-4c0.01,1.1 0.9,2 2.01,2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="32dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="360dp"
android:height="361dp"
android:viewportWidth="360"
android:viewportHeight="361">
<path
android:pathData="M154.5,2c-21,2 -55.2,15.1 -75.2,28.7 -17,11.5 -37.9,32.5 -49.5,49.8 -11.3,16.9 -22.1,42.7 -26.7,63.8 -2.4,10.9 -3.4,40.2 -2.1,57.7 2.2,29 16.6,63.8 37.4,90.5 8.5,10.8 26,27.5 37.6,35.8 17.1,12.1 46.2,24.8 68.5,29.9 4.3,0.9 14.5,1.3 36,1.3 29.6,-0 30.1,-0 40.1,-2.7 28.9,-7.8 50.2,-18.1 70.9,-34.3 9.2,-7.2 25,-23.2 31.8,-32.2 15.8,-20.7 27.7,-46.8 33.7,-73.8 2,-8.9 2.3,-12.8 2.3,-35 0,-28.8 -0.8,-35 -7.8,-56 -12.5,-38 -35.1,-69.1 -67.1,-92.1 -10.8,-7.8 -35.4,-20.2 -48.4,-24.4 -19.3,-6.3 -24.5,-7.1 -50,-7.5 -12.9,-0.2 -27.1,-0 -31.5,0.5zM192.5,22c30.9,2.3 56.7,12 82.4,30.8 30.4,22.3 54.5,60.4 61.7,97.2 1.4,7.4 1.8,14.2 1.8,31 0,23.9 -1.4,33.4 -7.5,50.6 -3.8,10.7 -13.4,31.4 -14.6,31.4 -0.5,-0 -2.5,-1.6 -4.4,-3.6 -5.4,-5.7 -18.4,-13.8 -34,-21.3 -14.5,-7 -39,-17.1 -41.4,-17.1 -0.7,-0 -4,2.2 -7.2,4.8 -12.6,10.5 -25.1,17.2 -35.7,19.1 -7.5,1.4 -20.6,1.4 -27.7,0.1 -3,-0.6 -9,-2.7 -13.4,-4.9 -7.6,-3.6 -22.4,-13.8 -25.4,-17.4 -0.7,-0.9 -2.2,-1.7 -3.2,-1.7 -3,-0 -31.3,11.6 -44.2,18 -14.3,7.2 -24.2,13.5 -30.8,19.7 -3.3,3.1 -5.3,4.3 -6,3.6 -1.6,-1.6 -11.4,-24.1 -14.3,-33 -4.9,-14.7 -6.7,-25.6 -7.3,-43.8 -0.4,-13 -0.2,-19.7 1.1,-28.2 3.8,-25.8 14.1,-50.5 29.9,-71.9 7.1,-9.6 25.6,-27.7 35.3,-34.7 24.6,-17.4 57.7,-28.8 85.9,-29.6 2.8,-0 11.3,0.4 19,0.9z"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"/>
<path
android:pathData="M164,65.6c-3,0.8 -9.8,3.5 -15,6.1 -25.4,12.5 -42,42.5 -39.6,71.8 1.3,15.2 5.4,28.8 12.8,42.5 14.1,26 33.6,41.1 55.3,42.7 38.4,2.9 78,-51.6 72.5,-99.9 -2.1,-18.4 -9.4,-32.3 -24.2,-46.4 -13.1,-12.4 -28.5,-18.5 -46.7,-18.3 -5.3,-0 -12.1,0.7 -15.1,1.5z"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="32dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="32dp">
<path android:fillColor="@android:color/white" android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/dark_purple"/> <!-- Change this to a darker color or any other effect you want for pressed state -->
<corners android:radius="20dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/purple"/>
<corners android:radius="20dp"/>
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<corners android:bottomLeftRadius="50dp" android:bottomRightRadius="50dp"/>
<stroke android:width="1dp" android:color="@color/purple"/>
</shape>
\ No newline at end of file
......@@ -6,5 +6,231 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.DashboardActivity">
<include
layout="@layout/appbar"/>
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/b_care_action_bar"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/background"
android:contentDescription="background-image"
android:scaleType="centerCrop"
android:alpha="0.4"/>
<RelativeLayout
android:id="@+id/rl_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rl_background"
android:backgroundTint="#62178F"
app:layout_constraintTop_toTopOf="@+id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:layout_constraintEnd_toEndOf="@id/background"
android:padding="8dp">
<ImageView
android:id="@+id/forground_img"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@drawable/foreground"
android:contentDescription="foreground-image"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/forground_img"
android:text="@string/app_name"
android:textAlignment="center"
android:textColor="@color/white"
android:textAllCaps="true"
android:fontFamily="@font/inknut_antiqua_regular"
android:textSize="20sp"/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/rl_header"
app:layout_constraintBottom_toBottomOf="@id/background"
app:layout_constraintEnd_toEndOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
android:scrollbars="none">
<GridLayout
android:id="@+id/gridLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="2"
android:rowCount="3"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:layout_gravity="center_horizontal">
<LinearLayout
android:id="@+id/btn_camera"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_camera_alt_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="Feelings Camera"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_vocal"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_volume_up_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="Feelings Vocal"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_notifications"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_notifications_active_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="Activity Notifications"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_device_controls"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_device_controls_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="Device Controls"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_about_baby"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_about_baby_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="About Baby"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_settings"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="16dp"
android:background="@drawable/positive_btn_background"
android:backgroundTint="@color/white"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ico_settings_32"
app:tint="@color/icon_color" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:fontFamily="@font/acme_regular"
android:text="Settings"
android:textColor="@color/black"
android:textSize="15sp" />
</LinearLayout>
</GridLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -17,7 +17,7 @@
android:src="@drawable/background"
android:contentDescription="background-image"
android:scaleType="centerCrop"
/>
android:alpha="0.4" />
<TextView
android:layout_width="match_parent"
......@@ -28,7 +28,7 @@
app:layout_constraintTop_toTopOf="parent"
android:textAlignment="center"
android:text="LOGIN"
android:textColor="@color/white"
android:textColor="@color/purple"
android:fontFamily="@font/poetsen_one_regular"
android:textSize="50sp"/>
......@@ -87,7 +87,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/ico_email_32"
android:inputType="text"
android:inputType="textEmailAddress"
android:autofillHints="Enter Your Email address"
android:hint="Enter Your Email address"/>
......@@ -157,7 +157,10 @@
android:fontFamily="@font/abril_fatface_regular"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="28dp"/>
android:layout_marginTop="28dp"
android:background="@drawable/positive_btn_background"
android:padding="6dp"
android:textColor="@color/white"/>
<TextView
android:layout_width="match_parent"
......@@ -222,7 +225,6 @@
android:focusable="true"/>
<com.github.ybq.android.spinkit.SpinKitView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/progress_bar"
style="@style/SpinKitView.Large.DoubleBounce"
android:layout_width="wrap_content"
......
......@@ -70,7 +70,9 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
android:drawableLeft="@drawable/get_started_ico" />
android:drawableLeft="@drawable/get_started_ico"
android:background="@drawable/positive_btn_background"
android:padding="6dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -17,7 +17,7 @@
android:src="@drawable/background"
android:contentDescription="background-image"
android:scaleType="centerCrop"
/>
android:alpha="0.4" />
<TextView
android:layout_width="match_parent"
......@@ -28,7 +28,7 @@
app:layout_constraintTop_toTopOf="parent"
android:textAlignment="center"
android:text="REGISTER"
android:textColor="@color/white"
android:textColor="@color/purple"
android:fontFamily="@font/poetsen_one_regular"
android:textSize="50sp"/>
......@@ -221,7 +221,10 @@
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="28dp"
android:layout_marginBottom="80dp"/>
android:layout_marginBottom="80dp"
android:background="@drawable/positive_btn_background"
android:padding="6dp"
android:textColor="@color/white"/>
</LinearLayout>
</ScrollView>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.UserProfileActivity">
<include layout="@layout/appbar" />
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="0dp"
android:alpha="0.4"
android:contentDescription="background-image"
android:scaleType="centerCrop"
android:src="@drawable/background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/b_care_action_bar" />
<RelativeLayout
android:id="@+id/rl_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/transparent"
android:padding="8dp"
app:layout_constraintEnd_toEndOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:layout_constraintTop_toTopOf="@+id/background">
<ImageView
android:id="@+id/forground_img"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:contentDescription="foreground-image"
android:src="@drawable/icon_alt_user_pic_32" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/sv_background"
android:paddingStart="25dp"
android:paddingEnd="25dp"
android:paddingTop="10dp"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="@id/background"
app:layout_constraintEnd_toEndOf="@id/background"
app:layout_constraintStart_toStartOf="@id/background"
app:layout_constraintTop_toBottomOf="@id/rl_header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="80dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:fontFamily="@font/inknut_antiqua_regular"
android:textSize="20sp"
android:layout_marginTop="6dp"
android:text="Profile Details"
android:textColor="@color/purple"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="First Name"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_firstname"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="text"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="Last Name"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_lastname"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="text"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="Birthday"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_dob"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="text"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="Type"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_type"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="text"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="Email Address"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_email"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="textEmailAddress"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inknut_antiqua_regular"
android:text="Contact Number"
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
android:id="@+id/up_et_mobile"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="text"
android:background="@drawable/et_background"
android:padding="8dp"
android:fontFamily="@font/acme_regular"
android:textColor="@color/purple"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:orientation="horizontal">
<Button
android:id="@+id/l_btn_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:layout_weight="1"
android:background="@drawable/cancel_btn_background"
android:fontFamily="@font/abril_fatface_regular"
android:text="Cancel"
android:textColor="@color/white"
android:textSize="20sp"
android:textAllCaps="false"
style="?android:attr/buttonBarButtonStyle"
android:visibility="gone"/>
<Button
android:id="@+id/l_btn_edit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/positive_btn_background"
android:fontFamily="@font/abril_fatface_regular"
android:text="@string/edit_btn_value"
android:textColor="@color/white"
android:textSize="20sp"
android:textAllCaps="false"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id="@+id/overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99D5C5DF"
android:visibility="gone"
android:clickable="true"
android:focusable="true"/>
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/progress_bar"
style="@style/SpinKitView.Large.DoubleBounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:SpinKit_Color="@color/purple"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar
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="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:id="@+id/b_care_action_bar"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
</androidx.appcompat.widget.Toolbar>
\ No newline at end of file
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.kaluwa.enterprises.babycare.MainActivity">
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
android:id="@+id/mm_app_setting"
android:title="App Settings" />
<item
android:id="@+id/mm_device_setting"
android:title="Device Settings" />
<item
android:id="@+id/mm_logout"
android:title="Logout" />
</menu>
\ No newline at end of file
<menu 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">
<item
android:id="@+id/user"
android:icon="@drawable/ico_user_32"
android:title="User"
app:showAsAction="ifRoom" />
</menu>
\ No newline at end of file
......@@ -3,4 +3,10 @@
<color name="purple">#8147A4</color>
<color name="link_blue">#0000EE</color>
<color name="transparent">#00FFFFFF</color>
<color name="icon_color">#585AAA</color>
<color name="cancel_red">#FF0000</color>
<color name="line_outline">#959595</color>
<color name="cancel_dark_red">#CC0000</color>
<color name="success_green">#28A745</color>
<color name="success_dark_green">#218838</color>
</resources>
\ No newline at end of file
......@@ -3,6 +3,13 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="purple">#8147A4</color>
<color name="dark_purple">#673983</color>
<color name="link_blue">#0000EE</color>
<color name="transparent">#00FFFFFF</color>
<color name="icon_color">#585AAA</color>
<color name="cancel_red">#FF0000</color>
<color name="line_outline">#959595</color>
<color name="cancel_dark_red">#CC0000</color>
<color name="success_green">#28A745</color>
<color name="success_dark_green">#218838</color>
</resources>
\ No newline at end of file
......@@ -9,4 +9,6 @@
<string name="forgot_password"><u>Forgot Password</u></string>
<string name="register"><u>Register</u></string>
<string name="login"><u>Login</u></string>
<string name="edit_btn_value">Edit</string>
<string name="update_btn_value">Update</string>
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.BabyCare" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Base.Theme.BabyCare" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<item name="colorPrimary">@color/purple</item>
</style>
......
......@@ -13,6 +13,7 @@ androidSpinkit = "1.4.0"
projectLombok = "1.18.32"
retrofit2 = "2.9.0"
retrofit2Convertor = "2.9.0"
jacksonDatabind = "2.17.1"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
......@@ -28,6 +29,7 @@ android-spinkit = { group = "com.github.ybq", name = "Android-SpinKit", version.
projectlombok = { group = "org.projectlombok", name = "lombok", version.ref = "projectLombok"}
retrofit2 = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit2" }
convertor-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit2Convertor" }
jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jacksonDatabind" }
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment