Merge pull request #100 from lacerta-doc/submit_jan23

Submit jan23
This commit is contained in:
ろむねこ 2024-01-23 05:25:02 +09:00 committed by GitHub
commit 60f279d365
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 50 additions and 17 deletions

View File

@ -8,6 +8,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
@ -40,13 +41,14 @@ public class RevAdapter extends RecyclerView.Adapter<RevAdapter.RevViewHolder>{
@Override @Override
public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) { public void onBindViewHolder(@NonNull RevAdapter.RevViewHolder holder, int position) {
VcsRevModel revModel = revModels.get(position); VcsRevModel revModel = revModels.get(position);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
holder.title.setText(revModel.getCommitMessage()); holder.title.setText(revModel.getCommitMessage());
if (FeatureSwitch.Vcs.disableBranchDisplay) { if (FeatureSwitch.Vcs.disableBranchDisplay) {
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant())); // holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()));
holder.detail.setText("DateTimePlaceholder"); holder.detail.setText(simpleDateFormat.format(revModel.getCreatedAt()));
} else { } else {
// holder.detail.setText(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(revModel.getCreatedAt().toInstant()) + " " + revModel.getBranchName()); // 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()); holder.revId.setText("RevID: " + revModel.getId());

View File

@ -8,11 +8,14 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
@ -56,6 +59,17 @@ 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);
// 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; return view;
} }

View File

@ -53,5 +53,7 @@ dependencies {
implementation project(':utils') implementation project(':utils')
implementation project(':component:viewer')
} }

View File

@ -1,6 +1,7 @@
package one.nem.lacerta.feature.library; package one.nem.lacerta.feature.library;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -35,6 +36,7 @@ import java.util.Objects;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.component.viewer.ViewerMainActivity;
import one.nem.lacerta.data.Document; import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.FragmentNavigation; import one.nem.lacerta.model.FragmentNavigation;
@ -117,19 +119,13 @@ public class LibraryPageFragment extends Fragment {
// Set status bar color // Set status bar color
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout); AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
@Override if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) {
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { // Collapsed
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) { getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
// Collapsed } else if (verticalOffset == 0) {
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); // Expanded
} else if (verticalOffset == 0) { getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
// 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
}
} }
}); });
return view; return view;
@ -179,7 +175,11 @@ public class LibraryPageFragment extends Fragment {
@Override @Override
public void onDocumentSelected(String documentId, String documentName) { 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);
} }
}); });

View File

@ -10,6 +10,8 @@ import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.appbar.AppBarLayout;
import java.util.ArrayList; import java.util.ArrayList;
import one.nem.lacerta.setting.model.SettingListItem; import one.nem.lacerta.setting.model.SettingListItem;
@ -86,6 +88,17 @@ public class SettingTopFragment extends Fragment {
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(new ListItemAdapter(settingListItems)); 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; return view;
} }
} }

View File

@ -11,6 +11,7 @@ public class FeatureSwitch {
} }
public static class Viewer { public static class Viewer {
// TODO-rca: 実装
public static boolean showOriginalImage = false; public static boolean showOriginalImage = false;
public static int maxImageSize = 1024; public static int maxImageSize = 1024;
public static boolean showProgressBarWhenLoading = true; public static boolean showProgressBarWhenLoading = true;
@ -18,7 +19,7 @@ public class FeatureSwitch {
public static class FeatureMaster { public static class FeatureMaster {
public static boolean enableSearch = false; public static boolean enableSearch = false;
public static boolean enableDebugMenu = true; public static boolean enableDebugMenu = false;
} }
public static class Vcs { public static class Vcs {
@ -26,6 +27,7 @@ public class FeatureSwitch {
} }
public static class Setting { public static class Setting {
// TODO-rca: 実装
public static boolean showDisplayMenu = false; public static boolean showDisplayMenu = false;
public static boolean showDataMenu = false; public static boolean showDataMenu = false;
public static boolean showScanMenu = false; public static boolean showScanMenu = false;