Commit 343b0f0f authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

Merge branch 'dev' of https://git.mdd.co.id:44195/muhammadsuryono/meser into dashboard

parents 03d7aabf 9f5af180
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL> <DBN-PSQL>
<case-options enabled="true"> <case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" /> <option name="KEYWORD_CASE" value="lower" />
......
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme.appbar"> android:theme="@style/AppTheme.appbar">
<activity android:name=".ProductActivity"></activity> <activity android:name=".LoginActivity" android:theme="@style/AppTheme.appbar" />
<activity <activity
android:name=".PaymentActivity" android:name=".PaymentActivity"
android:theme="@style/AppTheme.appbar" /> android:theme="@style/AppTheme.appbar" />
<activity android:name=".CartActivity" /> <activity
android:name=".CartActivity"
android:theme="@style/AppTheme.appbar" />
<activity android:name=".ProductActivity" android:theme="@style/AppTheme.appbar" />
<activity android:name=".SplashScreen"> <activity android:name=".SplashScreen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -25,7 +28,8 @@ ...@@ -25,7 +28,8 @@
</activity> </activity>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:theme="@style/AppTheme.appbar"></activity> android:theme="@style/AppTheme.appbar" />
<activity android:name=".FormProductActivity" />
<meta-data <meta-data
android:name="preloaded_fonts" android:name="preloaded_fonts"
......
...@@ -3,12 +3,17 @@ package com.yono.messeripos; ...@@ -3,12 +3,17 @@ package com.yono.messeripos;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import java.text.NumberFormat; import java.text.NumberFormat;
...@@ -19,6 +24,7 @@ public class CartActivity extends AppCompatActivity { ...@@ -19,6 +24,7 @@ public class CartActivity extends AppCompatActivity {
ImageButton btMinus, btPlus, btDelete; ImageButton btMinus, btPlus, btDelete;
TextInputEditText tiQty; TextInputEditText tiQty;
TextView tvQtyView, tvPrice, tvTotal; TextView tvQtyView, tvPrice, tvTotal;
MaterialButton btnCheckout;
public int counter, prices; public int counter, prices;
...@@ -27,6 +33,11 @@ public class CartActivity extends AppCompatActivity { ...@@ -27,6 +33,11 @@ public class CartActivity extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart); 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); MaterialToolbar toolbars = findViewById(R.id.cAppBar);
setSupportActionBar(toolbars); setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
...@@ -37,6 +48,7 @@ public class CartActivity extends AppCompatActivity { ...@@ -37,6 +48,7 @@ public class CartActivity extends AppCompatActivity {
btMinus = findViewById(R.id.btMinus); btMinus = findViewById(R.id.btMinus);
btPlus = findViewById(R.id.btPlus); btPlus = findViewById(R.id.btPlus);
btDelete = findViewById(R.id.btDelete); btDelete = findViewById(R.id.btDelete);
btnCheckout = findViewById(R.id.btCheckout);
tiQty = findViewById(R.id.etQty); tiQty = findViewById(R.id.etQty);
tvQtyView = findViewById(R.id.tvQuantity); tvQtyView = findViewById(R.id.tvQuantity);
...@@ -73,6 +85,14 @@ public class CartActivity extends AppCompatActivity { ...@@ -73,6 +85,14 @@ public class CartActivity extends AppCompatActivity {
countTotal(); countTotal();
} }
}); });
btnCheckout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(CartActivity.this, PaymentActivity.class));
finish();
}
});
} }
private void countTotal() { private void countTotal() {
......
package com.yono.messeripos;
import android.os.Bundle;
import android.os.PersistableBundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class FormProductActivity extends AppCompatActivity {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.form_product);
}
}
package com.yono.messeripos;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.content.SharedPreferences;
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 android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.models.UsersModels;
import com.yono.messeripos.response.DataResponse;
public class LoginActivity extends AppCompatActivity {
TextInputEditText username, password;
MaterialButton btnLogin;
MainViewModels mainViewModels;
ProgressBar progressBar;
SharedPreferences sharedPreferences;
@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);
sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Snackbar snackbar = Snackbar.make(v, "Oppss! Wrong Username Or Password!", Snackbar.LENGTH_LONG);
if (TextUtils.isEmpty(username.getText().toString()) &&
TextUtils.isEmpty(password.getText().toString())){
username.setError("This field can't empty");
password.setError("This field can't empty");
}else if (TextUtils.isEmpty(username.getText().toString())){
username.setError("This field can't empty");
}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
public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
Log.d("Status", usersModelsDataResponse.getMessageData());
if (!usersModelsDataResponse.getMessageData().equals("Login Failed")){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(SplashScreen.SESSION, true);
editor.commit();
startActivity(new Intent(LoginActivity.this, MainActivity.class));
progressBar.setVisibility(View.GONE);
username.setEnabled(true);
password.setEnabled(true);
btnLogin.setEnabled(true);
}else {
snackbar.show();
progressBar.setVisibility(View.GONE);
username.setEnabled(true);
password.setEnabled(true);
btnLogin.setEnabled(true);
}
}
});
}
}
});
}
}
\ No newline at end of file
...@@ -4,36 +4,40 @@ import android.content.Intent; ...@@ -4,36 +4,40 @@ import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders; import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.button.MaterialButton;
import com.yono.messeripos.adapter.ProductAdapter; import com.yono.messeripos.adapter.ProductAdapter;
import com.yono.messeripos.databinding.ActivityMainBinding; import com.yono.messeripos.databinding.ActivityMainBinding;
import com.yono.messeripos.models.MainViewModels; import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.models.ProductModels; import com.yono.messeripos.models.ProductModels;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.yono.messeripos.adapter.CategoryAdapter; import com.yono.messeripos.adapter.CategoryAdapter;
import com.yono.messeripos.adapter.ProductAdapter;
import com.yono.messeripos.databinding.ActivityMainBinding; import com.yono.messeripos.databinding.ActivityMainBinding;
import com.yono.messeripos.databinding.ItemListBinding;
import com.yono.messeripos.models.CategoryModels; import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.MainViewModels; import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.models.ProductModels;
import com.yono.messeripos.response.DataResponse; import com.yono.messeripos.response.DataResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
MaterialToolbar toolbar; MaterialToolbar toolbar;
...@@ -41,7 +45,8 @@ public class MainActivity extends AppCompatActivity { ...@@ -41,7 +45,8 @@ public class MainActivity extends AppCompatActivity {
ActivityMainBinding binding; ActivityMainBinding binding;
CategoryAdapter categoryAdapter; CategoryAdapter categoryAdapter;
ProductAdapter productAdapter; ProductAdapter productAdapter;
public static Boolean status_update = false;
MaterialButton addToCart;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -50,19 +55,14 @@ public class MainActivity extends AppCompatActivity { ...@@ -50,19 +55,14 @@ public class MainActivity extends AppCompatActivity {
ProductAdapter adapter = new ProductAdapter(); ProductAdapter adapter = new ProductAdapter();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main); binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
binding.rvProduct.setAdapter(adapter); binding.rvProduct.setAdapter(adapter);
// setContentView(R.layout.activity_main);
categoryAdapter = new CategoryAdapter(); categoryAdapter = new CategoryAdapter();
productAdapter = new ProductAdapter(); productAdapter = new ProductAdapter();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow(); Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
w.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
w.setStatusBarColor(ContextCompat.getColor(MainActivity.this, R.color.colorWhite));
} }
toolbar = findViewById(R.id.topAppBar); toolbar = findViewById(R.id.topAppBar);
...@@ -72,6 +72,12 @@ public class MainActivity extends AppCompatActivity { ...@@ -72,6 +72,12 @@ public class MainActivity extends AppCompatActivity {
int id = item.getItemId(); int id = item.getItemId();
if (id == R.id.menu_cart) { if (id == R.id.menu_cart) {
startActivity(new Intent(getApplicationContext(), CartActivity.class)); startActivity(new Intent(getApplicationContext(), CartActivity.class));
}else if (id == R.id.update){
status_update = true;
binding.rvCategory.setVisibility(View.GONE);
productAdapter.notifyDataSetChanged();
}else if (id == R.id.create) {
startActivity(new Intent(getApplicationContext(), FormProductActivity.class));
} }
return true; return true;
} }
...@@ -109,8 +115,8 @@ public class MainActivity extends AppCompatActivity { ...@@ -109,8 +115,8 @@ public class MainActivity extends AppCompatActivity {
productModelsArrayList.addAll(productModels); productModelsArrayList.addAll(productModels);
productAdapter.setProduct(MainActivity.this,productModelsArrayList ); productAdapter.setProduct(MainActivity.this,productModelsArrayList );
binding.rvCategory.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.HORIZONTAL, false)); binding.rvProduct.setLayoutManager(new GridLayoutManager(MainActivity.this, 2));
binding.rvCategory.setAdapter(categoryAdapter); binding.rvProduct.setAdapter(productAdapter);
} }
...@@ -118,9 +124,5 @@ public class MainActivity extends AppCompatActivity { ...@@ -118,9 +124,5 @@ public class MainActivity extends AppCompatActivity {
Log.d("Get data from products", "Response " + js); Log.d("Get data from products", "Response " + js);
} }
}); });
} }
} }
\ No newline at end of file
...@@ -4,7 +4,10 @@ import androidx.appcompat.app.AppCompatActivity; ...@@ -4,7 +4,10 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toolbar; import android.widget.Toolbar;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
...@@ -16,13 +19,17 @@ import java.util.ArrayList; ...@@ -16,13 +19,17 @@ import java.util.ArrayList;
public class PaymentActivity extends AppCompatActivity { public class PaymentActivity extends AppCompatActivity {
private ArrayList<PaymentResponse> paymentResponses = new ArrayList<>(); private ArrayList<PaymentResponse> paymentResponses = new ArrayList<>();
MaterialToolbar toolbars;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment); 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); MaterialToolbar toolbars = findViewById(R.id.appbar);
setSupportActionBar(toolbars); setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
...@@ -36,6 +43,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -36,6 +43,7 @@ public class PaymentActivity extends AppCompatActivity {
LinearLayoutManager llm = new LinearLayoutManager(this); LinearLayoutManager llm = new LinearLayoutManager(this);
rvPayment.setLayoutManager(llm); rvPayment.setLayoutManager(llm);
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "cash"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni"));
......
package com.yono.messeripos; package com.yono.messeripos;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -12,18 +16,34 @@ import androidx.appcompat.app.AppCompatActivity; ...@@ -12,18 +16,34 @@ import androidx.appcompat.app.AppCompatActivity;
public class SplashScreen extends AppCompatActivity { public class SplashScreen extends AppCompatActivity {
ImageView img; ImageView img;
SharedPreferences sharedPreferences;
public static final String MY_SHARED_PREFERENCES = "my_shared_preferences";
public static final String SESSION = "session";
public static Boolean session;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash); setContentView(R.layout.activity_splash);
img = findViewById(R.id.image_splash); img = findViewById(R.id.image_splash);
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.zoom_in); // Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.zoom_in);
img.startAnimation(animation); // img.startAnimation(animation);
sharedPreferences = getSharedPreferences(MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
session = sharedPreferences.getBoolean(SESSION, false);
new Handler(Looper.getMainLooper()).postDelayed(()->{ new Handler(Looper.getMainLooper()).postDelayed(()->{
startActivity(new Intent(SplashScreen.this, MainActivity.class)); if (session){
finish(); startActivity(new Intent(SplashScreen.this, MainActivity.class));
finish();
}else{
startActivity(new Intent(SplashScreen.this, LoginActivity.class));
finish();
}
}, 3000); }, 3000);
} }
} }
...@@ -2,9 +2,9 @@ package com.yono.messeripos; ...@@ -2,9 +2,9 @@ package com.yono.messeripos;
import android.content.Context; import android.content.Context;
import com.google.android.material.appbar.MaterialToolbar;
public class ToolbarApp { public class ToolbarApp {
public ToolbarApp(Context context, int toolbar, String title) {
}
} }
...@@ -55,9 +55,15 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView ...@@ -55,9 +55,15 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView
super(itemView.getRoot()); super(itemView.getRoot());
this.binding = itemView; this.binding = itemView;
} }
public void binData(CategoryModels categoryModels){ public void binData(CategoryModels categoryModels){
binding.setCategory(categoryModels); binding.setCategory(categoryModels);
binding.cvCategory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.cvCategory.toggle();
}
});
} }
} }
} }
...@@ -6,6 +6,7 @@ import android.util.Log; ...@@ -6,6 +6,7 @@ import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
...@@ -77,6 +78,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -77,6 +78,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder {
MaterialCardView cardView; MaterialCardView cardView;
PaymentListBinding binding; PaymentListBinding binding;
public int position;
public ViewHolder(@NonNull PaymentListBinding view) { public ViewHolder(@NonNull PaymentListBinding view) {
super(view.getRoot()); super(view.getRoot());
this.binding = view; this.binding = view;
...@@ -90,6 +92,15 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -90,6 +92,15 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
binding.setPayment(paymentResponse); binding.setPayment(paymentResponse);
binding.setLogo(paymentResponse.getUrl()); binding.setLogo(paymentResponse.getUrl());
Log.d("Position ", ""+getAdapterPosition());
binding.cvPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Click VC", paymentResponse.getBank());
binding.cvPayment.toggle();
}
});
} }
} }
} }
package com.yono.messeripos.adapter; package com.yono.messeripos.adapter;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.yono.messeripos.MainActivity;
import com.yono.messeripos.R; import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemCategoryBinding;
import com.yono.messeripos.databinding.ItemListBinding; import com.yono.messeripos.databinding.ItemListBinding;
import com.yono.messeripos.models.CategoryModels; import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson;
import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemListBinding;
import com.yono.messeripos.models.CartModels;
import com.yono.messeripos.models.MainViewModelsCart;
import com.yono.messeripos.models.ProductCartModels;
import com.yono.messeripos.models.ProductModels; import com.yono.messeripos.models.ProductModels;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHolder> { public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHolder> {
private ArrayList<ProductModels> productModels; private ArrayList<ProductModels> productModels = new ArrayList<>();
Context context; Context context;
MainViewModelsCart mainViewModelsCart;
public interface CartListener {
void onUpdate(ProductCartModels product);
void onDelete(ProductCartModels product);
}
private CartListener listener;
public void setListener(CartListener listener) {
this.listener = listener;
}
public void setProduct(Context context, ArrayList<ProductModels> productModels){ public void setProduct(Context context, ArrayList<ProductModels> productModels){
this.productModels = productModels; this.productModels = productModels;
this.context = context; this.context = context;
mainViewModelsCart = ViewModelProviders.of((FragmentActivity) context).get(MainViewModelsCart.class);
notifyDataSetChanged(); notifyDataSetChanged();
} }
...@@ -63,6 +91,40 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo ...@@ -63,6 +91,40 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
public void bindData(ProductModels products) { public void bindData(ProductModels products) {
binding.setProducts(products); binding.setProducts(products);
DecimalFormat rupiah = (DecimalFormat) DecimalFormat.getCurrencyInstance();
DecimalFormatSymbols format = new DecimalFormatSymbols();
format.setCurrencySymbol("Rp. ");
format.setMonetaryDecimalSeparator(',');
format.setGroupingSeparator('.');
rupiah.setDecimalFormatSymbols(format);
binding.setPrice(rupiah.format(products.getPriceProduct()));
binding.setImage(products.getImageProduct());
if (!MainActivity.status_update){
binding.btnDelete.setVisibility(View.GONE);
binding.btnEdit.setVisibility(View.GONE);
}
binding.materialBtnAddCart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(context, binding.titleProduct.getText() + " adding to cart", Toast.LENGTH_LONG).show();
mainViewModelsCart.insertCart(new ProductCartModels(
2,
1,
products.getIdProduct(),
products.getProductName(),
products.getPriceProduct(),
0
));
String js = new Gson().toJson(mainViewModelsCart.getCart());
Log.d( "onClick: ", ""+js);
}
});
} }
} }
} }
...@@ -6,6 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory; ...@@ -6,6 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class ApiHelper { public class ApiHelper {
public static final String BASE_URL = "https://rest-api-meser.herokuapp.com/"; public static final String BASE_URL = "https://rest-api-meser.herokuapp.com/";
public static final String VERSI_API_1 = "api/v1/"; public static final String VERSI_API_1 = "api/v1/";
public static final String BASE_URL_IMAGE = "https://storage.googleapis.com/rest-api-meser.appspot.com/images/";
public static Retrofit request(String baseUrl){ public static Retrofit request(String baseUrl){
Retrofit retrofit = new Retrofit.Builder() Retrofit retrofit = new Retrofit.Builder()
......
package com.yono.messeripos.api.service;
import com.yono.messeripos.api.ApiHelper;
import com.yono.messeripos.models.UsersModels;
import com.yono.messeripos.response.DataResponse;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public interface UsersService {
@POST(ApiHelper.VERSI_API_1+"login")
Call<DataResponse<UsersModels>> checkLogin(@Body UsersModels usersModels);
}
...@@ -9,6 +9,7 @@ import com.google.gson.Gson; ...@@ -9,6 +9,7 @@ import com.google.gson.Gson;
import com.yono.messeripos.api.client.Client; import com.yono.messeripos.api.client.Client;
import com.yono.messeripos.api.service.CategoryServise; import com.yono.messeripos.api.service.CategoryServise;
import com.yono.messeripos.api.service.ProductService; import com.yono.messeripos.api.service.ProductService;
import com.yono.messeripos.api.service.UsersService;
import com.yono.messeripos.response.DataResponse; import com.yono.messeripos.response.DataResponse;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -21,6 +22,7 @@ import retrofit2.Response; ...@@ -21,6 +22,7 @@ import retrofit2.Response;
public class MainViewModels extends ViewModel { public class MainViewModels extends ViewModel {
MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> productList; MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> productList;
MutableLiveData<DataResponse<List<CategoryModels>>> categoryList; MutableLiveData<DataResponse<List<CategoryModels>>> categoryList;
MutableLiveData<DataResponse<UsersModels>> usersLogin;
Client client = new Client(); Client client = new Client();
...@@ -39,6 +41,32 @@ public class MainViewModels extends ViewModel { ...@@ -39,6 +41,32 @@ public class MainViewModels extends ViewModel {
return categoryList; return categoryList;
} }
public MutableLiveData<DataResponse<UsersModels>> checkLogin(UsersModels usersModels){
usersLogin = new MutableLiveData<>();
PeriksaLogin(usersModels);
return usersLogin;
}
private void PeriksaLogin(UsersModels usersModels) {
UsersService usersService = client.Client(UsersService.class);
usersService.checkLogin(usersModels).enqueue(new Callback<DataResponse<UsersModels>>() {
@Override
public void onResponse(Call<DataResponse<UsersModels>> call, Response<DataResponse<UsersModels>> response) {
if (response.body() != null){
usersLogin.setValue(response.body());
}
String js = new Gson().toJson(response.body());
Log.d("Periksa login", "Response "+js);
}
@Override
public void onFailure(Call<DataResponse<UsersModels>> call, Throwable t) {
Log.e("Error Login", "Response "+t.getMessage());
}
});
}
private void getProductList() { private void getProductList() {
ProductService productService = client.Client(ProductService.class); ProductService productService = client.Client(ProductService.class);
......
...@@ -32,10 +32,12 @@ public class ProductCartModels implements Parcelable { ...@@ -32,10 +32,12 @@ public class ProductCartModels implements Parcelable {
@SerializedName("grand_total") @SerializedName("grand_total")
private int grand_total_orders; private int grand_total_orders;
public ProductCartModels(long id, int id_orders, long quantity_orders, public ProductCartModels(int id_orders,
int id_product_orders, String product_name_orders, long price_orders, long quantity_orders,
int id_product_orders,
String product_name_orders,
long price_orders,
int grand_total_orders) { int grand_total_orders) {
this.id = id;
this.id_orders = id_orders; this.id_orders = id_orders;
this.quantity_orders = quantity_orders; this.quantity_orders = quantity_orders;
this.id_product_orders = id_product_orders; this.id_product_orders = id_product_orders;
......
package com.yono.messeripos.models; package com.yono.messeripos.models;
import android.widget.ImageView;
import androidx.databinding.BindingAdapter;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.yono.messeripos.R;
import com.yono.messeripos.api.ApiHelper;
public class ProductModels<T> { public class ProductModels<T> {
@SerializedName("id") @SerializedName("id")
...@@ -15,6 +23,9 @@ public class ProductModels<T> { ...@@ -15,6 +23,9 @@ public class ProductModels<T> {
@SerializedName("stock") @SerializedName("stock")
private int stockProduct; private int stockProduct;
@SerializedName("image")
private String imageProduct;
@SerializedName("category") @SerializedName("category")
private T categoryProduct; private T categoryProduct;
...@@ -57,4 +68,24 @@ public class ProductModels<T> { ...@@ -57,4 +68,24 @@ public class ProductModels<T> {
public void setCategoryProduct(T categoryProduct) { public void setCategoryProduct(T categoryProduct) {
this.categoryProduct = categoryProduct; this.categoryProduct = categoryProduct;
} }
public String getImageProduct() {
return imageProduct;
}
public void setImageProduct(String imageProduct) {
this.imageProduct = imageProduct;
}
@BindingAdapter("url")
public static void setImage(ImageView view, String url){
if (ApiHelper.BASE_URL_IMAGE+url == null){
view.setImageResource(R.drawable.ic_meser);
}else{
Glide.with(view)
.applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.skeleton).error(R.drawable.skeleton))
.load(ApiHelper.BASE_URL_IMAGE+url)
.into(view);
}
}
} }
...@@ -9,6 +9,11 @@ public class UsersModels { ...@@ -9,6 +9,11 @@ public class UsersModels {
@SerializedName("password") @SerializedName("password")
private String passwordUsers; private String passwordUsers;
public UsersModels(String usernameUsers, String passwordUsers) {
this.usernameUsers = usernameUsers;
this.passwordUsers = passwordUsers;
}
public String getUsernameUsers() { public String getUsernameUsers() {
return usernameUsers; return usernameUsers;
} }
......
...@@ -25,10 +25,14 @@ public class CartRepositories { ...@@ -25,10 +25,14 @@ public class CartRepositories {
} }
public void update(ProductCartModels productCartModels){ public void update(ProductCartModels productCartModels){
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.insertProduct(productCartModels)); LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.updateProduct(productCartModels));
} }
public void delete(ProductCartModels productCartModels){ public void delete(ProductCartModels productCartModels){
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.insertProduct(productCartModels)); LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.deleteProduct(productCartModels));
}
public LiveData<List<ProductCartModels>> getDataCart(){
return products;
} }
} }
...@@ -5,6 +5,8 @@ import android.widget.ImageView; ...@@ -5,6 +5,8 @@ import android.widget.ImageView;
import androidx.databinding.BindingAdapter; import androidx.databinding.BindingAdapter;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.yono.messeripos.R;
public class PaymentResponse { public class PaymentResponse {
...@@ -44,6 +46,7 @@ public class PaymentResponse { ...@@ -44,6 +46,7 @@ public class PaymentResponse {
@BindingAdapter("logo_bank") @BindingAdapter("logo_bank")
public static void loadImage(ImageView view, String url) { public static void loadImage(ImageView view, String url) {
Glide.with(view.getContext()) Glide.with(view.getContext())
.applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.skeleton).error(R.drawable.skeleton))
.load(url) .load(url)
.into(view); .into(view);
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
xmlns:android="http://schemas.android.com/apk/res/android" <scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000" android:fromXScale="0.5"
android:fromXScale="2" android:toXScale="2.0"
android:fromYScale="2" android:fromYScale="0.5"
android:toYScale="2.0"
android:duration="3000"
android:pivotX="50%" android:pivotX="50%"
android:pivotY="50%" android:pivotY="50%" >
android:toXScale="4"
android:toYScale="4" >
</scale> </scale>
</set> </set>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:bottomLeftRadius="50mm"/>
<gradient android:startColor="#1B76D6" android:endColor="#3028A1"/>
<size android:height="100sp"/>
</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>
<shape>
<gradient android:startColor="#1B76D6" android:endColor="#3028A1"/>
</shape>
</item>
</selector>
\ No newline at end of file
<vector android:height="24dp" android:tint="#FF4A50" <vector android:height="24dp" android:tint="#FC151B"
android:viewportHeight="24" android:viewportWidth="24" android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/> <path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
......
<vector android:height="24dp" android:tint="#34C25B"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
</vector>
<vector android:height="24dp" android:tint="#FC151B"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,16v-5c0,-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,-2zM13,16h-2v-2h2v2zM13,12h-2L11,8h2v4zM12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Poppins&amp;weight=700"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="name=Poppins&amp;weight=500"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/etQty" android:id="@+id/etQty"
android:enabled="false"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="1" android:text="1"
...@@ -134,6 +135,8 @@ ...@@ -134,6 +135,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/title_checkout" android:text="@string/title_checkout"
android:padding="15dp"
android:textSize="16sp"
android:layout_margin="10dp" android:layout_margin="10dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
......
<?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:background="@drawable/bg_login"
android:fitsSystemWindows="true"
tools:context=".LoginActivity">
<ImageView
android:id="@+id/ivLogin"
android:layout_width="191dp"
android:layout_height="166dp"
android:src="@drawable/ic_launcher_new_icon_foreground"
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.0" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvLoginToAcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_medium"
android:text="Login to your account"
android:textSize="16sp"
android:textFontWeight="600"
android:textColor="@color/colorWhite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.112"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.246" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvLogin"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginHorizontal="30dp"
app:cardElevation="0dp"
android:backgroundTint="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLoginToAcc"
app:layout_constraintVertical_bias="0.0">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfUsername"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="5dp"
android:hint="@string/username"
android:textColorHint="@color/colorWhite"
app:hintTextColor="@color/colorWhite"
app:boxStrokeColor="@color/colorWhite"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiUsername"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/colorWhite"
android:inputType="text"
android:imeOptions="actionNext"
android:fontFamily="@font/poppins_medium" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfPassword"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="5dp"
android:hint="@string/password"
android:textColorHint="@color/colorWhite"
app:hintTextColor="@color/colorWhite"
app:boxStrokeColor="@color/colorWhite"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tfUsername"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/colorWhite"
android:inputType="textPassword"
android:imeOptions="actionGo"
android:fontFamily="@font/poppins_medium" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:backgroundTint="#2041B8"
android:fontFamily="@font/poppins_medium"
android:imeOptions="actionGo"
android:paddingVertical="15dp"
android:text="login"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tfPassword"
app:layout_constraintVertical_bias="0.01999998" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="@font/poppins_medium"
android:text="forgot your password ?"
android:textColor="@color/colorWhite"
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,9 @@ ...@@ -21,9 +21,9 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
xmlns:app="http://schemas.android.com/apk/res-auto" android:paddingTop="20dp"
android:paddingStart="15dp" android:paddingStart="15dp"
xmlns:android="http://schemas.android.com/apk/res/android"> tools:ignore="RtlSymmetry">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar" android:id="@+id/topAppBar"
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
app:menu="@menu/home" app:menu="@menu/home"
android:elevation="0dp" android:elevation="0dp"
app:navigationIcon="@drawable/ic_meser" app:navigationIcon="@drawable/ic_meser"
android:layout_marginTop="30dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary" style="@style/Widget.MaterialComponents.Toolbar.Primary"
> >
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="pay" android:text="pay"
android:padding="15dp"
android:textSize="16sp"
android:layout_margin="10dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/colorPrimaryDark"> android:background="@drawable/gradient">
<ImageView <ImageView
android:id="@+id/image_splash" android:id="@+id/image_splash"
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="0dp" android:elevation="0dp"
android:paddingTop="20dp"
android:background="@drawable/gradient"
style="@style/Widget.MaterialComponents.Toolbar.Primary" style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvProduct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
app:cardCornerRadius="80dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/tfName">
<ImageView
android:id="@+id/ivProduct"
android:layout_width="160dp"
android:layout_height="160dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_meser_icon" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/name"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@+id/cvProduct"
tools:ignore="MissingConstraints">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/price"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfName">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/stock"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfPrice">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listCategory"
android:padding="15dp"
android:layout_margin="10dp"
app:layout_constraintTop_toBottomOf="@id/tfStock">
</Spinner>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnAdd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:layout_constraintTop_toBottomOf="@+id/listCategory"
android:text="@string/add"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="40dp" android:layout_height="40dp"
android:layout_width="wrap_content"> android:layout_width="wrap_content"
android:layout_marginEnd="5dp">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cvCategory"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:backgroundTint="@color/ic_launcher_background" android:backgroundTint="#2041B8"
app:cardCornerRadius="40dp"> app:cardCornerRadius="40dp">
......
...@@ -7,79 +7,101 @@ ...@@ -7,79 +7,101 @@
<variable <variable
name="products" name="products"
type="com.yono.messeripos.models.ProductModels" /> type="com.yono.messeripos.models.ProductModels" />
<variable
name="price"
type="String" />
<variable
name="image"
type="String" />
</data> </data>
<com.google.android.material.card.MaterialCardView <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="300dp"
android:layout_margin="@dimen/cardview_default_radius" android:layout_marginEnd="10dp"
android:padding="@dimen/cardview_default_elevation" android:layout_marginBottom="10dp">
app:cardCornerRadius="@dimen/cardview_default_radius">
<RelativeLayout <com.google.android.material.card.MaterialCardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="match_parent"
app:cardElevation="0dp"
app:strokeWidth="1dp"
app:strokeColor="#3CB3B3B3"
app:cardCornerRadius="10dp">
<ImageView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ivMeser"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:adjustViewBounds="true"
tools:src="@tools:sample/avatars" />
<com.google.android.material.textview.MaterialTextView <ImageView
android:id="@+id/tvQuantity" android:id="@+id/image_product"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="200dp"
android:layout_above="@id/tvProduct" android:src="@mipmap/ic_launcher_round"
android:layout_alignParentEnd="true" app:layout_constraintTop_toTopOf="parent"
android:background="#fff" app:url="@{image}"
android:fontFamily="monospace" android:scaleType="fitXY"/>
android:padding="@dimen/material_emphasis_medium"
android:textColor="@android:color/white"
android:textSize="12sp"
android:textStyle="bold"
tools:text="10" />
<com.google.android.material.textview.MaterialTextView <ImageView
android:id="@+id/tvProduct" android:id="@+id/btnDelete"
android:layout_width="match_parent" android:layout_width="30dp"
android:layout_height="wrap_content" android:layout_height="30dp"
android:layout_below="@id/ivMeser" app:layout_constraintEnd_toEndOf="parent"
android:fontFamily="@font/roboto" app:layout_constraintTop_toTopOf="parent"
android:gravity="center" android:src="@drawable/ic_baseline_delete_24"/>
android:padding="@dimen/material_emphasis_high_type"
android:textAllCaps="true"
android:textColor="@color/ic_launcher_background"
android:textSize="12sp"
android:textStyle="bold"
tools:text="@tools:sample/full_names" />
<com.google.android.material.textview.MaterialTextView <ImageView
android:id="@+id/tvPrice" android:id="@+id/btnEdit"
android:layout_width="match_parent" android:layout_width="30dp"
android:layout_height="wrap_content" android:layout_height="30dp"
android:layout_below="@id/tvProduct" app:layout_constraintTop_toTopOf="parent"
android:fontFamily="@font/roboto" app:layout_constraintStart_toStartOf="parent"
android:gravity="end" android:src="@drawable/ic_baseline_edit_24"/>
android:paddingStart="@dimen/material_emphasis_medium"
android:paddingEnd="@dimen/material_emphasis_disabled"
android:textColor="@color/colorPrimary"
android:textSize="12sp" />
<com.google.android.material.textview.MaterialTextView <TextView
android:id="@+id/tvDescription" android:id="@+id/title_product"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tvPrice" app:layout_constraintTop_toBottomOf="@id/image_product"
android:fontFamily="@font/roboto" app:layout_constraintStart_toStartOf="parent"
android:padding="@dimen/material_emphasis_high_type" tools:text="@tools:sample/full_names"
android:textColor="@android:color/darker_gray" android:textColor="@android:color/black"
android:textSize="12sp" android:layout_marginStart="10dp"
tools:text="@tools:sample/lorem" /> android:layout_marginTop="5dp"
android:textSize="18sp"
android:lines="1"
android:textStyle="bold"
android:text="@{products.productName}"
android:maxLength="25"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title_product"
app:layout_constraintStart_toStartOf="parent"
tools:text="@tools:sample/full_names"
android:textColor="@android:color/black"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:textSize="18sp"
android:lines="1"
android:text="@{price}"
android:maxLength="25"/>
</RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/materialBtnAddCart"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="bottom"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="Add To Cart"/>
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
\ No newline at end of file \ No newline at end of file
...@@ -21,11 +21,14 @@ ...@@ -21,11 +21,14 @@
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cvPayment" android:id="@+id/cvPayment"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="1dp" app:strokeWidth="1dp"
app:strokeColor="#22333333"> app:strokeColor="@color/color_stroke">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -64,16 +67,6 @@ ...@@ -64,16 +67,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
/> />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/rbPayment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:enabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/ivLogo"
app:layout_constraintTop_toTopOf="@id/ivLogo"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#3498DB</color> <color name="colorPrimary">#2041B8</color>
<color name="colorPrimaryDark">#3498DB</color> <color name="colorPrimaryDark">#3498DB</color>
<color name="colorAccent">#0f4c75</color> <color name="colorAccent">#2793DC</color>
<color name="colorWhite">#fff</color> <color name="colorWhite">#fff</color>
<color name="mtrl_textinput_default_box_stroke_color">#fff</color>
<color name="color_stroke">#22333333</color>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<array name="preloaded_fonts" translatable="false"> <array name="preloaded_fonts" translatable="false">
<item>@font/poppins_bold</item>
<item>@font/poppins_medium</item>
<item>@font/roboto</item> <item>@font/roboto</item>
</array> </array>
</resources> </resources>
...@@ -16,5 +16,11 @@ ...@@ -16,5 +16,11 @@
<string name="hint_quantity">0</string> <string name="hint_quantity">0</string>
<string name="hint_price">1000</string> <string name="hint_price">1000</string>
<string name="hint_description">Description</string> <string name="hint_description">Description</string>
<string name="username">Username</string>
<string name="password">password</string>
<string name="name">Name</string>
<string name="price">Price</string>
<string name="stock">Stock</string>
<string name="add">Add</string>
</resources> </resources>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="android:fontFamily">@font/roboto</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:actionBarStyle">@style/ThemeActionBar</item>
<item name="android:windowActionBarOverlay">false</item> <item name="android:windowActionBarOverlay">false</item>
<item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentStatus">true</item>
...@@ -18,8 +18,22 @@ ...@@ -18,8 +18,22 @@
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</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>
<style name="AppTheme.my.a" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="ThemeActionBar" parent="Widget.MaterialComponents.Light.ActionBar.Solid"> <style name="ThemeActionBar" parent="Widget.MaterialComponents.Light.ActionBar.Solid">
<item name="android:background"> @null </item> <item name="android:background"> @null </item>
<!-- Support library compatibility --> <!-- 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