mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-07 19:47:36 +00:00
Compare commits
2
Commits
scan_setting
...
test2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65c6ca77ed | ||
|
|
f02440348b |
No files matched your search
@@ -8,6 +8,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
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;
|
||||||
@@ -15,6 +16,7 @@ import androidx.appcompat.app.ActionBarDrawerToggle;
|
|||||||
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.core.content.ContextCompat;
|
||||||
|
import androidx.core.view.MenuProvider;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@@ -71,39 +73,52 @@ public class HomeTopFragment extends Fragment {
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
|
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
// setHasOptionsMenu(true);
|
||||||
|
Toolbar toolbar = view.findViewById(R.id.home_toolbar);
|
||||||
|
toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px);
|
||||||
|
toolbar.setNavigationOnClickListener(v -> {
|
||||||
|
Toast.makeText(getContext(), "Works!!!!!!!!!!!!", Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
toolbar.inflateMenu(R.menu.drawer_menu);
|
||||||
|
toolbar.setOnMenuItemClickListener(item -> {
|
||||||
|
if (item.getItemId() == R.id.item_placeholder) {
|
||||||
|
Toast.makeText(getContext(), "Works!", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
// public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
// super.onViewCreated(view, savedInstanceState);
|
||||||
|
//
|
||||||
RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view);
|
// RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view);
|
||||||
|
//
|
||||||
|
//
|
||||||
ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> {
|
// ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> {
|
||||||
Log.d("HomeTopFragment", "onViewCreated: " + documentId);
|
// Log.d("HomeTopFragment", "onViewCreated: " + documentId);
|
||||||
Intent intent = new Intent(getContext(), ViewerMainActivity.class);
|
// Intent intent = new Intent(getContext(), ViewerMainActivity.class);
|
||||||
intent.putExtra("documentId", documentId);
|
// intent.putExtra("documentId", documentId);
|
||||||
startActivity(intent);
|
// startActivity(intent);
|
||||||
});
|
// });
|
||||||
recyclerView.setAdapter(listItemAdapter);
|
// recyclerView.setAdapter(listItemAdapter);
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
// recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
//
|
||||||
lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
|
// lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
|
||||||
listItemAdapter.setListItems(listItems);
|
// listItemAdapter.setListItems(listItems);
|
||||||
getActivity().runOnUiThread(() -> {
|
// getActivity().runOnUiThread(() -> {
|
||||||
listItemAdapter.notifyItemRangeInserted(0, listItems.size());
|
// listItemAdapter.notifyItemRangeInserted(0, listItems.size());
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
// public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.drawer_menu, menu);
|
// inflater.inflate(R.menu.drawer_menu, menu);
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
// super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,50 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorSurface">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
android:id="@+id/home_item_recycler_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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">
|
||||||
|
|
||||||
|
<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/home_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>
|
</FrameLayout>
|
||||||
Reference in new issue
Block a user