mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
Works
This commit is contained in:
parent
f02440348b
commit
65c6ca77ed
|
@ -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);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/home_toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
app:layout_collapseMode="pin"
|
app:layout_collapseMode="pin"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user