Commit 411ee5e3 authored by iman Fauzi's avatar iman Fauzi

make beautify looks :P

parent 1ab94529
......@@ -11,14 +11,14 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme.appbar">
<activity android:name=".LoginActivity"></activity>
<activity android:name=".LoginActivity" android:theme="@style/AppTheme.appbar" />
<activity
android:name=".PaymentActivity"
android:theme="@style/AppTheme.appbar" />
<activity
android:name=".CartActivity"
android:theme="@style/AppTheme.appbar" />
<activity android:name=".ProductActivity"></activity>
<activity android:name=".ProductActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -28,7 +28,7 @@
</activity>
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.appbar"></activity>
android:theme="@style/AppTheme.appbar" />
<meta-data
android:name="preloaded_fonts"
......
......@@ -4,8 +4,11 @@ import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;
......@@ -30,6 +33,11 @@ public class CartActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
MaterialToolbar toolbars = findViewById(R.id.cAppBar);
setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......
......@@ -5,12 +5,17 @@ import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import com.google.gson.Gson;
import com.yono.messeripos.models.MainViewModels;
......@@ -22,20 +27,30 @@ public class LoginActivity extends AppCompatActivity {
TextInputEditText username, password;
MaterialButton btnLogin;
MainViewModels mainViewModels;
ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
setContentView(R.layout.activity_login_m);
username = findViewById(R.id.tiUsername);
password = findViewById(R.id.tiPassword);
btnLogin = findViewById(R.id.btnLogin);
progressBar = findViewById(R.id.progressBar);
progressBar.setVisibility(View.GONE);
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
public void onClick(View v) {
if (TextUtils.isEmpty(username.getText().toString()) &&
TextUtils.isEmpty(password.getText().toString())){
username.setError("This field can't empty");
......@@ -45,6 +60,11 @@ public class LoginActivity extends AppCompatActivity {
}else if (TextUtils.isEmpty(password.getText().toString())){
password.setError("This field can't empty");
}else{
progressBar.setVisibility(View.VISIBLE);
username.setEnabled(false);
password.setEnabled(false);
btnLogin.setEnabled(false);
mainViewModels.checkLogin(new UsersModels(username.getText().toString(),
password.getText().toString())).observe(LoginActivity.this, new Observer<DataResponse<UsersModels>>() {
@Override
......@@ -53,9 +73,19 @@ public class LoginActivity extends AppCompatActivity {
if (!usersModelsDataResponse.getMessageData().equals("Login Failed")){
startActivity(new Intent(LoginActivity.this, MainActivity.class));
progressBar.setVisibility(View.GONE);
username.setEnabled(true);
password.setEnabled(true);
btnLogin.setEnabled(true);
}else {
progressBar.setVisibility(View.GONE);
username.setEnabled(true);
password.setEnabled(true);
btnLogin.setEnabled(true);
}
// ADD ELSE UNTUK LOGIN GAGAL
}
});
}
......
......@@ -4,7 +4,10 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toolbar;
import com.google.android.material.appbar.MaterialToolbar;
......@@ -23,6 +26,11 @@ public class PaymentActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
MaterialToolbar toolbars = findViewById(R.id.appbar);
setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:startColor="#1B76D6" android:endColor="#3028A1"/>
</shape>
</item>
</selector>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_login"
android:fitsSystemWindows="true"
tools:context=".LoginActivity">
......@@ -101,18 +102,6 @@
android:fontFamily="@font/poppins_medium" />
</com.google.android.material.textfield.TextInputLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="64dp"
tools:layout_editor_absoluteY="337dp"
app:layout_constraintTop_toTopOf="@id/btnLogin"
app:layout_constraintBottom_toBottomOf="@id/btnLogin"
app:layout_constraintStart_toStartOf="@id/btnLogin"
app:layout_constraintEnd_toEndOf="@id/btnLogin"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin"
android:layout_width="match_parent"
......@@ -139,8 +128,22 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnLogin" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
tools:layout_editor_absoluteX="64dp"
tools:layout_editor_absoluteY="337dp"
app:layout_constraintTop_toTopOf="@id/btnLogin"
app:layout_constraintBottom_toBottomOf="@id/btnLogin"
app:layout_constraintStart_toStartOf="@id/btnLogin"
app:layout_constraintEnd_toEndOf="@id/btnLogin"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -21,9 +21,11 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="20dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingStart="15dp"
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="RtlSymmetry">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
......@@ -32,7 +34,6 @@
app:menu="@menu/home"
android:elevation="0dp"
app:navigationIcon="@drawable/ic_meser"
android:layout_marginTop="30dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
>
......
......@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/colorPrimaryDark">
android:background="@drawable/gradient">
<ImageView
android:id="@+id/image_splash"
......
......@@ -5,6 +5,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:paddingTop="20dp"
android:background="@drawable/gradient"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android">
......
......@@ -18,7 +18,7 @@
android:id="@+id/cvCategory"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/ic_launcher_background"
android:backgroundTint="#2041B8"
app:cardCornerRadius="40dp">
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3498DB</color>
<color name="colorPrimary">#2041B8</color>
<color name="colorPrimaryDark">#3498DB</color>
<color name="colorAccent">#0f4c75</color>
<color name="colorAccent">#2793DC</color>
<color name="colorWhite">#fff</color>
<color name="mtrl_textinput_default_box_stroke_color">#fff</color>
<color name="color_stroke">#22333333</color>
......
......@@ -6,7 +6,7 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:fontFamily">@font/roboto</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">true</item>
......@@ -18,14 +18,16 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:actionBarStyle">@style/ThemeActionBar</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="actionBarStyle">@style/ThemeActionBar</item>
</style>
<style name="ThemeActionBar" parent="Widget.MaterialComponents.Light.ActionBar.Solid">
<item name="android:background"> @null </item>
<!-- Support library compatibility -->
......
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