diff --git a/app/build.gradle b/app/build.gradle index ae313899..289d4f4f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,4 +82,6 @@ dependencies { implementation project(':model') implementation project(':utils') + + implementation project(':component:scanner') } \ No newline at end of file diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index 725c1063..f74b20a7 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -10,6 +10,7 @@ import androidx.navigation.NavController; import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.ui.NavigationUI; +import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.util.Log; @@ -17,12 +18,14 @@ import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import one.nem.lacerta.component.scanner.ScannerManagerActivity; import one.nem.lacerta.model.FragmentNavigation; import one.nem.lacerta.model.pref.FeatureSwitchOverride; import one.nem.lacerta.utils.FeatureSwitch; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.bottomnavigation.BottomNavigationView; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.io.NotActiveException; @@ -74,6 +77,13 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio // Set status bar color getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface)); + // Fab + findViewById(R.id.scanFab).setOnClickListener(v -> { + Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(this.getApplicationContext(), ScannerManagerActivity.class); + startActivity(intent); + }); + } private void initializeApp() { Log.d("Init", "Initializing app"); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 59d77a93..ee667530 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -34,4 +34,17 @@ app:layout_constraintStart_toStartOf="parent" app:menu="@menu/bottom_nav_menu" /> + + + + \ No newline at end of file diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java index bac0bd3c..dcfc89fa 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java @@ -3,16 +3,13 @@ package one.nem.lacerta.component.scanner; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; -import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import androidx.activity.EdgeToEdge; -import androidx.annotation.AnimatorRes; import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; @@ -28,11 +25,11 @@ import java.util.concurrent.CompletableFuture; import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.processor.factory.DocumentProcessorFactory; import one.nem.lacerta.utils.LacertaLogger; -import one.nem.lacerta.data.Document; import one.nem.lacerta.vcs.factory.LacertaVcsFactory; @AndroidEntryPoint @@ -121,7 +118,7 @@ public class ScannerManagerActivity extends AppCompatActivity { return true; } else if (item.getItemId() == R.id.action_insert_exist) { // 既存ドキュメントに挿入 - Toast.makeText(this, "挿入処理", Toast.LENGTH_SHORT).show(); + Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show(); insertToExistDocument(); return true; } else if (item.getItemId() == android.R.id.home) { @@ -139,7 +136,6 @@ public class ScannerManagerActivity extends AppCompatActivity { if (this.croppedImages.isEmpty()) { logger.debug(TAG, "this.resultImages is empty"); logger.e_code("7cb0584e-74ef-48ec-848a-c4d14e75e15a"); - // TODO-rca: なんかする } else { logger.debug(TAG, "this.resultImages is not empty"); updateResultView(this.croppedImages); diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index e3f71bb7..6e456d16 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -1,5 +1,6 @@ package one.nem.lacerta.component.viewer; +import android.app.AlertDialog; import android.graphics.Bitmap; import android.os.Bundle; @@ -23,6 +24,7 @@ import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.page.Page; +import one.nem.lacerta.utils.FeatureSwitch; import one.nem.lacerta.utils.LacertaLogger; /** @@ -42,15 +44,17 @@ public class ComponentViewerTopFragment extends Fragment { private static final String TAG = "ComponentViewerTopFragment"; private String documentId; + private String documentName; public ComponentViewerTopFragment() { // Required empty public constructor } - public static ComponentViewerTopFragment newInstance(String documentId) { + public static ComponentViewerTopFragment newInstance(String documentId, String documentName) { ComponentViewerTopFragment fragment = new ComponentViewerTopFragment(); Bundle args = new Bundle(); args.putString("documentId", documentId); + args.putString("documentName", documentName); fragment.setArguments(args); return fragment; } @@ -60,6 +64,7 @@ public class ComponentViewerTopFragment extends Fragment { super.onCreate(savedInstanceState); if (getArguments() != null) { documentId = getArguments().getString("documentId"); + documentName = getArguments().getString("documentName"); } } @@ -71,7 +76,7 @@ public class ComponentViewerTopFragment extends Fragment { // Toolbar Toolbar toolbar = view.findViewById(R.id.toolbar); - toolbarSetup(toolbar, true, "Revision List"); + toolbarSetup(toolbar, true, this.documentName == null ? "Document" : this.documentName); RecyclerView recyclerView = view.findViewById(R.id.body_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); @@ -80,12 +85,14 @@ public class ComponentViewerTopFragment extends Fragment { }); recyclerView.setAdapter(viewerBodyAdapter); + if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE); document.getDocument(documentId).thenAccept(documentDetail -> { ArrayList pages = documentDetail.getPages(); logger.debug(TAG, "pages.size(): " + pages.size()); viewerBodyAdapter.setPages(pages); getActivity().runOnUiThread(() -> { viewerBodyAdapter.notifyItemRangeChanged(0, pages.size()); + if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.GONE); }); }); @@ -104,9 +111,8 @@ public class ComponentViewerTopFragment extends Fragment { if (showBackButton) { toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); toolbar.setNavigationOnClickListener(v -> { - //this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join(); - // Back - Navigation.findNavController(requireView()).popBackStack(); + // Stop Activity + getActivity().finish(); }); } else { toolbar.setNavigationIcon(null); @@ -120,6 +126,49 @@ public class ComponentViewerTopFragment extends Fragment { .replace(R.id.nav_host_fragment, ViewerVcsRevListFragment.newInstance(documentId)) .commit(); return true; + } else if (item.getItemId() == R.id.action_rename) { + // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle("ファイル名の変更"); + builder.setMessage("ファイル名を入力してください"); + final android.widget.EditText input = new android.widget.EditText(getContext()); + input.setText(documentName); + builder.setView(input); + builder.setPositiveButton("作成", (dialog, which) -> { + document.renameDocument(documentId, input.getText().toString()).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + toolbar.setTitle(input.getText().toString()); + documentName = input.getText().toString(); + }); + }); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + builder.show(); + + return true; + } else if (item.getItemId() == R.id.action_delete) { + // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle("ファイルの削除"); + builder.setMessage("ファイルを削除しますか?"); + builder.setPositiveButton("削除", (dialog, which) -> { + document.deleteDocument(documentId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + // Stop Activity + getActivity().finish(); + }); + }); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + builder.show(); + return true; + } else if (item.getItemId() == R.id.action_move) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; } else { return false; } diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java index 6ef85637..435e472c 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java @@ -35,6 +35,7 @@ public class ViewerMainActivity extends AppCompatActivity { // Variables private static final String TAG = "ViewerMainActivity"; String documentId; + String documentName; @Override protected void onCreate(Bundle savedInstanceState) { @@ -50,6 +51,7 @@ public class ViewerMainActivity extends AppCompatActivity { Intent intent = getIntent(); try { documentId = intent.getStringExtra("documentId"); + documentName = intent.getStringExtra("documentName"); } catch (Exception e) { logger.error(TAG, "Failed to get documentId from intent"); @@ -60,7 +62,7 @@ public class ViewerMainActivity extends AppCompatActivity { // Navigation getSupportFragmentManager().beginTransaction() - .replace(R.id.nav_host_fragment, ComponentViewerTopFragment.newInstance(documentId)) + .replace(R.id.nav_host_fragment, ComponentViewerTopFragment.newInstance(documentId, documentName)) .commit(); } } \ No newline at end of file diff --git a/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml b/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml index 678d0418..6c8791de 100644 --- a/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml +++ b/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml @@ -37,6 +37,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/data/src/main/java/one/nem/lacerta/data/Document.java b/data/src/main/java/one/nem/lacerta/data/Document.java index cd38acfc..70610913 100644 --- a/data/src/main/java/one/nem/lacerta/data/Document.java +++ b/data/src/main/java/one/nem/lacerta/data/Document.java @@ -18,6 +18,8 @@ public interface Document { CompletableFuture createDocument(); + CompletableFuture renameDocument(String documentId, String name); + CompletableFuture deleteDocument(String documentId); CompletableFuture updateDocument(DocumentDetail detail); diff --git a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java index 888a47f6..7a303ec5 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java @@ -1,5 +1,7 @@ package one.nem.lacerta.data.impl; +import androidx.room.Update; + import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -112,6 +114,11 @@ public class DocumentImpl implements Document { @Override public CompletableFuture deleteDocument(String documentId) { return CompletableFuture.supplyAsync(() -> { + DocumentEntity documentEntity = database.documentDao().findById(documentId); + if (documentEntity == null) { + throw new IllegalArgumentException("documentId is not found"); + } + database.documentDao().delete(documentEntity); return null; }); } @@ -124,6 +131,19 @@ public class DocumentImpl implements Document { }); } + @Override + public CompletableFuture renameDocument(String documentId, String name) { + return CompletableFuture.supplyAsync(() -> { + DocumentEntity documentEntity = database.documentDao().findById(documentId); + if (documentEntity == null) { + throw new IllegalArgumentException("documentId is not found"); + } + documentEntity.title = name; + database.documentDao().update(documentEntity); + return null; + }); + } + @Override public CompletableFuture getDocument(String documentId) { return CompletableFuture.supplyAsync(() -> { diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java index 2d5d1f93..5067f701 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java @@ -1,6 +1,7 @@ package one.nem.lacerta.data.impl; import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; @@ -38,13 +39,6 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture> getRecentDocument(int limit) { return CompletableFuture.supplyAsync(() -> { - // 5秒フリーズさせる - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - List documentEntities = database.documentDao().getRecentDocument(limit); ArrayList listItems = new ArrayList<>(); @@ -106,12 +100,14 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItems.add(listItem); } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:"); + for (DocumentEntity documentEntity : documentEntities) { logger.debug("LacertaLibraryImpl", "documentEntity.title: " + documentEntity.title); ListItem listItem = new ListItem(); listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); listItem.setTitle(documentEntity.title); -// listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant())); + listItem.setDescription(simpleDateFormat.format(documentEntity.updatedAt)); listItem.setItemId(documentEntity.id); listItems.add(listItem); } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java index 852f8e98..3d33367f 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java @@ -1,5 +1,5 @@ package one.nem.lacerta.feature.home; public interface DocumentSelectListener { - void onDocumentSelect(String documentId); + void onDocumentSelect(String documentId, String documentName); } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java index a5d26c13..3d64657c 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java @@ -4,38 +4,21 @@ import android.content.Intent; 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.annotation.NonNull; -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.navigation.Navigation; 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; -import java.util.concurrent.CompletableFuture; - import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.viewer.ViewerMainActivity; -import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; -import one.nem.lacerta.model.ListItem; -import one.nem.lacerta.model.document.DocumentMeta; - +import one.nem.lacerta.utils.FeatureSwitch; /** @@ -49,6 +32,8 @@ public class HomeTopFragment extends Fragment { @Inject LacertaLibrary lacertaLibrary; + private ListItemAdapter listItemAdapter; + public HomeTopFragment() { // Required empty public constructor } @@ -71,7 +56,6 @@ public class HomeTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home_top, container, false); - setHasOptionsMenu(true); return view; } @@ -81,28 +65,71 @@ public class HomeTopFragment extends Fragment { RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view); + Toolbar toolbar = view.findViewById(R.id.home_toolbar); + toolbarSetup(toolbar, false, "ホーム"); - ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { - Log.d("HomeTopFragment", "onViewCreated: " + documentId); - Intent intent = new Intent(getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", documentId); - startActivity(intent); + this.listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { + @Override + public void onDocumentSelect(String documentId, String documentName) { + Intent intent = new Intent(getContext(), ViewerMainActivity.class); + Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName); + intent.putExtra("documentId", documentId); + intent.putExtra("documentName", documentName); + startActivity(intent); + } }); recyclerView.setAdapter(listItemAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + updateList(); + } + + @Override + public void onResume() { + super.onResume(); + + updateList(); + } + + private void updateList() { lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> { - listItemAdapter.setListItems(listItems); + if (listItems == null) { + return; + } + this.listItemAdapter.setListItems(listItems); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, listItems.size()); + Log.d("HomeTopFragment", "onViewCreated: " + listItems.size()); + if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + this.listItemAdapter.notifyDataSetChanged(); + } else { + // IndexOutOfBoundsExceptionを吐くことがあったので いったん + this.listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); + } }); }); } - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - inflater.inflate(R.menu.drawer_menu, menu); - super.onCreateOptionsMenu(menu, inflater); + /** + * ToolbarをInitする + * + * @param toolbar Toolbar + * @param showBackButton 戻るボタンを表示するか + * @param title タイトル + */ + private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title) { + getActivity().runOnUiThread(() -> { + if (showBackButton) { + toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); + toolbar.setNavigationOnClickListener(v -> { + //this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join(); + // Back + Navigation.findNavController(requireView()).popBackStack(); + }); + } else { + toolbar.setNavigationIcon(null); + } + toolbar.setTitle(title); + }); } } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java index cf94a9e9..80656ecb 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java @@ -46,15 +46,17 @@ public class ListItemAdapter extends RecyclerView.Adapter { - Intent intent = new Intent(v.getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", listItem.getItemId()); - v.getContext().startActivity(intent); + listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle()); }); } @Override public int getItemCount() { - return listItems.size(); + if (listItems == null) { + return 0; + } else { + return listItems.size(); + } } public static class ListItemViewHolder extends RecyclerView.ViewHolder{ diff --git a/feature/home/src/main/res/layout/fragment_home_top.xml b/feature/home/src/main/res/layout/fragment_home_top.xml index 3fc0b723..e3b70845 100644 --- a/feature/home/src/main/res/layout/fragment_home_top.xml +++ b/feature/home/src/main/res/layout/fragment_home_top.xml @@ -29,7 +29,7 @@ app:layout_scrollFlags="scroll|exitUntilCollapsed"> { // TODO-rca: 実行条件を考える? - listItemAdapter.notifyItemRangeRemoved(0, this.libraryItemPage.getListItems().size() - 1); - }); + if (!FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + getActivity().runOnUiThread(() -> { // TODO-rca: 実行条件を考える? + listItemAdapter.notifyItemRangeRemoved(0, this.libraryItemPage.getListItems().size() - 1); + }); + } listItemAdapter.setLibraryItemPage(this.libraryItemPage); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size() - 1); + if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + listItemAdapter.notifyDataSetChanged(); + } else { + listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size() - 1); + } }); }); } @@ -269,6 +276,7 @@ public class LibraryPageFragment extends Fragment { toolbar.setNavigationIcon(null); } toolbar.setTitle(title); + toolbar.getMenu().clear(); toolbar.inflateMenu(R.menu.dir_menu); toolbar.setOnMenuItemClickListener(item -> { if (item.getItemId() == R.id.menu_item_create_new_folder) { diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java index 9d538716..c28e61ec 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java @@ -1,6 +1,5 @@ package one.nem.lacerta.feature.library; -import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,8 +9,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import java.util.ArrayList; - import one.nem.lacerta.model.LibraryItemPage; import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.ListItemType; diff --git a/feature/library/src/main/res/menu/dir_menu.xml b/feature/library/src/main/res/menu/dir_menu.xml index 451c94a4..e5cea78a 100644 --- a/feature/library/src/main/res/menu/dir_menu.xml +++ b/feature/library/src/main/res/menu/dir_menu.xml @@ -4,8 +4,8 @@ + android:icon="@drawable/create_new_folder_24px" + android:title="@string/create_new_folder" + app:showAsAction="never"/> \ No newline at end of file diff --git a/feature/library/src/main/res/values/strings.xml b/feature/library/src/main/res/values/strings.xml index 1049ca2d..d0ca5af4 100644 --- a/feature/library/src/main/res/values/strings.xml +++ b/feature/library/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ Library + 新しいフォルダを作成 \ No newline at end of file diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java index cad410b9..986fdb2e 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java @@ -17,16 +17,16 @@ import android.view.ViewGroup; * Use the {@link SettingScanPageFragment#newInstance} factory method to * create an instance of this fragment. */ -public class SettingScanPageFragment extends PreferenceFragmentCompat { +public class SettingScanPageFragment extends Fragment { public SettingScanPageFragment() { // Required empty public constructor } - - @Override - public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { - addPreferencesFromResource(R.xml.scan_preferences); - } +// +// @Override +// public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { +//// addPreferencesFromResource(R.xml.scan_preferences); +// } public static SettingScanPageFragment newInstance() { SettingScanPageFragment fragment = new SettingScanPageFragment(); @@ -35,4 +35,15 @@ public class SettingScanPageFragment extends PreferenceFragmentCompat { return fragment; } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_setting_scan_page, container, false); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + } + } \ No newline at end of file diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java index 9941f8aa..14b1bd06 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java @@ -1,16 +1,15 @@ package one.nem.lacerta.setting; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - import java.util.ArrayList; import one.nem.lacerta.setting.model.SettingListItem; diff --git a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml index a087b6ad..2f6fc77d 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml index 0e55ea63..aeacef68 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml index 0e6fd5bb..dd09f3e6 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml b/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml index 916f5abe..dd2eacee 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml @@ -39,11 +39,40 @@ - + app:layout_behavior="@string/appbar_scrolling_view_behavior" > + + + + + + + + + + + diff --git a/shared/ui/src/main/res/drawable/create_new_folder_24px.xml b/shared/ui/src/main/res/drawable/create_new_folder_24px.xml new file mode 100644 index 00000000..cd2520f4 --- /dev/null +++ b/shared/ui/src/main/res/drawable/create_new_folder_24px.xml @@ -0,0 +1,10 @@ + + + diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index 6077bf4e..753d137f 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -20,7 +20,6 @@ import javax.xml.transform.stream.StreamResult; import dagger.assisted.Assisted; import dagger.assisted.AssistedInject; import one.nem.lacerta.source.file.FileManager; - import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.Store; diff --git a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java index 91aab3eb..14832a5c 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java +++ b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java @@ -6,6 +6,16 @@ public class FeatureSwitch { public static boolean canOverrideSwitch = false; } + public static class RecyclerView { + public static boolean useSimpleNotifyMethod = true; + } + + public static class Viewer { + public static boolean showOriginalImage = false; + public static int maxImageSize = 1024; + public static boolean showProgressBarWhenLoading = true; + } + public static class FeatureMaster { public static boolean enableSearch = false; public static boolean enableDebugMenu = true; diff --git a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java index 63da3858..93d701d2 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java @@ -1,5 +1,6 @@ package one.nem.lacerta.vcs.impl; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -136,6 +137,7 @@ public class LacertaVcsImpl implements LacertaVcs { vcsRevModel.setId(vcsRevEntity.id); vcsRevModel.setDocumentId(vcsRevEntity.documentId); vcsRevModel.setBranchName(vcsRevEntity.branchName); + vcsRevModel.setCreatedAt(vcsRevEntity.createdAt); vcsRevModel.setCommitMessage(vcsRevEntity.commitMessage); vcsRevModel.setLogIds(vcsRevEntity.logIds); vcsRevModels.add(vcsRevModel);