mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
commit
a7b92120ba
|
@ -45,6 +45,9 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
// Set navigation bar color
|
||||
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
|
||||
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||
|
||||
// Set status bar color
|
||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,11 @@
|
|||
android:id="@+id/bottom_nav"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorSecondaryContainer"
|
||||
app:itemIconTint="@color/colorOnSecondaryContainer"
|
||||
app:itemTextColor="@color/colorOnSecondaryContainer"
|
||||
app:itemActiveIndicatorStyle="@style/Lacerta.Custom.Indicator"
|
||||
app:labelVisibilityMode="selected"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -32,4 +32,6 @@ dependencies {
|
|||
testImplementation libs.junit
|
||||
androidTestImplementation libs.androidx.test.ext.junit
|
||||
androidTestImplementation libs.androidx.test.espresso.core
|
||||
|
||||
implementation project(':shared:ui')
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_icon"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/item_text_container"
|
||||
app:srcCompat="@drawable/description_24px"
|
||||
android:contentDescription="icon" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/item_text_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/item_icon"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="Placeholder Title"
|
||||
android:textColor="@color/colorOnSurface"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:text="Placeholder Description"
|
||||
android:textColor="@color/colorOnSurface"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/item_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -11,6 +11,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="Placeholder Title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -19,6 +20,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:text="Placeholder Description"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
|
||||
|
|
|
@ -55,4 +55,6 @@ dependencies {
|
|||
implementation project(':model')
|
||||
|
||||
implementation "androidx.recyclerview:recyclerview:1.3.2"
|
||||
|
||||
implementation project(':component:common')
|
||||
}
|
|
@ -3,13 +3,24 @@ package one.nem.lacerta.feature.home;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -34,34 +45,13 @@ public class HomeTopFragment extends Fragment {
|
|||
@Inject
|
||||
LacertaLibrary lacertaLibrary;
|
||||
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public HomeTopFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment HomeTopFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static HomeTopFragment newInstance(String param1, String param2) {
|
||||
public static HomeTopFragment newInstance() {
|
||||
HomeTopFragment fragment = new HomeTopFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -70,49 +60,58 @@ public class HomeTopFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
|
||||
|
||||
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
|
||||
ArrayList<ListItem> recentDocument = lacertaLibrary.getRecentDocument(10);
|
||||
|
||||
ArrayList<ListItem> listItems = lacertaLibrary.getRecentDocument(100);
|
||||
Log.d("docs", Integer.toString(recentDocument.size()));
|
||||
|
||||
Log.d("docs", Integer.toString(listItems.size()));
|
||||
|
||||
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view);
|
||||
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
MyAdapter myAdapter = new MyAdapter(listItems);
|
||||
ListItemAdapter listItemAdapter = new ListItemAdapter(recentDocument);
|
||||
|
||||
recyclerView.setAdapter(myAdapter);
|
||||
recyclerView.setAdapter(listItemAdapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
}
|
||||
String pageTitle;
|
||||
String pageId;
|
||||
ArrayList listItems;
|
||||
|
||||
String title;
|
||||
String description;
|
||||
|
||||
String itemId;
|
||||
CollapsingToolbarLayout collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
|
||||
// Set the Toolbar
|
||||
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
|
||||
|
||||
// Set the title of the CollapsingToolbarLayout
|
||||
collapsingToolbarLayout.setTitle("Lacerta");
|
||||
|
||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
||||
// Collapsed
|
||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getActivity(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||
} else if (verticalOffset == 0) {
|
||||
// Expanded
|
||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getActivity(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||
} else {
|
||||
// Somewhere in between
|
||||
// Here you can add a color transition if you want
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package one.nem.lacerta.feature.home;
|
||||
|
||||
import android.media.Image;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import one.nem.lacerta.model.ListItem;
|
||||
|
||||
public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListItemViewHolder>{
|
||||
|
||||
ArrayList<ListItem> listItems;
|
||||
|
||||
public ListItemAdapter(ArrayList<ListItem> listItems){
|
||||
this.listItems = listItems;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ListItemAdapter.ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.component.common.R.layout.common_library_list_item, parent, false);
|
||||
return new ListItemViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ListItemAdapter.ListItemViewHolder holder, int position) {
|
||||
ListItem listItem = listItems.get(position);
|
||||
holder.icon.setImageResource(listItem.getItemType().getIconId());
|
||||
holder.icon.setColorFilter(one.nem.lacerta.shared.ui.R.color.colorOnSurface);
|
||||
holder.title.setText(listItem.getTitle());
|
||||
holder.description.setText(listItem.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listItems.size();
|
||||
}
|
||||
|
||||
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
ImageView icon;
|
||||
TextView title;
|
||||
TextView description;
|
||||
public ListItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
icon = itemView.findViewById(one.nem.lacerta.component.common.R.id.item_icon);
|
||||
title = itemView.findViewById(one.nem.lacerta.component.common.R.id.item_title);
|
||||
description = itemView.findViewById(one.nem.lacerta.component.common.R.id.item_description);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".HomeTopFragment"
|
||||
tools:ignore="ExtraText">
|
||||
android:background="@color/colorSurface">
|
||||
|
||||
|
||||
<!-- TODO: Update blank fragment layout -->
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/item_recycler_view"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/collapsing_toolbar"
|
||||
app:contentScrim="@color/colorSecondaryContainer"
|
||||
android:background="@color/colorSurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp"
|
||||
android:fitsSystemWindows="true"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:collapsedTitleGravity="start|center_vertical"
|
||||
app:expandedTitleGravity="start|bottom"
|
||||
app:expandedTitleMarginBottom="16dp"
|
||||
app:expandedTitleMarginStart="16dp"
|
||||
app:expandedTitleTextAppearance="@style/TextAppearance.MaterialComponents.Headline4"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_collapseMode="pin"
|
||||
app:title="HOGE" />
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/home_item_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
</FrameLayout>
|
8
feature/home/src/main/res/menu/drawer_menu.xml
Normal file
8
feature/home/src/main/res/menu/drawer_menu.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/item_placeholder"
|
||||
android:icon="@drawable/developer_mode_24px"
|
||||
android:title="@string/placeholder" />
|
||||
</menu>
|
|
@ -30,6 +30,7 @@
|
|||
<item name="colorOnBackground">@color/colorOnBackground</item>
|
||||
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
|
||||
</style>
|
||||
</resources>
|
|
@ -25,4 +25,7 @@
|
|||
<color name="colorSurfaceVariant">@color/material_dynamic_neutral_variant90</color>
|
||||
<color name="colorOnSurfaceVariant">@color/material_dynamic_neutral_variant30</color>
|
||||
<color name="colorSurfaceInverse">@color/material_dynamic_neutral20</color>
|
||||
|
||||
<!-- indicator icon background -->
|
||||
<color name="colorIndicator">@color/material_dynamic_secondary70</color>
|
||||
</resources>
|
|
@ -24,4 +24,7 @@
|
|||
<color name="colorSurfaceVariant">@color/material_dynamic_neutral_variant90</color>
|
||||
<color name="colorOnSurfaceVariant">@color/material_dynamic_neutral_variant30</color>
|
||||
<color name="colorSurfaceInverse">@color/material_dynamic_neutral20</color>
|
||||
|
||||
<!-- indicator icon background -->
|
||||
<color name="colorIndicator">@color/material_dynamic_secondary80</color>
|
||||
</resources>
|
|
@ -30,6 +30,7 @@
|
|||
<item name="colorOnBackground">@color/colorOnBackground</item>
|
||||
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
|
||||
</style>
|
||||
</resources>
|
|
@ -25,4 +25,6 @@
|
|||
<color name="colorSurfaceInverse">#31312B</color>
|
||||
<color name="colorOnSurfaceInverse">#F3F1E8</color>
|
||||
<color name="colorPrimaryInverse">#B8D321</color>
|
||||
<!-- indicator icon background -->
|
||||
<color name="colorIndicator">#d2d4bc</color>
|
||||
</resources>
|
6
shared/ui/src/main/res/values/global.xml
Normal file
6
shared/ui/src/main/res/values/global.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Lacerta.Custom.Indicator" parent="Widget.Material3.BottomNavigationView.ActiveIndicator">
|
||||
<item name="android:color">@color/colorIndicator</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -15,4 +15,5 @@
|
|||
|
||||
<!-- common -->
|
||||
|
||||
<string name="placeholder">Placeholder(TODO: Replace)</string>
|
||||
</resources>
|
|
@ -28,8 +28,6 @@
|
|||
<item name="colorOutline">@color/colorOutline</item>
|
||||
<item name="colorOnBackground">@color/colorOnBackground</item>
|
||||
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="Theme.Lacerta" parent="Base.Theme.Lacerta" >
|
||||
|
|
Loading…
Reference in New Issue
Block a user