diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/RevAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/RevAdapter.java index bee4308d..eb5c634f 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/RevAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/RevAdapter.java @@ -8,6 +8,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import java.text.SimpleDateFormat; import java.time.format.DateTimeFormatter; import java.util.ArrayList; @@ -40,13 +41,14 @@ public class RevAdapter extends RecyclerView.Adapter{ @Override public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) { VcsRevModel revModel = revModels.get(position); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); holder.title.setText(revModel.getCommitMessage()); if (FeatureSwitch.Vcs.disableBranchDisplay) { // holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant())); - holder.detail.setText("DateTimePlaceholder"); + holder.detail.setText(simpleDateFormat.format(revModel.getCreatedAt())); } else { // holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()) + " " + revModel.getBranchName()); - holder.detail.setText("DateTimePlaceholder" + " " + revModel.getBranchName()); + holder.detail.setText(simpleDateFormat.format(revModel.getCreatedAt())+ " " + revModel.getBranchName()); } holder.revId.setText("RevID: " + revModel.getId()); 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 3d64657c..e27bcfbd 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 @@ -8,11 +8,14 @@ import android.view.View; import android.view.ViewGroup; import androidx.appcompat.widget.Toolbar; +import androidx.core.content.ContextCompat; 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 javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; @@ -56,6 +59,17 @@ public class HomeTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home_top, container, false); + // Set status bar color + AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout); + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); + } + }); return view; } diff --git a/feature/library/build.gradle b/feature/library/build.gradle index fa18f9bc..6b102535 100644 --- a/feature/library/build.gradle +++ b/feature/library/build.gradle @@ -53,5 +53,7 @@ dependencies { implementation project(':utils') + implementation project(':component:viewer') + } \ No newline at end of file diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java index 363121d5..fd9d3e89 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java @@ -1,6 +1,7 @@ package one.nem.lacerta.feature.library; import android.app.AlertDialog; +import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; @@ -35,6 +36,7 @@ import java.util.Objects; 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.FragmentNavigation; @@ -117,19 +119,13 @@ public class LibraryPageFragment extends Fragment { // Set status bar color 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(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); - } else if (verticalOffset == 0) { - // Expanded - getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); - } else { - // Somewhere in between - // Here you can add a color transition if you want - } + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); } }); return view; @@ -179,7 +175,11 @@ public class LibraryPageFragment extends Fragment { @Override public void onDocumentSelected(String documentId, String documentName) { - Toast.makeText(getContext(), "Document selected! documentId: " + documentId + ", documentName: " + documentName, Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(getContext(), ViewerMainActivity.class); + logger.debug("LibraryTopFragment", "Document selected! documentId: " + documentId + ", documentName: " + documentName); + intent.putExtra("documentId", documentId); + intent.putExtra("documentName", documentName); + startActivity(intent); } }); 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 14b1bd06..6c789b17 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 @@ -10,6 +10,8 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.appbar.AppBarLayout; + import java.util.ArrayList; import one.nem.lacerta.setting.model.SettingListItem; @@ -86,6 +88,17 @@ public class SettingTopFragment extends Fragment { recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setAdapter(new ListItemAdapter(settingListItems)); + // Set status bar color + AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout); + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); + } + }); return view; } } \ No newline at end of file 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 14832a5c..5c808841 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java +++ b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java @@ -11,6 +11,7 @@ public class FeatureSwitch { } public static class Viewer { + // TODO-rca: 実装 public static boolean showOriginalImage = false; public static int maxImageSize = 1024; public static boolean showProgressBarWhenLoading = true; @@ -18,7 +19,7 @@ public class FeatureSwitch { public static class FeatureMaster { public static boolean enableSearch = false; - public static boolean enableDebugMenu = true; + public static boolean enableDebugMenu = false; } public static class Vcs { @@ -26,6 +27,7 @@ public class FeatureSwitch { } public static class Setting { + // TODO-rca: 実装 public static boolean showDisplayMenu = false; public static boolean showDataMenu = false; public static boolean showScanMenu = false;