Commit e24b80e9 authored by iman Fauzi's avatar iman Fauzi

fix layout main

parent 108224e5
...@@ -62,11 +62,12 @@ public class MainActivity extends AppCompatActivity { ...@@ -62,11 +62,12 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
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);
binding.appBarUpdate.setVisibility(View.GONE); // binding.appBarUpdate.setVisibility(View.GONE);
Log.i("Status Checkout main activity", "onCreate: "+SplashScreen.checkout); Log.i("Status Checkout main activity", "onCreate: "+SplashScreen.checkout);
showLoading(true); showLoading(true);
...@@ -96,13 +97,13 @@ public class MainActivity extends AppCompatActivity { ...@@ -96,13 +97,13 @@ public class MainActivity extends AppCompatActivity {
status_update = true; status_update = true;
binding.topAppBar.setVisibility(View.GONE); binding.topAppBar.setVisibility(View.GONE);
binding.rvCategory.setVisibility(View.GONE); binding.rvCategory.setVisibility(View.GONE);
binding.appBarUpdate.setVisibility(View.VISIBLE); // binding.appBarUpdate.setVisibility(View.VISIBLE);
MaterialToolbar toolbars = findViewById(R.id.appBarUpdate); // MaterialToolbar toolbars = findViewById(R.id.appBarUpdate);
setSupportActionBar(toolbars); // setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle("Update Product"); getSupportActionBar().setTitle("Update Product");
toolbars.setNavigationOnClickListener(view -> updateFinish()); // toolbars.setNavigationOnClickListener(view -> updateFinish());
productAdapter.notifyDataSetChanged(); productAdapter.notifyDataSetChanged();
}else if (id == R.id.create) { }else if (id == R.id.create) {
...@@ -279,7 +280,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -279,7 +280,7 @@ public class MainActivity extends AppCompatActivity {
status_update = false; status_update = false;
binding.topAppBar.setVisibility(View.VISIBLE); binding.topAppBar.setVisibility(View.VISIBLE);
binding.rvCategory.setVisibility(View.VISIBLE); binding.rvCategory.setVisibility(View.VISIBLE);
binding.appBarUpdate.setVisibility(View.GONE); // binding.appBarUpdate.setVisibility(View.GONE);
productAdapter.notifyDataSetChanged(); productAdapter.notifyDataSetChanged();
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
type="com.yono.messeripos.models.MainViewModels" /> type="com.yono.messeripos.models.MainViewModels" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".MainActivity">
...@@ -23,28 +23,16 @@ ...@@ -23,28 +23,16 @@
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"
android:paddingTop="20dp" android:paddingTop="20dp">
tools:ignore="RtlSymmetry">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/appBarUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:paddingTop="0dp"
android:background="@drawable/gradient"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android">
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar" android:id="@+id/topAppBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/gradient"
app:menu="@menu/home" app:menu="@menu/home"
android:elevation="0dp" android:elevation="0dp"
app:navigationIcon="@mipmap/ic_meser_icon" app:navigationIcon="@drawable/logo"
style="@style/Widget.MaterialComponents.Toolbar.Primary" style="@style/Widget.MaterialComponents.Toolbar.Primary"
> >
...@@ -66,11 +54,10 @@ ...@@ -66,11 +54,10 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvCategory" android:id="@+id/rvCategory"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="wrap_content"
android:layout_marginStart="5dp" tools:listitem="@layout/item_category"
app:layout_constraintTop_toBottomOf="@id/topBar" android:layout_below="@id/topBar"
android:layout_marginTop="10dp" android:layout_above="@id/imgEmpty"/>
tools:listitem="@layout/item_category" />
<ImageView <ImageView
android:id="@+id/imgEmpty" android:id="@+id/imgEmpty"
...@@ -78,20 +65,18 @@ ...@@ -78,20 +65,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:src="@drawable/no" android:src="@drawable/no"
app:layout_constraintTop_toBottomOf="@id/rvCategory"/> android:layout_below="@id/topBar"
android:foregroundGravity="center"/>
<ProgressBar <ProgressBar
android:id="@+id/pbLoading" android:id="@+id/pbLoading"
android:indeterminateTint="@color/colorAccent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:backgroundTint="@color/colorAccent" android:backgroundTint="@color/colorAccent"
app:layout_constraintTop_toTopOf="parent" android:indeterminateTint="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_centerInParent="true"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Scrollable content --> <!-- Scrollable content -->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProduct" android:id="@+id/rvProduct"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -100,11 +85,9 @@ ...@@ -100,11 +85,9 @@
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2" app:spanCount="2"
android:layout_marginHorizontal="5dp" android:layout_marginHorizontal="5dp"
app:layout_constraintTop_toBottomOf="@id/rvCategory"
tools:listitem="@layout/item_list" tools:listitem="@layout/item_list"
app:layout_constraintStart_toStartOf="parent" android:layout_below="@id/rvCategory"/>
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout> </RelativeLayout>
</layout> </layout>
\ No newline at end of file
...@@ -10,59 +10,53 @@ ...@@ -10,59 +10,53 @@
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="40dp" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginEnd="5dp"> android:paddingVertical="10dp"
android:layout_marginHorizontal="3dp">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cvCategory" android:id="@+id/cvCategory"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:backgroundTint="#2041B8" android:backgroundTint="#2041B8"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:checkable="true" android:checkable="true"
app:cardCornerRadius="40dp"> app:cardCornerRadius="50dp"
android:clipToPadding="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content"
android:paddingHorizontal="20dp">
<ImageView <ImageView
android:id="@+id/image_cat" android:id="@+id/image_cat"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:src="@drawable/ic_meser" android:src="@drawable/ic_meser"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:ignore="MissingConstraints" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="40dp"
android:fontFamily="@font/roboto" android:fontFamily="@font/roboto"
android:text="@{category.nameCategory}" android:text="@{category.nameCategory}"
android:textStyle="bold" android:textStyle="bold"
android:textSize="20sp" android:textSize="20sp"
android:textColor="#fff" android:textColor="#fff"
tools:text="@tools:sample/full_names" tools:text="elizabeth"
android:layout_toRightOf="@id/image_cat"
app:layout_constraintBottom_toBottomOf="parent" android:layout_centerInParent="true"/>
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image_cat"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout> </RelativeLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
......
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